import { Box, Button, Typography } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; import MinimizeIcon from '@mui/icons-material/Minimize'; import { useLocation, useNavigate } from 'react-router-dom'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; declare global { interface Window { electron: { ipcRenderer: { invoke(channel: string, ...args: unknown[]): Promise; on(channel: string, func: (...args: unknown[]) => void): void; removeAllListeners(channel: string): void; }; }; } } // Определяем пропсы interface TopBarProps { onRegister?: () => void; // Опционально, если нужен обработчик регистрации } export default function TopBar({ onRegister }: TopBarProps) { // Получаем текущий путь const location = useLocation(); const isLoginPage = location.pathname === '/login'; const isLaunchPage = location.pathname.startsWith('/launch'); const isVersionsExplorerPage = location.pathname.startsWith('/'); const navigate = useNavigate(); const handleLaunchPage = () => { navigate('/'); }; const getPageTitle = () => { if (isLoginPage) { return 'Вход'; } if (isLaunchPage) { return 'Запуск'; } if (isVersionsExplorerPage) { return 'Версии'; } return 'Неизвестная страница'; }; return ( {/* Левая часть */} {isLaunchPage && ( )} {/* Центр */} {getPageTitle()} {/* Правая часть со всеми кнопками */} {/* Кнопка регистрации, если на странице логина */} {isLoginPage && ( )} {/* Кнопки управления окном */} ); }