- state/authStore: session subscription (initialize + onAuthStateChange), profile + roles load, recovery flag, URL failure; services/localeSync: profiles.locale <-> localeStore - routes: /login, /signup, /forgot-password, /reset-password, /auth/callback; guards RequireAuth (next=) and RedirectIfSignedIn; /app (dashboard), /app/account behind the guard - shell: AppLayout (desktop sidebar, light top bar, mobile drawer), SidebarNav, UserBadge, SignOutButton - account: personal / professional / preferences / security sections, one save each, Zod validation with i18n keys - ui: Icon, FormField, Notice, ButtonLink (buttonClassName shared), PasswordField, OAuthButtons (config-driven) - Home header: Mon espace / Se connecter when Supabase is configured; local tool routes untouched - i18n: auth.*, shell.*, dashboard.*, account.*, home.space.* in fr + en
20 lines
576 B
TypeScript
20 lines
576 B
TypeScript
import Badge from '@/components/ui/Badge'
|
|
import { useAuthStore } from '@/state/authStore'
|
|
import { useT } from '@/i18n/useT'
|
|
|
|
/** Platform roles, read-only. Nothing when the account has none. */
|
|
export default function RoleBadges() {
|
|
const roles = useAuthStore((s) => s.roles)
|
|
const t = useT()
|
|
if (roles.length === 0) return null
|
|
return (
|
|
<ul className="flex flex-wrap gap-2" aria-label={t('dashboard.account.roles')}>
|
|
{roles.map((role) => (
|
|
<li key={role}>
|
|
<Badge>{t(`shell.role.${role}`)}</Badge>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)
|
|
}
|