Files
ghatreh_user/src/layouts/desktop/DesktopSidebar.vue
T

77 lines
2.7 KiB
Vue
Raw Normal View History

2026-06-29 22:43:28 +03:30
<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'
2026-07-18 15:46:38 +03:30
import { useTrackingSystemsFeature } from '@/composables/useTrackingSystemsFeature'
2026-07-25 12:13:30 +03:30
import { useSettingsStore } from '@/store/settingsStore'
2026-06-29 22:43:28 +03:30
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
2026-07-18 15:46:38 +03:30
const { trackingSystemsEnabled } = useTrackingSystemsFeature()
2026-07-25 12:13:30 +03:30
const settingsStore = useSettingsStore()
2026-06-29 22:43:28 +03:30
const primaryItems = computed(() => getPrimaryNavItems(authenticated.value))
2026-07-18 15:46:38 +03:30
/** «لیست دریافتی‌ها» فقط در موبایل نمایش داده می‌شود */
const DESKTOP_HIDDEN_NAV_IDS = ['list']
const secondaryItems = computed(() =>
getSecondaryNavItems(authenticated.value, {
includeRecoverySites: trackingSystemsEnabled.value,
2026-07-25 12:13:30 +03:30
}).filter((item) => {
if (DESKTOP_HIDDEN_NAV_IDS.includes(item.id)) return false
if (item.id === 'notifyTrigger') {
return settingsStore.isSettingTruthy('has_page_price_trigger')
}
if (item.id === 'giftCard') {
return settingsStore.isSettingTruthy('has_page_gift_card')
}
2026-07-25 12:13:30 +03:30
return true
}),
2026-07-18 15:46:38 +03:30
)
2026-06-29 22:43:28 +03:30
const cartCount = computed(() => cartStore.itemCount || 0)
const { isNavActive, navigateTo } = useAppNavigation()
</script>