Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Replaced hardcoded "Agenda" labels with dynamic ULTICAL_APP_NAME in various components for consistency. - Introduced new AiUsageSection and CompteAiUsageSection components to track AI usage and costs. - Updated settings and metadata to reflect changes in AI cost policies and usage limits. - Enhanced user interface elements for better accessibility and user experience across admin settings.
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import type { LucideIcon } from "lucide-react"
|
|
import { Home, ShieldCheck, Sparkles, UserRound } from "lucide-react"
|
|
|
|
export type CompteSettingsSectionId = "home" | "personal-info" | "security" | "usage-ia"
|
|
|
|
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: "usage-ia",
|
|
label: "Usage IA",
|
|
description: "Consommation LLM et clés API personnelles",
|
|
href: "/compte/usage-ia",
|
|
icon: Sparkles,
|
|
},
|
|
{
|
|
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"
|
|
}
|