From 6acf78744b769d57c4efa26516c126d79221a192 Mon Sep 17 00:00:00 2001 From: Satont Date: Fri, 24 May 2024 01:28:53 +0300 Subject: [PATCH] refactor(dashboard): new input with variables (#732) * refactor(dashboard): new input with variables * feat(dashboard): refactor variables input --- apps/api-gql/schema/games.graphqls | 6 +- .../src/components/games/russianRoulette.vue | 2 +- .../src/components/games/seppuku.vue | 2 +- .../src/components/games/voteban.vue | 4 +- .../src/components/variable-input.vue | 92 ++++++++++++------- .../greetings/ui/greetings-dialog.vue | 23 +++-- 6 files changed, 80 insertions(+), 49 deletions(-) diff --git a/apps/api-gql/schema/games.graphqls b/apps/api-gql/schema/games.graphqls index cbc563b6f..86561f3c4 100644 --- a/apps/api-gql/schema/games.graphqls +++ b/apps/api-gql/schema/games.graphqls @@ -86,7 +86,7 @@ type SeppukuGame { input SeppukuGameOpts { enabled: Boolean - timeoutSeconds: Int @validate(constraint: "max=84600,min=1") + timeoutSeconds: Int @validate(constraint: "max=86400,min=1") timeoutModerators: Boolean message: String @validate(constraint: "max=500") messageModerators: String @validate(constraint: "max=500") @@ -115,7 +115,7 @@ type VotebanGame { input VotebanGameOpts { enabled: Boolean - timeoutSeconds: Int @validate(constraint: "min=1,max=84600") + timeoutSeconds: Int @validate(constraint: "min=1,max=86400") timeoutModerators: Boolean initMessage: String @validate(constraint: "max=500") banMessage: String @validate(constraint: "max=500") @@ -123,7 +123,7 @@ input VotebanGameOpts { surviveMessage: String @validate(constraint: "max=500") surviveMessageModerators: String @validate(constraint: "max=500") neededVotes: Int @validate(constraint: "min=1,max=999999") - voteDuration: Int @validate(constraint: "min=1,max=84600") + voteDuration: Int @validate(constraint: "min=1,max=86400") votingMode: VoteBanGameVotingMode @validate(constraint: "max=500") chatVotesWordsPositive: [String!] @validate(constraint: "dive,max=500") chatVotesWordsNegative: [String!] @validate(constraint: "dive,max=500") diff --git a/frontend/dashboard/src/components/games/russianRoulette.vue b/frontend/dashboard/src/components/games/russianRoulette.vue index 376a7b648..efcbcb344 100644 --- a/frontend/dashboard/src/components/games/russianRoulette.vue +++ b/frontend/dashboard/src/components/games/russianRoulette.vue @@ -124,7 +124,7 @@ function resetSettings() { - + diff --git a/frontend/dashboard/src/components/games/seppuku.vue b/frontend/dashboard/src/components/games/seppuku.vue index 7d78b93b3..2b2cc4e83 100644 --- a/frontend/dashboard/src/components/games/seppuku.vue +++ b/frontend/dashboard/src/components/games/seppuku.vue @@ -98,7 +98,7 @@ async function save() { diff --git a/frontend/dashboard/src/components/games/voteban.vue b/frontend/dashboard/src/components/games/voteban.vue index 8703d0bc7..5841536a5 100644 --- a/frontend/dashboard/src/components/games/voteban.vue +++ b/frontend/dashboard/src/components/games/voteban.vue @@ -146,7 +146,7 @@ async function save() { - + @@ -154,7 +154,7 @@ async function save() { - + diff --git a/frontend/dashboard/src/components/variable-input.vue b/frontend/dashboard/src/components/variable-input.vue index 75f550333..103f55851 100644 --- a/frontend/dashboard/src/components/variable-input.vue +++ b/frontend/dashboard/src/components/variable-input.vue @@ -1,12 +1,23 @@ - diff --git a/frontend/dashboard/src/features/greetings/ui/greetings-dialog.vue b/frontend/dashboard/src/features/greetings/ui/greetings-dialog.vue index 2bf0e38f2..f7a7e35da 100644 --- a/frontend/dashboard/src/features/greetings/ui/greetings-dialog.vue +++ b/frontend/dashboard/src/features/greetings/ui/greetings-dialog.vue @@ -70,17 +70,20 @@ async function save() { userId: data.userId, } - if (data.id) { - await greetingsUpdate.executeMutation({ - id: data.id, - opts, - }) - } else { - await greetingsCreate.executeMutation({ opts }) + try { + if (data.id) { + await greetingsUpdate.executeMutation({ + id: data.id, + opts, + }) + } else { + await greetingsCreate.executeMutation({ opts }) + } + emits('close') + open.value = false + } catch (e) { + console.error(e) } - - emits('close') - open.value = false } const { t } = useI18n()