Skip to content

Commit

Permalink
feat(dashboard): greetings gql (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
crashmax-dev authored May 7, 2024
1 parent 96551fa commit 65cc0bf
Show file tree
Hide file tree
Showing 28 changed files with 658 additions and 489 deletions.
13 changes: 7 additions & 6 deletions frontend/dashboard/src/api/admin/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function useQueryNotifications() {
createdAt
}
}
`)
`),
})

const { data: newNotifications } = useSubscription({
Expand All @@ -31,7 +31,7 @@ export function useQueryNotifications() {
createdAt
}
}
`)
`),
})

watch(newNotifications, (newNotification) => {
Expand All @@ -50,11 +50,11 @@ export function useQueryNotifications() {
export function useAdminNotifications() {
const useQueryNotifications = (variables: Ref<AdminNotificationsParams>) => useQuery({
context: {
additionalTypenames: [invalidationKey]
additionalTypenames: [invalidationKey],
},
get variables() {
return {
opts: variables.value
opts: variables.value,
}
},
query: graphql(`
Expand All @@ -66,14 +66,15 @@ export function useAdminNotifications() {
text
userId
twitchProfile {
login
displayName
profileImageUrl
}
createdAt
}
}
}
`)
`),
})

const useMutationCreateNotification = () => useMutation(graphql(`
Expand Down Expand Up @@ -102,6 +103,6 @@ export function useAdminNotifications() {
useQueryNotifications,
useMutationCreateNotification,
useMutationDeleteNotification,
useMutationUpdateNotifications
useMutationUpdateNotifications,
}
}
4 changes: 2 additions & 2 deletions frontend/dashboard/src/api/greetings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useGreetingsApi = defineStore('api/greetings', () => {
}
}
}
`)
`),
})

const useMutationCreateGreetings = () => useMutation(graphql(`
Expand Down Expand Up @@ -58,6 +58,6 @@ export const useGreetingsApi = defineStore('api/greetings', () => {
useQueryGreetings,
useMutationCreateGreetings,
useMutationUpdateGreetings,
useMutationRemoveGreetings
useMutationRemoveGreetings,
}
})
6 changes: 6 additions & 0 deletions frontend/dashboard/src/components/dialog-or-sheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
</script>

<template>
<DialogContent
v-if="windowWidth > 800"
class="max-w-3xl overflow-hidden rounded-2xl outline-none"
@interact-outside="onInteractOutside"
>
<slot />
</DialogContent>
Expand Down
121 changes: 0 additions & 121 deletions frontend/dashboard/src/components/greetings/modal.vue

This file was deleted.

Loading

0 comments on commit 65cc0bf

Please sign in to comment.