Rebuild General Layout to Nuxt UI PRO Dashboard
This commit is contained in:
29
spaces/composables/useDashboard.ts
Normal file
29
spaces/composables/useDashboard.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
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-i': () => router.push('/inbox'),
|
||||
'g-u': () => router.push('/users'),
|
||||
'g-s': () => router.push('/settings'),
|
||||
'?': () => isHelpSlideoverOpen.value = true,
|
||||
n: () => isNotificationsSlideoverOpen.value = true
|
||||
})
|
||||
|
||||
watch(() => route.fullPath, () => {
|
||||
isHelpSlideoverOpen.value = false
|
||||
isNotificationsSlideoverOpen.value = false
|
||||
})
|
||||
|
||||
return {
|
||||
isHelpSlideoverOpen,
|
||||
isNotificationsSlideoverOpen
|
||||
}
|
||||
}
|
||||
|
||||
export const useDashboard = createSharedComposable(_useDashboard)
|
||||
Reference in New Issue
Block a user