Hide fund/earn/gift entries when access is off, add matching route guards, and surface physical delivery instead of price alert on mobile profile. Co-authored-by: Cursor <cursoragent@cursor.com>
85 lines
3.0 KiB
Vue
85 lines
3.0 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>
|
|
|
|
<div class="desktop-sidebar__credit">
|
|
<AppCreditLink variant="sidebar" />
|
|
</div>
|
|
</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 { useTrackingSystemsFeature } from '@/composables/useTrackingSystemsFeature'
|
|
import { useSettingsStore } from '@/store/settingsStore'
|
|
import { getPrimaryNavItems, getSecondaryNavItems } from '../config/navigation'
|
|
import { useAppNavigation } from '../composables/useAppNavigation'
|
|
import { featureSettingForRoute } from '@/utils/superAdminMenuGates'
|
|
import DesktopNavItem from './DesktopNavItem.vue'
|
|
import AppCreditLink from '@/components/AppCreditLink.vue'
|
|
|
|
const cartStore = useCartStore()
|
|
const authenticated = computed(() => isToken())
|
|
const navLogo = logoFull
|
|
const { trackingSystemsEnabled } = useTrackingSystemsFeature()
|
|
const settingsStore = useSettingsStore()
|
|
const primaryItems = computed(() =>
|
|
getPrimaryNavItems(authenticated.value).filter((item) => {
|
|
const featureKey = featureSettingForRoute(item.routeName)
|
|
if (featureKey) return settingsStore.isSettingTruthy(featureKey)
|
|
return true
|
|
}),
|
|
)
|
|
/** «لیست دریافتیها» فقط در موبایل نمایش داده میشود */
|
|
const DESKTOP_HIDDEN_NAV_IDS = ['list']
|
|
const secondaryItems = computed(() =>
|
|
getSecondaryNavItems(authenticated.value, {
|
|
includeRecoverySites: trackingSystemsEnabled.value,
|
|
}).filter((item) => {
|
|
if (DESKTOP_HIDDEN_NAV_IDS.includes(item.id)) return false
|
|
const featureKey = featureSettingForRoute(item.routeName)
|
|
if (featureKey) return settingsStore.isSettingTruthy(featureKey)
|
|
return true
|
|
}),
|
|
)
|
|
const cartCount = computed(() => cartStore.itemCount || 0)
|
|
|
|
const { isNavActive, navigateTo } = useAppNavigation()
|
|
</script>
|