import React, { useState } from 'react'; import { ChevronDown, Droplets, Monitor, Moon, Plug, SlidersHorizontal, Sun, } from 'lucide-react'; import { useI18n } from '../application/i18n/I18nProvider'; import { cn } from '../lib/utils'; import { Button } from './ui/button'; import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'; import { Switch } from './ui/switch'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; const OPACITY_PRESETS = [ { label: '100%', value: 1 }, { label: '85%', value: 0.85 }, { label: '70%', value: 0.7 }, ] as const; export interface TopTabsQuickControlsProps { theme: 'dark' | 'light'; themePreference: 'dark' | 'light' | 'system'; onThemeChange: (theme: 'dark' | 'light' | 'system') => void; externalMcpEnabled: boolean; onToggleExternalMcp: (enabled: boolean) => void; showExternalMcpToggle?: boolean; windowOpacity: number; setWindowOpacity: (opacity: number) => void; className?: string; style?: React.CSSProperties; } export const TopTabsQuickControls: React.FC = ({ theme, themePreference, onThemeChange, externalMcpEnabled, onToggleExternalMcp, showExternalMcpToggle = true, windowOpacity, setWindowOpacity, className, style, }) => { const { t } = useI18n(); const [isOpen, setIsOpen] = useState(false); const [isOpacityExpanded, setIsOpacityExpanded] = useState(false); const opacityPercent = Math.round(windowOpacity * 100); const isPresetActive = (value: number) => Math.round(value * 100) === opacityPercent; const isDark = theme === 'dark'; const externalMcpLabelId = React.useId(); const themeOptions = [ { value: 'light' as const, label: t('topTabs.controlPanel.theme.light') }, { value: 'dark' as const, label: t('topTabs.controlPanel.theme.dark') }, { value: 'system' as const, label: t('topTabs.controlPanel.theme.system') }, ]; return ( { setIsOpen(open); if (!open) setIsOpacityExpanded(false); }} > {t('topTabs.controlPanel')}
{t('topTabs.controlPanel')}
{isOpacityExpanded ? (
setWindowOpacity(Number(event.target.value) / 100)} className="w-full accent-primary" aria-label={t('topTabs.windowOpacity')} />
{OPACITY_PRESETS.map((preset) => ( ))}
) : null}
{themePreference === 'system' ? : isDark ? : } {t('topTabs.controlPanel.theme')}
{themeOptions.map((option) => ( ))}
{showExternalMcpToggle ? (
{t('topTabs.controlPanel.externalMcp')}
) : null}
); }; export default TopTabsQuickControls;