Add role switcher (Client/Seller) in navigation menu
All checks were successful
Build Docker Image / build (push) Successful in 4m20s
All checks were successful
Build Docker Image / build (push) Successful in 4m20s
- Add role switcher buttons after Explore/Quote/Кабинет with separator - Dynamic center tabs based on role: BUYER shows orders/addresses, SELLER shows offers - Redirect to appropriate page when switching role in client area - Add localization for roles.client and roles.seller
This commit is contained in:
@@ -42,6 +42,30 @@
|
||||
>
|
||||
{{ $t('cabinetNav.cabinet') }}
|
||||
</NuxtLink>
|
||||
|
||||
<!-- Role switcher -->
|
||||
<div v-if="loggedIn && (hasBuyerTeam || hasSellerTeam)" class="flex items-center gap-1 ml-2 pl-2 border-l border-white/20">
|
||||
<button
|
||||
v-if="currentRole === 'BUYER' || hasBuyerTeam"
|
||||
class="px-3 py-1 text-sm font-medium rounded-lg transition-colors"
|
||||
:class="currentRole === 'BUYER'
|
||||
? (useWhiteText ? 'bg-white/20 text-white' : 'bg-base-300 text-base-content')
|
||||
: (useWhiteText ? 'text-white/70 hover:text-white hover:bg-white/10' : 'text-base-content/70 hover:text-base-content hover:bg-base-200')"
|
||||
@click="$emit('switch-role', 'BUYER')"
|
||||
>
|
||||
{{ $t('cabinetNav.roles.client') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="currentRole === 'SELLER' || hasSellerTeam"
|
||||
class="px-3 py-1 text-sm font-medium rounded-lg transition-colors"
|
||||
:class="currentRole === 'SELLER'
|
||||
? (useWhiteText ? 'bg-white/20 text-white' : 'bg-base-300 text-base-content')
|
||||
: (useWhiteText ? 'text-white/70 hover:text-white hover:bg-white/10' : 'text-base-content/70 hover:text-base-content hover:bg-base-200')"
|
||||
@click="$emit('switch-role', 'SELLER')"
|
||||
>
|
||||
{{ $t('cabinetNav.roles.seller') }}
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -53,28 +77,34 @@
|
||||
<!-- Client Area tabs -->
|
||||
<template v-if="isClientArea">
|
||||
<div class="flex items-center gap-1 rounded-full border border-white/20 bg-white/80 backdrop-blur-md shadow-lg p-1">
|
||||
<NuxtLink
|
||||
:to="localePath('/clientarea/orders')"
|
||||
class="px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap"
|
||||
:class="isClientAreaTabActive('/clientarea/orders') ? 'bg-primary text-primary-content' : 'text-base-content/70 hover:text-base-content hover:bg-base-200/50'"
|
||||
>
|
||||
{{ $t('cabinetNav.orders') }}
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
v-if="isSeller"
|
||||
:to="localePath('/clientarea/offers')"
|
||||
class="px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap"
|
||||
:class="isClientAreaTabActive('/clientarea/offers') ? 'bg-primary text-primary-content' : 'text-base-content/70 hover:text-base-content hover:bg-base-200/50'"
|
||||
>
|
||||
{{ $t('cabinetNav.myOffers') }}
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
:to="localePath('/clientarea/addresses')"
|
||||
class="px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap"
|
||||
:class="isClientAreaTabActive('/clientarea/addresses') ? 'bg-primary text-primary-content' : 'text-base-content/70 hover:text-base-content hover:bg-base-200/50'"
|
||||
>
|
||||
{{ $t('cabinetNav.addresses') }}
|
||||
</NuxtLink>
|
||||
<!-- BUYER tabs -->
|
||||
<template v-if="currentRole !== 'SELLER'">
|
||||
<NuxtLink
|
||||
:to="localePath('/clientarea/orders')"
|
||||
class="px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap"
|
||||
:class="isClientAreaTabActive('/clientarea/orders') ? 'bg-primary text-primary-content' : 'text-base-content/70 hover:text-base-content hover:bg-base-200/50'"
|
||||
>
|
||||
{{ $t('cabinetNav.orders') }}
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
:to="localePath('/clientarea/addresses')"
|
||||
class="px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap"
|
||||
:class="isClientAreaTabActive('/clientarea/addresses') ? 'bg-primary text-primary-content' : 'text-base-content/70 hover:text-base-content hover:bg-base-200/50'"
|
||||
>
|
||||
{{ $t('cabinetNav.addresses') }}
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<!-- SELLER tabs -->
|
||||
<template v-else>
|
||||
<NuxtLink
|
||||
:to="localePath('/clientarea/offers')"
|
||||
class="px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap"
|
||||
:class="isClientAreaTabActive('/clientarea/offers') ? 'bg-primary text-primary-content' : 'text-base-content/70 hover:text-base-content hover:bg-base-200/50'"
|
||||
>
|
||||
{{ $t('cabinetNav.myOffers') }}
|
||||
</NuxtLink>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -330,6 +360,10 @@ const props = withDefaults(defineProps<{
|
||||
teams?: Array<{ id?: string; name?: string; logtoOrgId?: string }>
|
||||
} | null
|
||||
isSeller?: boolean
|
||||
// Role switching props
|
||||
hasBuyerTeam?: boolean
|
||||
hasSellerTeam?: boolean
|
||||
currentRole?: string
|
||||
// Search props
|
||||
activeTokens?: Array<{ type: string; id: string; label: string; icon: string }>
|
||||
availableChips?: Array<{ type: string; label: string }>
|
||||
@@ -361,6 +395,7 @@ defineEmits([
|
||||
'sign-out',
|
||||
'sign-in',
|
||||
'switch-team',
|
||||
'switch-role',
|
||||
// Search events
|
||||
'start-select',
|
||||
'cancel-select',
|
||||
|
||||
Reference in New Issue
Block a user