"use client"; import React from "react"; import { usePathname } from "next/navigation"; import { LifeBuoy } from "lucide-react"; import { useAuth } from "@/components/auth/authContext"; import ChangePasswordCard from "@/components/profile/ChangePasswordCard"; import { buildSupportMailto } from "@/lib/frontend/support/supportMailto"; import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Card, CardHeader, CardTitle, CardDescription, CardContent, } from "@/components/ui/card"; function formatRole(role) { if (role === "branch") return "Niederlassung"; if (role === "admin") return "Admin"; if (role === "superadmin") return "Superadmin"; if (role === "dev") return "Entwicklung"; return role ? String(role) : "Unbekannt"; } export default function ProfilePage() { const pathname = usePathname() || "/profile"; const { status, user } = useAuth(); const [passwordChangedSuccess, setPasswordChangedSuccess] = React.useState(false); const isAuthenticated = status === "authenticated" && user; const roleLabel = isAuthenticated ? formatRole(user.role) : "—"; const branchLabel = isAuthenticated ? user.branchId || "—" : "—"; const emailLabel = isAuthenticated ? user.email || "—" : "—"; const userIdLabel = isAuthenticated ? user.userId || "—" : "—"; const mustChangePassword = isAuthenticated && user.mustChangePassword === true; const currentUrl = typeof window !== "undefined" ? window.location.href : ""; const userAgent = typeof navigator !== "undefined" ? navigator.userAgent : ""; const supportMailto = React.useMemo(() => { return buildSupportMailto({ user: isAuthenticated ? user : null, pathname, currentUrl, userAgent, }); }, [isAuthenticated, user, pathname, currentUrl, userAgent]); React.useEffect(() => { if (mustChangePassword) { setPasswordChangedSuccess(false); } }, [mustChangePassword]); return (

Profil

Konto- und Zugangseinstellungen.

{mustChangePassword ? ( Passwortänderung erforderlich Sie müssen Ihr Passwort ändern, bevor Sie fortfahren können. ) : null} {!mustChangePassword && passwordChangedSuccess ? ( Passwort erfolgreich geändert Ihr Passwort wurde erfolgreich aktualisiert. Sie können jetzt normal weiterarbeiten. ) : null} Konto Aktuelle Sitzungsinformationen.
Rolle {roleLabel}
Niederlassung {branchLabel}
E-Mail {emailLabel}
User ID {userIdLabel}

Die E-Mail wird zentral verwaltet. Für Änderungen wenden Sie sich an die IT.

setPasswordChangedSuccess(true)} /> Support Bei Fragen oder Problemen können Sie direkt den Support kontaktieren.
{!isAuthenticated ? (

Hinweis: Profilfunktionen sind nur verfügbar, wenn Sie angemeldet sind.

) : null}
); }