Restructured Project Rep
This commit is contained in:
28
composables/useDashboard.ts
Normal file
28
composables/useDashboard.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user