import { Group, ActionIcon, Box, Image, Select, useComputedColorScheme, AppShell, } from '@mantine/core'; import { Minus, Square, X, Copy, CircleFadingArrowUp } from 'lucide-react'; import { useState } from 'react'; import { soundAssets, playSound, initializeAudio } from '@/utils/sounds'; import { useAppUpdateChecker } from '@/hooks/useAppUpdateChecker'; import { useLaunchConfigStore } from '@/stores/launchConfig'; import iconUrl from '/icon.png'; import { FRONTENDS, PRODUCT_NAME, TITLEBAR_HEIGHT } from '@/constants'; import type { FrontendPreference, InterfaceTab, Screen } from '@/types'; interface TitleBarProps { currentScreen: Screen; currentTab: InterfaceTab; onTabChange: (tab: InterfaceTab) => void; onEject: () => void; frontendPreference: FrontendPreference; } export const TitleBar = ({ currentScreen, currentTab, onTabChange, onEject, frontendPreference, }: TitleBarProps) => { const computedColorScheme = useComputedColorScheme('light', { getInitialValueInEffect: true, }); const { hasUpdate, releaseUrl } = useAppUpdateChecker(); const { isImageGenerationMode } = useLaunchConfigStore(); const [logoClickCount, setLogoClickCount] = useState(0); const [isElephantMode, setIsElephantMode] = useState(false); const [isMouseSqueaking, setIsMouseSqueaking] = useState(false); const [isMaximized, setIsMaximized] = useState(false); const [isSelectOpen, setIsSelectOpen] = useState(false); const handleMinimize = () => { window.electronAPI.app.minimizeWindow(); }; const handleMaximize = async () => { await window.electronAPI.app.maximizeWindow(); setIsMaximized(!isMaximized); }; const handleClose = () => { window.electronAPI.app.closeWindow(); }; const handleLogoClick = async () => { await initializeAudio(); setLogoClickCount((prev) => prev + 1); try { if (logoClickCount >= 10 && Math.random() < 0.1) { setIsElephantMode(true); await playSound(soundAssets.elephant, 0.6); setTimeout(() => { setIsElephantMode(false); }, 1500); } else { setIsMouseSqueaking(true); const squeakNumber = Math.floor(Math.random() * 5); await playSound(soundAssets.mouseSqueaks[squeakNumber], 0.4); setTimeout(() => { setIsMouseSqueaking(false); }, 300); } } catch { void 0; } }; return ( {PRODUCT_NAME} {currentScreen === 'interface' && (