"use client" import { useMemo } from "react" import { useTheme } from "next-themes" import { ExternalLink } from "lucide-react" import { Button } from "@/components/ui/button" import { CompteSettingsCard } from "@/components/compte/compte-settings-card" import { buildAuthentikUrl, resolveAuthentikTheme, type AuthentikUserSettingsTab, } from "@/lib/auth/authentik-user-url" import { useClientThemeStore } from "@/lib/stores/client-theme-store" type CompteAuthentikPanelProps = { title: string description: string tab?: AuthentikUserSettingsTab flowSlug?: string actionLabel: string icon?: React.ReactNode } export function CompteAuthentikPanel({ title, description, tab, flowSlug, actionLabel, icon, }: CompteAuthentikPanelProps) { const themeMode = useClientThemeStore((s) => s.themeMode) const { resolvedTheme } = useTheme() const authentikTheme = resolveAuthentikTheme(themeMode, resolvedTheme) const url = useMemo( () => buildAuthentikUrl({ tab, flowSlug, theme: authentikTheme }), [tab, flowSlug, authentikTheme] ) if (!url) { return (

Portail d'identité non configuré.

) } return (

Ouverture du portail d'identité Authentik dans un nouvel onglet.

) } function PanelHeader({ icon, title, description, }: { icon?: React.ReactNode title: string description: string }) { return (
{icon ? ( {icon} ) : null}

{title}

{description}

) }