import { useI18n } from "../../../shared/i18n/context"; import { translations, type TranslationKey } from "../../../shared/i18n/translations"; import { useTheme } from "../../../shared/theme/context"; const SVG_MOON = ( ); const SVG_SUN = ( ); /** * Stable-width text: two invisible references (en + zh) set min-width via grid overlap. * The visible text overlays them, so the button never changes width on language switch. */ function StableText({ tKey, children, class: cls }: { tKey: TranslationKey; children: string; class?: string }) { return ( {children} ); } interface HeaderProps { onAddAccount: () => void; onCheckUpdate: () => void; onOpenUpdateModal?: () => void; checking: boolean; updateStatusMsg: string | null; updateStatusColor: string; version: string | null; commit?: string | null; isProxySettings?: boolean; hasUpdate?: boolean; onLogout?: () => void; } export function Header({ onAddAccount, onCheckUpdate, onOpenUpdateModal, checking, updateStatusMsg, updateStatusColor, version, commit, isProxySettings, hasUpdate, onLogout }: HeaderProps) { const { lang, toggleLang, t } = useI18n(); const { isDark, toggle: toggleTheme } = useTheme(); return (
{/* Logo & Title */}
{isProxySettings ? ( {t("backToDashboard")} ) : ( <>

Codex Proxy

)}
{/* Actions */}
{/* Star on GitHub */} {/* Check for Updates */} {/* Update status message */} {updateStatusMsg && !checking && ( )} {/* Logout (remote sessions only) */} {onLogout && ( )} {/* Language Toggle */} {/* Theme Toggle */} {/* Proxy Settings / Add Account */} {isProxySettings ? null : ( <> )}
); }