import React, { useState } from 'react'; import DesktopIcon from './components/DesktopIcon'; import Window from './components/Window'; import Sidebar from './components/Sidebar'; import './App.css'; // import VScodeApp from './apps/vscode/vscode'; import YandexApp from './apps/yandex/Yandex'; import TerminalApp from './apps/terminal/Terminal'; import AmneziaVPN from './apps/amneziavpn/AmneziaVPN'; export interface WindowType { id: string; title: string; content: any; icon: string; isMinimized: boolean; url: string; } interface IMainApp { showGosuslugi: boolean; showAmnezia: boolean; } const MainApp: React.FC = ({showGosuslugi, showAmnezia}) => { const [windows, setWindows] = useState([]); const [nextId, setNextId] = useState(1); const openWindow = (title: string, content: any, icon: string, url: string) => { const newWindow: WindowType = { id: `window-${nextId}`, title, content, icon, isMinimized: false, url, }; setWindows([...windows, newWindow]); setNextId(nextId + 1); }; const closeWindow = (id: string) => { setWindows(windows.filter(w => w.id !== id)); }; const minimizeWindow = (id: string) => { setWindows(windows.map(w => w.id === id ? { ...w, isMinimized: !w.isMinimized } : w )); }; const restoreWindow = (id: string) => { setWindows(windows.map(w => w.id === id ? { ...w, isMinimized: false } : w )); }; // const openVS = () => { // openWindow('VS Code', , '💻', 'https://code.visualstudio.com'); // }; const YandexIcon = () => ( ); const AmneziaIcon = () => ( ) const openYandex = () => { openWindow('Yandex', , 'Я', 'https://yandex.ru'); }; const openAmnezia = () => { openWindow('Amnezia VPN', , 'Я', 'https://yandex.ru'); }; const openTerminal = () => { openWindow('Terminal', , 'T', 'https://oop.com'); }; return (
{/* */} {/* */} {/* */} {showAmnezia && ( )}
{windows.map(window => !window.isMinimized && ( ))}
); }; export default MainApp;