feat(settings): add sidebar visibility state to settings store
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { sluggy } from '#imports';
|
import { sluggy, useSettingsStore } from '#imports';
|
||||||
import { useHuntStore } from '~/stores/hunt';
|
import { useHuntStore } from '~/stores/hunt';
|
||||||
import { useTitleStore } from '~/stores/title';
|
import { useTitleStore } from '~/stores/title';
|
||||||
|
|
||||||
@@ -11,7 +11,8 @@ const breakpoints = useBreakpoint();
|
|||||||
const titleStore = useTitleStore();
|
const titleStore = useTitleStore();
|
||||||
const huntStore = useHuntStore();
|
const huntStore = useHuntStore();
|
||||||
|
|
||||||
const isSidebarVisible = ref(breakpoints.mdUp);
|
const settingsStore = useSettingsStore();
|
||||||
|
const { isSidebarVisible } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
const slugs = computed(() => checkSlug(route.params));
|
const slugs = computed(() => checkSlug(route.params));
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ const isHuntAdmin = computed(
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #left>
|
<template #left>
|
||||||
<VaSidebar v-model="isSidebarVisible">
|
<VaSidebar v-model="isSidebarVisible" :hoverable="breakpoints.mdUp">
|
||||||
<VaSidebarItem
|
<VaSidebarItem
|
||||||
:to="localePath('/')"
|
:to="localePath('/')"
|
||||||
:active="localePath('/') === route.path"
|
:active="localePath('/') === route.path"
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ export const useSettingsStore = defineStore(
|
|||||||
'picSettings',
|
'picSettings',
|
||||||
() => {
|
() => {
|
||||||
const hideAnswers = ref(true);
|
const hideAnswers = ref(true);
|
||||||
|
const isSidebarVisible = ref(false);
|
||||||
|
|
||||||
return { hideAnswers };
|
return { hideAnswers, isSidebarVisible };
|
||||||
},
|
},
|
||||||
{ persist: true }
|
{ persist: true }
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user