refactor: extract navigator into store instead

This commit is contained in:
Methapon Metanipat 2024-10-30 11:55:43 +07:00
parent caa3e59777
commit 6b29d3b017
10 changed files with 68 additions and 76 deletions

View file

@ -14,9 +14,9 @@ import { CanvasComponent, DialogForm } from 'components/index';
import useOptionStore from 'stores/options';
import { dialog } from 'stores/utils';
import { setLocale } from 'src/utils/datetime';
import useUtilsStore from 'stores/utils';
import useMyBranchStore from 'stores/my-branch';
import { useConfigStore } from 'src/stores/config';
import { useNavigator } from 'src/stores/navigator';
const useMyBranch = useMyBranchStore();
const { fetchListMyBranch } = useMyBranch;
@ -37,7 +37,7 @@ interface Notification {
const $q = useQuasar();
const loaderStore = useLoader();
const utilsStore = useUtilsStore();
const navigatorStore = useNavigator();
const optionStore = useOptionStore();
const configStore = useConfigStore();
@ -88,12 +88,6 @@ const notification = ref<Notification[]>([
content: 'Unread',
read: false,
},
{
id: '2',
title: 'test',
content: 'test',
read: false,
},
{
id: '3',
title: 'Read',
@ -268,8 +262,8 @@ onMounted(async () => {
}"
>
{{
utilsStore.currentTitle?.title
? $t(utilsStore.currentTitle?.title)
navigatorStore.current?.title
? $t(navigatorStore.current?.title)
: $q.screen.gt.xs
? 'Welcome to Jobs Worker Service'
: 'Jobs Worker Service'
@ -277,15 +271,15 @@ onMounted(async () => {
</span>
<div class="flex items-center" style="gap: var(--size-1)">
<template
v-for="(item, i) in utilsStore.currentTitle.path"
v-for="(item, i) in navigatorStore.current.path"
:key="i"
>
<span
class="text-caption cursor-pointer"
@click="item.handler?.()"
:class="{
'text-info': i !== utilsStore.currentTitle.path.length - 1,
'hover-item': i !== utilsStore.currentTitle.path.length - 1,
'text-info': i !== navigatorStore.current.path.length - 1,
'hover-item': i !== navigatorStore.current.path.length - 1,
}"
>
{{
@ -300,10 +294,10 @@ onMounted(async () => {
</span>
<q-icon
:class="{
'text-info': i !== utilsStore.currentTitle.path.length - 1,
'text-info': i !== navigatorStore.current.path.length - 1,
}"
name="mdi-chevron-right"
v-if="i + 1 !== utilsStore.currentTitle.path.length"
v-if="i + 1 !== navigatorStore.current.path.length"
/>
</template>
</div>