58 lines
1.9 KiB
Vue
58 lines
1.9 KiB
Vue
<template>
|
|||
|
|
<aside class="desktop-sidebar">
|
||
|
|
<div class="desktop-sidebar__brand">
|
||
|
|
<img :src="navLogo" alt="کشکول گلد" class="desktop-sidebar__logo" />
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<nav class="desktop-sidebar__section" aria-label="منوی اصلی">
|
||
|
|
<DesktopNavItem
|
||
|
|
v-for="item in primaryItems"
|
||
|
|
:key="item.id"
|
||
|
|
:icon="item.icon"
|
||
|
|
:icon-src="item.iconSrc"
|
||
|
|
:label="item.label"
|
||
|
|
:active="isNavActive(item.routeName)"
|
||
|
|
:badge-count="item.routeName === 'cart' && cartCount ? cartCount : undefined"
|
||
|
|
@click="navigateTo(item.routeName)"
|
||
|
|
/>
|
||
|
|
</nav>
|
||
|
|
|
||
|
|
<div v-if="secondaryItems.length" class="desktop-sidebar__divider" />
|
||
|
|
|
||
|
|
<nav
|
||
|
|
v-if="secondaryItems.length"
|
||
|
|
class="desktop-sidebar__section desktop-sidebar__section--secondary"
|
||
|
|
aria-label="منوی فرعی"
|
||
|
|
>
|
||
|
|
<DesktopNavItem
|
||
|
|
v-for="item in secondaryItems"
|
||
|
|
:key="item.id"
|
||
|
|
:icon="item.icon"
|
||
|
|
:icon-src="item.iconSrc"
|
||
|
|
:label="item.label"
|
||
|
|
:active="isNavActive(item.routeName)"
|
||
|
|
@click="navigateTo(item.routeName)"
|
||
|
|
/>
|
||
|
|
</nav>
|
||
|
|
</aside>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script lang="ts" setup>
|
||
|
|
import { computed } from 'vue'
|
||
|
|
import logoFull from '@/assets/img/logo_full_.png'
|
||
|
|
import { isToken } from '@/utils'
|
||
|
|
import { useCartStore } from '@/store/cartStore'
|
||
|
|
import { getPrimaryNavItems, getSecondaryNavItems } from '../config/navigation'
|
||
|
|
import { useAppNavigation } from '../composables/useAppNavigation'
|
||
|
|
import DesktopNavItem from './DesktopNavItem.vue'
|
||
|
|
|
||
|
|
const cartStore = useCartStore()
|
||
|
|
const authenticated = computed(() => isToken())
|
||
|
|
const navLogo = logoFull
|
||
|
|
const primaryItems = computed(() => getPrimaryNavItems(authenticated.value))
|
||
|
|
const secondaryItems = computed(() => getSecondaryNavItems(authenticated.value))
|
||
|
|
const cartCount = computed(() => cartStore.itemCount || 0)
|
||
|
|
|
||
|
|
const { isNavActive, navigateTo } = useAppNavigation()
|
||
|
|
</script>
|