import type { LucideIcon } from "lucide-react" import { Home, ShieldCheck, UserRound } from "lucide-react" export type CompteSettingsSectionId = "home" | "personal-info" | "security" export type CompteSettingsNavItem = { id: CompteSettingsSectionId label: string description: string href: string icon: LucideIcon } export const COMPTE_SETTINGS_NAV: CompteSettingsNavItem[] = [ { id: "home", label: "Accueil", description: "Vue d'ensemble de votre compte Ulti", href: "/compte", icon: Home, }, { id: "personal-info", label: "Informations personnelles", description: "Nom, adresse e-mail et identifiant", href: "/compte/informations", icon: UserRound, }, { id: "security", label: "Sécurité", description: "Mot de passe, sessions et appareils", href: "/compte/securite", icon: ShieldCheck, }, ] export function isCompteSettingsNavActive( pathname: string | null, item: CompteSettingsNavItem ): boolean { if (item.href === "/compte") { return pathname === "/compte" || pathname === "/compte/accueil" } return ( pathname === item.href || Boolean(pathname?.startsWith(`${item.href}/`)) ) } export function resolveCompteSettingsSection( segments: string[] | undefined ): CompteSettingsSectionId { const slug = segments?.[0] const match = COMPTE_SETTINGS_NAV.find((item) => { if (item.id === "home") return !slug || slug === "accueil" return item.href.endsWith(`/${slug}`) }) return match?.id ?? "home" }