fix(webapp): localize footer/menu and harden auth routes
This commit is contained in:
@@ -7,9 +7,9 @@ const props = withDefaults(defineProps<{
|
||||
const { toLocalized } = useLocalizedNavigation()
|
||||
|
||||
const footerLinks = [
|
||||
{ label: 'Главная', to: '/' },
|
||||
{ label: 'Заказы', to: '/clientarea/orders' },
|
||||
{ label: 'Кабинет', to: '/clientarea/profile' },
|
||||
{ label: 'Home', to: '/' },
|
||||
{ label: 'Orders', to: '/clientarea/orders' },
|
||||
{ label: 'Profile', to: '/clientarea/profile' },
|
||||
]
|
||||
|
||||
const socialLinks = [
|
||||
@@ -37,9 +37,9 @@ const currentYear = new Date().getFullYear()
|
||||
: 'border-white/20 bg-[rgba(11,24,42,0.26)] [backdrop-filter:blur(6px)]'"
|
||||
>
|
||||
<div>
|
||||
<h2 class="m-0 text-[clamp(1.6rem,3.4vw,2.6rem)] font-black leading-[1.08]">Готовы к следующей поставке?</h2>
|
||||
<h2 class="m-0 text-[clamp(1.6rem,3.4vw,2.6rem)] font-black leading-[1.08]">Ready for your next shipment?</h2>
|
||||
<p class="mt-3 max-w-[720px] leading-6 text-white/85">
|
||||
Получайте предложения в реальном времени, сравнивайте условия и запускайте закупку прямо в Optovia.
|
||||
Get live offers, compare terms, and launch procurement directly in Optovia.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -75,7 +75,7 @@ const currentYear = new Date().getFullYear()
|
||||
</div>
|
||||
|
||||
<div class="mt-4 px-1 text-[0.78rem] text-white/70">
|
||||
<p>© {{ currentYear }} Optovia. Все права защищены.</p>
|
||||
<p>© {{ currentYear }} Optovia. All rights reserved.</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -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, () => {
|
||||
|
||||
@@ -48,12 +48,20 @@ export const useAuth = () => {
|
||||
}
|
||||
|
||||
const signIn = async (_redirectUri?: string) => {
|
||||
if (import.meta.client) {
|
||||
window.location.assign('/sign-in')
|
||||
return
|
||||
}
|
||||
await navigateTo('/sign-in', { external: true })
|
||||
}
|
||||
|
||||
const login = signIn
|
||||
|
||||
const signOut = async (_logoutRedirectUri?: string) => {
|
||||
if (import.meta.client) {
|
||||
window.location.assign('/sign-out')
|
||||
return
|
||||
}
|
||||
await navigateTo('/sign-out', { external: true })
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
const basePath = stripLocalePrefix(to.path, ['ru', 'en'])
|
||||
|
||||
// Skip auth routes handled by @logto/nuxt
|
||||
if (to.path === '/sign-in' || to.path === '/sign-out' || to.path === '/callback') {
|
||||
if (basePath === '/sign-in' || basePath === '/sign-out' || basePath === '/callback') {
|
||||
return
|
||||
}
|
||||
|
||||
// Skip public auth paths
|
||||
if (to.path.startsWith('/auth/')) {
|
||||
if (basePath.startsWith('/auth/')) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ const testimonials = computed(() => isEn.value
|
||||
const leadTestimonial = computed(() => testimonials.value[0] ?? null)
|
||||
const sideTestimonials = computed(() => testimonials.value.slice(1))
|
||||
|
||||
const ctaTitle = computed(() => isEn.value ? 'Scale your sourcing flow with Optovia' : 'Масштабируйте закупочный поток вместе с Optovia')
|
||||
const ctaTitle = computed(() => isEn.value ? 'Scale your procurement flow with Optovia' : 'Масштабируйте поток закупок вместе с Optovia')
|
||||
const ctaText = computed(() => isEn.value
|
||||
? 'Move from fragmented tools to one coherent workflow.'
|
||||
: 'Перейдите от разрозненных инструментов к единому рабочему контуру.')
|
||||
|
||||
Reference in New Issue
Block a user