Skip to content

Commit

Permalink
add beam mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed Nov 12, 2024
1 parent 0f48618 commit ab28a86
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions resources/js/api/beam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class BeamApi {
start: createBeamData.start,
end: createBeamData.end,
flags: createBeamData.flags,
claimLimit: createBeamData.claimLimit,
collectionId: createBeamData.collectionId,
tokens: createBeamData.tokens,
},
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class="inline-flex rounded-md px-1 truncate"
:class="{
'bg-red-500 !text-white ': isError,
'bg-light-surface-background dark:bg-dark-surface-background text-light-content-strong dark:text-dark-content-strong':
'bg-light-surface-brand-alpha dark:bg-dark-surface-brand-alpha text-light-content-strong dark:text-dark-content-strong':
!isError,
}"
>
Expand Down
11 changes: 11 additions & 0 deletions resources/js/components/pages/create/CreateBeam.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@
description="The claim period end date."
required
/>
<FormInput
v-model="claimLimit"
name="claimLimit"
label="Claim Limit"
description="Claim limit per token between 1 and 100."
type="number"
required
/>
<MultiCheckbox
v-model="flags"
name="flags"
Expand Down Expand Up @@ -157,6 +165,7 @@ const description = ref('');
const image = ref('');
const start = ref(new Date());
const end = ref(new Date());
const claimLimit = ref(1);
const flags = ref([]);
Expand Down Expand Up @@ -203,6 +212,7 @@ const validation = yup.object({
start: yup.date().required(),
end: yup.date().min(yup.ref('start')).required(),
flags: yup.array().of(yup.string()),
claimLimit: yup.number().min(1).max(100).required(),
});
const addItem = () => {
Expand Down Expand Up @@ -250,6 +260,7 @@ const createBeam = async () => {
image: image.value,
start: new Date(start.value).toISOString(),
end: new Date(end.value).toISOString(),
claimLimit: claimLimit.value,
flags: flags.value.map((f) => {
return {
flag: f,
Expand Down
3 changes: 2 additions & 1 deletion resources/js/graphql/mutation/beam/CreateBeam.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
export default `mutation CreateBeam($name: String!, $description: String!, $image: String!, $start: DateTime!, $end: DateTime!, $flags: [BeamFlagInputType!], $collectionId: BigInt!, $tokens: [ClaimToken!]!) {
export default `mutation CreateBeam($name: String!, $description: String!, $image: String!, $start: DateTime!, $end: DateTime!, $claimLimit: Int, $flags: [BeamFlagInputType!], $collectionId: BigInt!, $tokens: [ClaimToken!]!) {
CreateBeam(
name: $name
description: $description
image: $image
start: $start
end: $end
flags: $flags
claimLimit: $claimLimit
collectionId: $collectionId
tokens: $tokens
)
Expand Down
5 changes: 4 additions & 1 deletion resources/js/graphql/query/beam/GetBeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default `query GetBeam($code: String!, $account: String) {
isClaimable
claimLimit
claimsRemaining
claimConditions
claimConditions {
type
value
}
flags
qr {
url
Expand Down
5 changes: 4 additions & 1 deletion resources/js/graphql/query/beam/GetBeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export default `query GetBeams($codes: [String!], $names: [String!], $after: Str
isClaimable
claimLimit
claimsRemaining
claimConditions
claimConditions {
type
value
}
flags
qr {
url
Expand Down

0 comments on commit ab28a86

Please sign in to comment.