import { createSharedComposable } from '@vueuse/core'

const _useNotificationsSlideover = () => {
  const route = useRoute()
  const router = useRouter()
  const localePath = useLocalePath()
  const isOpen = ref(false)

  defineShortcuts({
    'g-h': () => router.push(localePath('/')),
    'g-s': () => router.push(localePath('/settings')),
    'n': () => isOpen.value = !isOpen.value
  })

  watch(() => route.fullPath, () => {
    isOpen.value = false
  })

  return {
    isOpen
  }
}

export const useNotificationsSlideover = createSharedComposable(_useNotificationsSlideover)
