import { Menu, Sparkles, LogOut, Volume2, VolumeOff } from 'lucide-react'; import type { ConnectionStatus, Session } from '../types'; import { useT } from '../hooks/useLocale'; import { LanguageSelector } from './LanguageSelector'; interface Props { status: ConnectionStatus; sessionKey: string; onToggleSidebar: () => void; activeSessionData?: Session; onLogout?: () => void; soundEnabled?: boolean; onToggleSound?: () => void; } export function Header({ status, sessionKey, onToggleSidebar, activeSessionData, onLogout, soundEnabled, onToggleSound }: Props) { const t = useT(); const sessionLabel = sessionKey.split(':').pop() || sessionKey; return ( <>
PinchChat
{t('header.title')}
{sessionLabel}
{onToggleSound && ( )} {status === 'connected' ? (
{t('header.connected')}
) : status === 'connecting' ? (
{t('login.connecting')}
) : (
{t('header.disconnected')}
)} {onLogout && ( )}
{(() => { const ctx = activeSessionData?.contextTokens; const total = activeSessionData?.totalTokens || 0; if (!ctx) return null; const pct = Math.min(100, (total / ctx) * 100); const opacity = Math.max(0.35, Math.min(1, pct / 100)); const barStyle = { width: `${pct}%`, backgroundColor: `rgba(56, 189, 248, ${opacity})` }; return (
{(total / 1000).toFixed(1)}k / {(ctx / 1000).toFixed(0)}k tokens
); })()} ); }