Glass nav fix + team/profile pages with CatalogPage layout
All checks were successful
Build Docker Image / build (push) Successful in 4m20s

- Fix glass nav on clientarea pages (add isClientArea to is-collapsed)
- Rewrite team page using CatalogPage with glass panel
- Rewrite profile page using CatalogPage with glass panel
This commit is contained in:
Ruslan Bakiev
2026-01-29 16:18:33 +07:00
parent 6ee8c12e6f
commit 886415344d
3 changed files with 228 additions and 181 deletions

View File

@@ -30,7 +30,7 @@
:can-search="canSearch" :can-search="canSearch"
:show-mode-toggle="true" :show-mode-toggle="true"
:show-active-mode="isCatalogSection" :show-active-mode="isCatalogSection"
:is-collapsed="isHomePage ? heroIsCollapsed : isCatalogSection" :is-collapsed="isHomePage ? heroIsCollapsed : (isCatalogSection || isClientArea)"
:is-home-page="isHomePage" :is-home-page="isHomePage"
:is-client-area="isClientArea" :is-client-area="isClientArea"
@toggle-theme="toggleTheme" @toggle-theme="toggleTheme"

View File

@@ -1,76 +1,105 @@
<template> <template>
<Section variant="plain" paddingY="md"> <CatalogPage
<Stack gap="6"> :items="[]"
<PageHeader :loading="isLoading"
:title="$t('dashboard.profile')" :use-server-clustering="false"
:actions="[{ label: t('clientProfile.actions.debugTokens'), icon: 'lucide:bug', to: localePath('/clientarea/profile/debug-tokens') }]" map-id="profile-map"
/> point-color="#10b981"
:show-panel="true"
panel-width="w-96"
:hide-view-toggle="true"
>
<template #panel>
<!-- Error state -->
<div v-if="hasError" class="p-4">
<div class="bg-error/20 border border-error/30 rounded-lg p-4">
<div class="font-semibold text-white mb-2">{{ $t('common.error') }}</div>
<div class="text-sm text-white/70">{{ error }}</div>
</div>
</div>
<Alert v-if="hasError" variant="error"> <template v-else>
<Stack gap="1"> <!-- Panel header -->
<Heading :level="4" weight="semibold">{{ $t('common.error') }}</Heading> <div class="p-4 border-b border-white/10 flex-shrink-0">
<Text tone="muted">{{ error }}</Text> <div class="flex items-center gap-3">
</Stack> <UserAvatar
</Alert> :userId="userData?.id ?? undefined"
:firstName="userData?.firstName ?? undefined"
:lastName="userData?.lastName ?? undefined"
:avatarId="userData?.avatarId ?? undefined"
size="md"
@avatar-changed="handleAvatarChange"
/>
<div class="flex-1 min-w-0">
<div class="font-semibold text-white truncate">
{{ userData?.firstName || '' }} {{ userData?.lastName || '' }}
</div>
<div class="text-xs text-white/50">{{ $t('dashboard.profile') }}</div>
</div>
</div>
</div>
<Stack v-if="isLoading" align="center" justify="center" gap="3"> <!-- Profile form -->
<Spinner /> <div class="flex-1 overflow-y-auto p-4">
<Text tone="muted">{{ t('clientProfile.states.loading') }}</Text> <form class="space-y-4" @submit.prevent="updateProfile">
</Stack> <!-- First name -->
<div>
<label class="block text-xs text-white/50 mb-1">{{ $t('profile.first_name') }}</label>
<input
v-model="profileForm.firstName"
type="text"
:placeholder="$t('profile.first_name_placeholder')"
class="input input-sm w-full bg-white/10 border-white/20 text-white placeholder:text-white/30"
/>
</div>
<template v-else> <!-- Last name -->
<Card padding="lg"> <div>
<Grid :cols="1" :lg="3" :gap="8"> <label class="block text-xs text-white/50 mb-1">{{ $t('profile.last_name') }}</label>
<GridItem :lg="2"> <input
<Stack gap="4"> v-model="profileForm.lastName"
<form @submit.prevent="updateProfile"> type="text"
<Stack gap="4"> :placeholder="$t('profile.last_name_placeholder')"
<Input class="input input-sm w-full bg-white/10 border-white/20 text-white placeholder:text-white/30"
v-model="profileForm.firstName" />
type="text" </div>
:label="$t('profile.first_name')"
:placeholder="$t('profile.first_name_placeholder')"
/>
<Input
v-model="profileForm.lastName"
type="text"
:label="$t('profile.last_name')"
:placeholder="$t('profile.last_name_placeholder')"
/>
<Input
v-model="profileForm.phone"
type="tel"
:label="$t('profile.phone')"
:placeholder="$t('profile.phone_placeholder')"
/>
<Button type="submit" :full-width="true" :disabled="isUpdating">
<template v-if="isUpdating">{{ $t('profile.saving') }}...</template>
<template v-else>{{ $t('profile.save') }}</template>
</Button>
</Stack>
</form>
</Stack>
</GridItem>
<GridItem> <!-- Phone -->
<Stack gap="6" align="center"> <div>
<Stack gap="3" align="center"> <label class="block text-xs text-white/50 mb-1">{{ $t('profile.phone') }}</label>
<Heading :level="3">{{ $t('profile.avatar') }}</Heading> <input
<UserAvatar v-model="profileForm.phone"
:userId="userData?.id ?? undefined" type="tel"
:firstName="userData?.firstName ?? undefined" :placeholder="$t('profile.phone_placeholder')"
:lastName="userData?.lastName ?? undefined" class="input input-sm w-full bg-white/10 border-white/20 text-white placeholder:text-white/30"
:avatarId="userData?.avatarId ?? undefined" />
@avatar-changed="handleAvatarChange" </div>
/>
</Stack> <!-- Save button -->
</Stack> <button
</GridItem> type="submit"
</Grid> class="btn btn-sm w-full bg-primary border-primary text-primary-content hover:bg-primary/80"
</Card> :disabled="isUpdating"
</template> >
</Stack> <template v-if="isUpdating">{{ $t('profile.saving') }}...</template>
</Section> <template v-else>{{ $t('profile.save') }}</template>
</button>
</form>
<!-- Debug tokens link -->
<div class="mt-6 pt-4 border-t border-white/10">
<NuxtLink
:to="localePath('/clientarea/profile/debug-tokens')"
class="flex items-center gap-2 text-sm text-white/50 hover:text-white transition-colors"
>
<Icon name="lucide:bug" size="14" />
{{ t('clientProfile.actions.debugTokens') }}
</NuxtLink>
</div>
</div>
</template>
</template>
</CatalogPage>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -159,7 +188,6 @@ const updateProfile = async () => {
const handleAvatarChange = async (newAvatarId?: string) => { const handleAvatarChange = async (newAvatarId?: string) => {
if (!newAvatarId) return if (!newAvatarId) return
// Only stage avatar change; will be saved on form submit
avatarDraftId.value = newAvatarId avatarDraftId.value = newAvatarId
} }

View File

@@ -1,113 +1,136 @@
<template> <template>
<Section variant="plain"> <CatalogPage
<Stack gap="6"> :items="mapPoints"
<PageHeader :title="t('clientTeam.header.title')" :actions="teamHeaderActions" /> :loading="isLoading"
:use-server-clustering="false"
map-id="team-map"
point-color="#8b5cf6"
:show-panel="true"
panel-width="w-96"
:hide-view-toggle="true"
>
<template #panel>
<!-- Error state -->
<div v-if="hasError" class="p-4">
<div class="bg-error/20 border border-error/30 rounded-lg p-4">
<div class="font-semibold text-white mb-2">{{ t('clientTeam.error.title') }}</div>
<div class="text-sm text-white/70 mb-3">{{ error }}</div>
<button class="btn btn-sm bg-white/10 border-white/20 text-white" @click="loadUserTeams">
{{ t('clientTeam.error.retry') }}
</button>
</div>
</div>
<Alert v-if="hasError" variant="error"> <!-- No team - prompt to create -->
<Stack gap="2"> <div v-else-if="!currentTeam && !isLoading" class="flex flex-col items-center justify-center h-full p-6 text-center">
<Heading :level="4" weight="semibold">{{ t('clientTeam.error.title') }}</Heading> <div class="text-4xl mb-3">👥</div>
<Text tone="muted">{{ error }}</Text> <div class="font-semibold text-white mb-2">{{ t('clientTeam.empty.title') }}</div>
<Button @click="loadUserTeams">{{ t('clientTeam.error.retry') }}</Button> <div class="text-sm text-white/60 mb-4">{{ t('clientTeam.empty.description') }}</div>
</Stack> <NuxtLink :to="localePath('/clientarea/kyc')">
</Alert> <button class="btn btn-sm bg-white/10 border-white/20 text-white hover:bg-white/20">
<Icon name="lucide:plus" size="14" class="mr-1" />
<Card v-else-if="isLoading" tone="muted" padding="lg"> {{ t('clientTeam.empty.cta') }}
<Stack align="center" justify="center" gap="3"> </button>
<Spinner /> </NuxtLink>
<Text tone="muted">{{ t('clientTeam.loading.message') }}</Text> </div>
</Stack>
</Card>
<!-- No team - prompt to create KYC application -->
<EmptyState
v-else-if="!currentTeam"
icon="👥"
:title="t('clientTeam.empty.title')"
:description="t('clientTeam.empty.description')"
:action-label="t('clientTeam.empty.cta')"
:action-to="localePath('/clientarea/kyc')"
action-icon="lucide:plus"
/>
<template v-else> <template v-else>
<Card padding="lg"> <!-- Panel header -->
<Stack gap="4"> <div class="p-4 border-b border-white/10 flex-shrink-0">
<Stack direction="row" gap="4" align="start" justify="between"> <div class="flex items-center gap-3 mb-3">
<Stack direction="row" gap="3" align="center"> <div class="w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center text-primary font-semibold">
<IconCircle tone="neutral" size="lg"> {{ currentTeam?.name?.charAt(0)?.toUpperCase() || '?' }}
{{ currentTeam.name?.charAt(0)?.toUpperCase() || '?' }} </div>
</IconCircle> <div class="flex-1 min-w-0">
<Heading :level="2" weight="semibold">{{ currentTeam.name }}</Heading> <div class="font-semibold text-white truncate">{{ currentTeam?.name }}</div>
</Stack> <div class="text-xs text-white/50">{{ t('clientTeam.members.title') }}</div>
</Stack> </div>
</div>
</Stack> <!-- Actions -->
</Card> <div class="flex gap-2">
<NuxtLink :to="localePath('/clientarea/kyc')" class="flex-1">
<button class="btn btn-sm w-full bg-white/10 border-white/20 text-white hover:bg-white/20">
<Icon name="lucide:plus" size="14" class="mr-1" />
{{ t('clientTeam.actions.addCompany') }}
</button>
</NuxtLink>
<NuxtLink v-if="userTeams.length > 1" :to="localePath('/clientarea/company-switch')">
<button class="btn btn-sm bg-white/10 border-white/20 text-white hover:bg-white/20">
<Icon name="lucide:arrow-left-right" size="14" />
</button>
</NuxtLink>
</div>
</div>
<Stack gap="3"> <!-- Members list -->
<Heading :level="2">{{ t('clientTeam.members.title') }}</Heading> <div class="flex-1 overflow-y-auto p-3 space-y-2">
<Grid :cols="1" :md="2" :lg="3" :gap="4"> <!-- Team members -->
<Card <div
v-for="(member, index) in currentTeamMembers" v-for="(member, index) in currentTeamMembers"
:key="member.user?.id ?? `member-${index}`" :key="member.user?.id ?? `member-${index}`"
padding="lg" class="bg-white/10 rounded-lg p-3"
> >
<Stack gap="3"> <div class="flex items-center gap-3">
<Stack direction="row" gap="3" align="center"> <div class="avatar placeholder">
<IconCircle tone="neutral">{{ getMemberInitials(member.user) }}</IconCircle> <div class="w-9 h-9 rounded-full bg-primary text-primary-content text-sm">
<Stack gap="1"> <span>{{ getMemberInitials(member.user) }}</span>
<Text weight="semibold">{{ member.user?.firstName }} {{ member.user?.lastName || '—' }}</Text>
</Stack>
</Stack>
<Stack direction="row" gap="2" wrap>
<Pill variant="primary">{{ roleText(member.role) }}</Pill>
</Stack>
</Stack>
</Card>
<!-- Pending invitations -->
<Card
v-for="invitation in currentTeamInvitations"
:key="invitation.uuid"
padding="lg"
class="border-dashed border-warning"
>
<Stack gap="3">
<Stack direction="row" gap="3" align="center">
<IconCircle tone="warning">
<Icon name="lucide:mail" size="16" />
</IconCircle>
<Stack gap="1">
<Text weight="semibold">{{ invitation.email }}</Text>
<Text tone="muted" size="sm">{{ t('clientTeam.invitations.pending') }}</Text>
</Stack>
</Stack>
<Stack direction="row" gap="2" wrap>
<Pill variant="outline" tone="warning">{{ roleText(invitation.role) }}</Pill>
<Pill variant="ghost" tone="muted">{{ t('clientTeam.invitations.sent') }}</Pill>
</Stack>
</Stack>
</Card>
<Card
padding="lg"
class="border-2 border-dashed border-base-300 hover:border-primary cursor-pointer transition-colors"
@click="inviteMember"
>
<Stack gap="3" align="center" justify="center" class="h-full min-h-[100px]">
<div class="w-10 h-10 rounded-full bg-base-200 flex items-center justify-center text-base-content/50">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
</div> </div>
<Text weight="semibold" tone="muted">{{ t('clientTeam.inviteCard.title') }}</Text> </div>
</Stack> <div class="flex-1 min-w-0">
</Card> <div class="font-medium text-sm text-white truncate">
</Grid> {{ member.user?.firstName }} {{ member.user?.lastName || '' }}
</Stack> </div>
<div class="text-xs text-white/50">{{ roleText(member.role) }}</div>
</div>
<span class="badge badge-primary badge-sm">{{ roleText(member.role) }}</span>
</div>
</div>
<!-- Pending invitations -->
<div
v-for="invitation in currentTeamInvitations"
:key="invitation.uuid"
class="bg-warning/10 border border-warning/30 rounded-lg p-3"
>
<div class="flex items-center gap-3">
<div class="avatar placeholder">
<div class="w-9 h-9 rounded-full bg-warning/20 text-warning flex items-center justify-center">
<Icon name="lucide:mail" size="16" />
</div>
</div>
<div class="flex-1 min-w-0">
<div class="font-medium text-sm text-white truncate">{{ invitation.email }}</div>
<div class="text-xs text-warning">{{ t('clientTeam.invitations.pending') }}</div>
</div>
<span class="badge badge-warning badge-outline badge-sm">{{ roleText(invitation.role) }}</span>
</div>
</div>
<!-- Add member button -->
<button
class="w-full bg-white/5 border-2 border-dashed border-white/20 rounded-lg p-4 hover:bg-white/10 hover:border-white/30 transition-colors"
@click="inviteMember"
>
<div class="flex flex-col items-center gap-2 text-white/50">
<Icon name="lucide:user-plus" size="20" />
<span class="text-sm font-medium">{{ t('clientTeam.inviteCard.title') }}</span>
</div>
</button>
</div>
<!-- Footer -->
<div class="p-3 border-t border-white/10 flex-shrink-0">
<span class="text-xs text-white/50">
{{ currentTeamMembers.length }} {{ t('clientTeam.members.title').toLowerCase() }}
<template v-if="currentTeamInvitations.length > 0">
+ {{ currentTeamInvitations.length }} {{ t('clientTeam.invitations.pending').toLowerCase() }}
</template>
</span>
</div>
</template> </template>
</Stack> </template>
</Section> </CatalogPage>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -143,14 +166,6 @@ const isLoading = ref(true)
const hasError = ref(false) const hasError = ref(false)
const error = ref('') const error = ref('')
const teamHeaderActions = computed(() => {
const actions: Array<{ label: string; icon?: string; to?: string }> = []
actions.push({ label: t('clientTeam.actions.addCompany'), icon: 'lucide:plus', to: localePath('/clientarea/kyc') })
if (userTeams.value.length > 1) {
actions.push({ label: t('clientTeam.actions.switch'), icon: 'lucide:arrow-left-right', to: localePath('/clientarea/company-switch') })
}
return actions
})
const roleText = (role?: string | null) => { const roleText = (role?: string | null) => {
const map: Record<string, string> = { const map: Record<string, string> = {
OWNER: t('clientTeam.roles.owner'), OWNER: t('clientTeam.roles.owner'),
@@ -185,6 +200,11 @@ const currentTeamInvitations = computed(() => {
return team && 'invitations' in team ? (team.invitations || []).filter((i): i is NonNullable<typeof i> => i !== null) : [] return team && 'invitations' in team ? (team.invitations || []).filter((i): i is NonNullable<typeof i> => i !== null) : []
}) })
// Map points - empty for now, could show team addresses
const mapPoints = computed(() => {
return []
})
const loadUserTeams = async () => { const loadUserTeams = async () => {
try { try {
isLoading.value = true isLoading.value = true
@@ -207,7 +227,6 @@ const loadUserTeams = async () => {
currentTeam.value = firstTeam currentTeam.value = firstTeam
} }
} }
// Если нет команды - currentTeam остаётся null, показываем EmptyState
} catch (err: unknown) { } catch (err: unknown) {
hasError.value = true hasError.value = true
error.value = err instanceof Error ? err.message : t('clientTeam.error.load') error.value = err instanceof Error ? err.message : t('clientTeam.error.load')