35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
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-d': () => router.push('/files'),
|
|
'g-k': () => router.push('/standardEntity/customers'),
|
|
'g-l': () => router.push('/standardEntity/vendors'),
|
|
'g-s': () => router.push('/settings'),
|
|
'g-p': () => router.push('/standardEntity/projects'),
|
|
'g-v': () => router.push('/standardEntity/contracts'),
|
|
'g-o': () => router.push('/standardEntity/plants'),
|
|
'?': () => 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)
|