Files
FEDEO/composables/useDashboard.ts
2024-04-07 22:25:16 +02:00

28 lines
860 B
TypeScript

import { createSharedComposable } from '@vueuse/core'
const _useDashboard = () => {
const route = useRoute()
const router = useRouter()
const isHelpSlideoverOpen = ref(false)
const isNotificationsSlideoverOpen = ref(false)
defineShortcuts({
'g-h': () => router.push('/'),
'g-a': () => router.push('/tasks'),
'g-s': () => router.push('/settings'),
'?': () => isHelpSlideoverOpen.value = !isHelpSlideoverOpen.value,
n: () => isNotificationsSlideoverOpen.value = !isNotificationsSlideoverOpen.value
})
watch(() => route.fullPath, () => {
isHelpSlideoverOpen.value = false
isNotificationsSlideoverOpen.value = false
})
return {
isHelpSlideoverOpen,
isNotificationsSlideoverOpen
}
}
export const useDashboard = createSharedComposable(_useDashboard)