import icon from '/icon.png'; import { ActionIcon, AppShell, Box, Group, Image, Tooltip } from '@mantine/core'; import { Copy, Minus, Settings, Square, X } from 'lucide-react'; import { useEffect, useState } from 'react'; import { UpdateButton } from '@/components/App/UpdateButton'; import { Select } from '@/components/Select'; import { SettingsModal } from '@/components/settings/SettingsModal'; import { PRODUCT_NAME, TITLEBAR_HEIGHT } from '@/constants'; import { useLogoClickSounds } from '@/hooks/useLogoClickSounds'; import { useLaunchConfigStore } from '@/stores/launchConfig'; import { usePreferencesStore } from '@/stores/preferences'; import type { InterfaceTab, Screen, SelectOption } from '@/types'; import { getAvailableInterfaceOptions } from '@/utils/interface'; interface TitleBarProps { currentScreen: Screen; currentTab: InterfaceTab; onEject: () => void; onTabChange: (tab: InterfaceTab) => void; } const renderOption = ({ option }: { option: SelectOption }) => ( {option.label} ); export const TitleBar = ({ currentScreen, currentTab, onEject, onTabChange }: TitleBarProps) => { const { frontendPreference, imageGenerationFrontendPreference } = usePreferencesStore(); const { handleLogoClick, getLogoStyles } = useLogoClickSounds(); const [isMaximized, setIsMaximized] = useState(false); const [isSelectOpen, setIsSelectOpen] = useState(false); const [settingsModalOpen, setSettingsModalOpen] = useState(false); const { isTextMode, isImageGenerationMode } = useLaunchConfigStore(); const handleTabChange = (value: string | null) => { if (value === 'eject') { onEject(); } else if (value) { onTabChange(value as InterfaceTab); } }; useEffect(() => { const initializeState = async () => { const currentMaximizedState = await window.electronAPI.app.isMaximized(); setIsMaximized(currentMaximizedState); }; void initializeState(); const cleanup = window.electronAPI.app.onWindowStateToggle(() => setIsMaximized((prev) => !prev), ); return cleanup; }, []); return ( {PRODUCT_NAME} void handleLogoClick()} /> {currentScreen === 'interface' && (