fix(webapp): localize footer/menu and harden auth routes
This commit is contained in:
@@ -18,16 +18,22 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const route = useRoute()
|
||||
const { t } = useI18n()
|
||||
const auth = useAuth()
|
||||
const { basePath, isBasePathActive, navigateToLocalized, toLocalized } = useLocalizedNavigation()
|
||||
const { draft: calcDraft, hydrateFromQuery, buildQuery: buildCalcQuery } = useCalcSearchDraft()
|
||||
const isLandingPage = computed(() => basePath.value === '/')
|
||||
const isAuthPage = computed(() => basePath.value === '/auth' || route.path === '/sign-in' || basePath.value === '/callback')
|
||||
const isAuthPage = computed(() =>
|
||||
basePath.value === '/auth'
|
||||
|| basePath.value === '/sign-in'
|
||||
|| basePath.value === '/sign-out'
|
||||
|| basePath.value === '/callback'
|
||||
)
|
||||
const isCalcPage = computed(() => basePath.value.startsWith('/catalog'))
|
||||
const isManagerStagePage = computed(() => basePath.value.startsWith('/manager'))
|
||||
const isDarkHeaderScene = computed(() => isLandingPage.value || isManagerStagePage.value)
|
||||
const isAuthenticated = computed(() => props.isAuthenticated || auth.isAuthenticated.value)
|
||||
const profileLabel = computed(() => props.profileLabel || (auth.user.value?.id ?? 'Профиль'))
|
||||
const profileLabel = computed(() => props.profileLabel || (auth.user.value?.id ?? t('ui.profile')))
|
||||
const showLogistics = computed(() => props.showLogistics || Boolean((auth.user.value as any)?.isAdmin))
|
||||
const landingSearchScrollY = ref(0)
|
||||
const landingSearchTopStart = ref(450)
|
||||
@@ -71,9 +77,16 @@ const showAdminDock = computed(() => Boolean(showLogistics.value) && !isAuthPage
|
||||
// Fullscreen menu
|
||||
const isMenuOpen = ref(false)
|
||||
const menuLinks = computed(() => {
|
||||
return [
|
||||
{ label: 'Мои заказы', to: '/clientarea/orders', icon: 'orders' },
|
||||
const links: Array<{ label: string; to: string; icon: string }> = [
|
||||
{ label: 'Optovia', to: '/', icon: 'map' },
|
||||
{ label: t('ui.calculate'), to: '/catalog', icon: 'map' },
|
||||
]
|
||||
|
||||
if (isAuthenticated.value) {
|
||||
links.push({ label: t('ui.profile'), to: '/clientarea/profile', icon: 'referral' })
|
||||
}
|
||||
|
||||
return links
|
||||
})
|
||||
|
||||
watch(() => route.fullPath, () => {
|
||||
|
||||
Reference in New Issue
Block a user