Skip to content

Commit

Permalink
add claim conditions view
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed May 7, 2024
1 parent ecf6d48 commit 16d240b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions resources/js/api/beam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class BeamApi {
start: updateBeamData.start,
end: updateBeamData.end,
flags: updateBeamData.flags,
claimConditions: updateBeamData.claimConditions,
},
};

Expand Down
17 changes: 17 additions & 0 deletions resources/js/components/slideovers/beam/DetailsBeamSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
<dt class="text-base font-medium text-gray-500">Flags</dt>
<Chip v-for="flag in item.flags" :key="flag" :text="flag" :closable="false" class="mr-2" />
</div>
<div class="space-y-2 pt-4 pb-3" v-if="item.claimConditions.length">
<dt class="text-base font-medium text-gray-500">Conditions</dt>
<Chip
v-for="condition in item.claimConditions"
:key="condition.type"
:text="formatCondition(condition)"
:closable="false"
class="mr-2"
/>
</div>
</div>
</div>
</div>
Expand All @@ -77,6 +87,13 @@ defineProps<{
isClaimable: boolean;
flags: string[];
image: string;
claimConditions: { type: string; value: string }[];
};
}>();

const formatCondition = (condition) => {
const type = condition.type.replace(/_/g, ' ');

return `${type}: ${condition.value}`;
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const props = withDefaults(
start: string;
end: string;
flags: string[];
claimConditions: { type: string; value: string }[];
};
}>(),
{
Expand Down Expand Up @@ -151,6 +152,7 @@ const checkChanges = () => {
};
})
: null,
claimConditions: props.item?.claimConditions,
};
};
Expand Down
3 changes: 2 additions & 1 deletion resources/js/graphql/mutation/beam/UpdateBeam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default `mutation UpdateBeam($code: String!, $name: String, $description: String, $image: String, $start: DateTime, $end: DateTime, $flags: [BeamFlagInputType!]) {
export default `mutation UpdateBeam($code: String!, $name: String, $description: String, $image: String, $start: DateTime, $end: DateTime, $flags: [BeamFlagInputType!], $claimConditions: [ClaimConditionInputType]) {
UpdateBeam(
code: $code
name: $name
Expand All @@ -7,5 +7,6 @@ export default `mutation UpdateBeam($code: String!, $name: String, $description:
start: $start
end: $end
flags: $flags
claimConditions: $claimConditions
)
}`;
4 changes: 4 additions & 0 deletions resources/js/graphql/query/beam/GetBeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ export default `query GetBeam($code: String!, $account: String) {
url
payload
}
claimConditions {
type
value
}
}
}`;
4 changes: 4 additions & 0 deletions resources/js/graphql/query/beam/GetBeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default `query GetBeams($codes: [String!], $names: [String!], $after: Str
url
payload
}
claimConditions {
type
value
}
}
}
pageInfo {
Expand Down

0 comments on commit 16d240b

Please sign in to comment.