import { useState } from "react"; import { Menu } from "@base-ui/react/menu"; import { ChevronDown, Maximize, Minimize, Moon, Sun } from "lucide-react"; import { Button, buttonVariants } from "../../components/ui/button"; import { useAuthUser } from "../../auth/authState"; import { availableLocales, useI18n } from "../../i18n"; import { useShell } from "./ShellProvider"; export function FullHeader({ onLogout }: { onLogout?: () => Promise }) { const shell = useShell(); const { t } = useI18n(); const user = useAuthUser(); const [fullscreenPending, setFullscreenPending] = useState(false); const [logoutPending, setLogoutPending] = useState(false); const [languagePointerFocus, setLanguagePointerFocus] = useState(false); const [error, setError] = useState(); if (shell?.mode !== "full") return null; const fullscreenLabel = shell.fullscreen ? t("Exit fullscreen") : t("Enter fullscreen"); async function toggleFullscreen() { setFullscreenPending(true); setError(undefined); try { if (document.fullscreenElement) await document.exitFullscreen(); else await document.documentElement.requestFullscreen(); } catch { setError("Fullscreen could not be changed. Try again or check your browser permissions."); } finally { setFullscreenPending(false); } } async function logout() { if (!onLogout || logoutPending) return; setLogoutPending(true); setError(undefined); try { await onLogout(); } catch { setError("Logout could not be completed. Please try again."); } finally { setLogoutPending(false); } } return (
ThothII
{user && (onLogout ? {user.displayName ?? user.subject} { void logout(); }}>{t("Log out")} : {user.displayName ?? user.subject})}
{error &&

{t(error)}

}
); }