From 65cc0bf14d1a82599ddcf2b0e5e2c4bbb8b02024 Mon Sep 17 00:00:00 2001 From: Vitalij Ryndin Date: Tue, 7 May 2024 17:07:17 +0800 Subject: [PATCH] feat(dashboard): greetings gql (#727) --- .../dashboard/src/api/admin/notifications.ts | 13 +- frontend/dashboard/src/api/greetings.ts | 4 +- .../src/components/dialog-or-sheet.vue | 6 + .../src/components/greetings/modal.vue | 121 ------------ .../src/components/twitchUsers/single.vue | 148 +++++++-------- .../src/components/ui/alert/Alert.vue | 16 ++ .../components/ui/alert/AlertDescription.vue | 14 ++ .../src/components/ui/alert/AlertTitle.vue | 14 ++ .../src/components/ui/alert/index.ts | 23 +++ .../src/components/variable-input.vue | 51 ++--- .../components/notifications-form.vue | 4 +- .../composables/use-notifications-table.ts | 26 +-- .../components/users-table-cell-user.vue | 17 +- .../composables/use-users-table.ts | 5 +- ...-community-emotes-details-users-history.ts | 5 +- .../use-community-emotes-details-users-top.ts | 5 +- .../composables/use-community-users-table.ts | 41 ++--- .../composables/use-greetings-table.ts | 85 +++++++++ .../src/features/greetings/greetings.vue | 15 ++ .../greetings/ui/greetings-create-button.vue | 23 +++ .../greetings/ui/greetings-dialog.vue | 151 +++++++++++++++ .../greetings/ui/greetings-information.vue | 20 ++ .../greetings/ui/greetings-table-actions.vue | 49 +++++ frontend/dashboard/src/layout/page-layout.vue | 12 +- frontend/dashboard/src/locales/en.json | 1 + frontend/dashboard/src/pages/Greetings.vue | 174 ------------------ frontend/dashboard/src/pages/greetings.vue | 25 +++ frontend/dashboard/src/plugins/router.ts | 79 ++++---- 28 files changed, 658 insertions(+), 489 deletions(-) delete mode 100644 frontend/dashboard/src/components/greetings/modal.vue create mode 100644 frontend/dashboard/src/components/ui/alert/Alert.vue create mode 100644 frontend/dashboard/src/components/ui/alert/AlertDescription.vue create mode 100644 frontend/dashboard/src/components/ui/alert/AlertTitle.vue create mode 100644 frontend/dashboard/src/components/ui/alert/index.ts create mode 100644 frontend/dashboard/src/features/greetings/composables/use-greetings-table.ts create mode 100644 frontend/dashboard/src/features/greetings/greetings.vue create mode 100644 frontend/dashboard/src/features/greetings/ui/greetings-create-button.vue create mode 100644 frontend/dashboard/src/features/greetings/ui/greetings-dialog.vue create mode 100644 frontend/dashboard/src/features/greetings/ui/greetings-information.vue create mode 100644 frontend/dashboard/src/features/greetings/ui/greetings-table-actions.vue delete mode 100644 frontend/dashboard/src/pages/Greetings.vue create mode 100644 frontend/dashboard/src/pages/greetings.vue diff --git a/frontend/dashboard/src/api/admin/notifications.ts b/frontend/dashboard/src/api/admin/notifications.ts index 86ef00bc5..6b4875b06 100644 --- a/frontend/dashboard/src/api/admin/notifications.ts +++ b/frontend/dashboard/src/api/admin/notifications.ts @@ -19,7 +19,7 @@ export function useQueryNotifications() { createdAt } } - `) + `), }) const { data: newNotifications } = useSubscription({ @@ -31,7 +31,7 @@ export function useQueryNotifications() { createdAt } } - `) + `), }) watch(newNotifications, (newNotification) => { @@ -50,11 +50,11 @@ export function useQueryNotifications() { export function useAdminNotifications() { const useQueryNotifications = (variables: Ref) => useQuery({ context: { - additionalTypenames: [invalidationKey] + additionalTypenames: [invalidationKey], }, get variables() { return { - opts: variables.value + opts: variables.value, } }, query: graphql(` @@ -66,6 +66,7 @@ export function useAdminNotifications() { text userId twitchProfile { + login displayName profileImageUrl } @@ -73,7 +74,7 @@ export function useAdminNotifications() { } } } - `) + `), }) const useMutationCreateNotification = () => useMutation(graphql(` @@ -102,6 +103,6 @@ export function useAdminNotifications() { useQueryNotifications, useMutationCreateNotification, useMutationDeleteNotification, - useMutationUpdateNotifications + useMutationUpdateNotifications, } } diff --git a/frontend/dashboard/src/api/greetings.ts b/frontend/dashboard/src/api/greetings.ts index 3b92ae5bb..28b218520 100644 --- a/frontend/dashboard/src/api/greetings.ts +++ b/frontend/dashboard/src/api/greetings.ts @@ -29,7 +29,7 @@ export const useGreetingsApi = defineStore('api/greetings', () => { } } } - `) + `), }) const useMutationCreateGreetings = () => useMutation(graphql(` @@ -58,6 +58,6 @@ export const useGreetingsApi = defineStore('api/greetings', () => { useQueryGreetings, useMutationCreateGreetings, useMutationUpdateGreetings, - useMutationRemoveGreetings + useMutationRemoveGreetings, } }) diff --git a/frontend/dashboard/src/components/dialog-or-sheet.vue b/frontend/dashboard/src/components/dialog-or-sheet.vue index f3b6e9bb1..b388c2564 100644 --- a/frontend/dashboard/src/components/dialog-or-sheet.vue +++ b/frontend/dashboard/src/components/dialog-or-sheet.vue @@ -5,12 +5,18 @@ import { DialogContent } from '@/components/ui/dialog' import { SheetContent } from '@/components/ui/sheet' const { width: windowWidth } = useWindowSize() + +function onInteractOutside(event: any) { + if ((event.target as HTMLElement)?.closest('[role="dialog"]')) return + event.preventDefault() +}