|
1 | 1 | import { Routes, Route } from 'react-router-dom'; |
2 | | -import { Sidebar } from './components/layout/sidebar'; |
3 | | -import { Header } from './components/layout/header'; |
| 2 | +import { Sidebar, Header, WindowFrame } from './components/layout'; |
4 | 3 | import { Toaster } from './components/ui/sonner'; |
5 | 4 | import { ThemeProvider } from './lib/theme-provider'; |
6 | | -import { Window } from '@tauri-apps/api/window'; |
7 | | -import { useEffect } from 'react'; |
8 | 5 | import ContainersPage from './pages/ContainersPage'; |
9 | 6 | import ImagesPage from './pages/ImagesPage'; |
10 | 7 | import NetworksPage from './pages/NetworksPage'; |
11 | 8 | import VolumesPage from './pages/VolumesPage'; |
12 | 9 | import SettingsPage from './pages/SettingsPage'; |
13 | 10 |
|
14 | 11 | function App() { |
15 | | - useEffect(() => { |
16 | | - const checkInitialState = async () => { |
17 | | - try { |
18 | | - const window = Window.getCurrent(); |
19 | | - const maximized = await window.isMaximized(); |
20 | | - console.log('Initial maximize state:', maximized); |
21 | | - } catch (error) { |
22 | | - console.error('Failed to check initial window state:', error); |
23 | | - } |
24 | | - }; |
25 | | - |
26 | | - checkInitialState(); |
27 | | - }, []); |
28 | | - |
29 | | - const handleMinimize = () => { |
30 | | - console.log('Minimize clicked'); |
31 | | - Window.getCurrent().minimize(); |
32 | | - }; |
33 | | - |
34 | | - const handleMaximize = async () => { |
35 | | - console.log('Maximize clicked'); |
36 | | - try { |
37 | | - const window = Window.getCurrent(); |
38 | | - const currentMaximized = await window.isMaximized(); |
39 | | - console.log('Current maximize state:', currentMaximized); |
40 | | - |
41 | | - if (currentMaximized) { |
42 | | - await window.unmaximize(); |
43 | | - console.log('Window unmaximized'); |
44 | | - } else { |
45 | | - await window.maximize(); |
46 | | - console.log('Window maximized'); |
47 | | - } |
48 | | - } catch (error) { |
49 | | - console.error('Maximize error:', error); |
50 | | - } |
51 | | - }; |
52 | | - |
53 | | - const handleClose = () => { |
54 | | - console.log('Close clicked'); |
55 | | - Window.getCurrent().close(); |
56 | | - }; |
57 | | - |
58 | 12 | return ( |
59 | 13 | <ThemeProvider attribute="class" defaultTheme="dark" enableSystem> |
60 | | - <div className="h-screen flex flex-col"> |
61 | | - {/* Window Controls */} |
62 | | - <div className="window-frame h-8 flex items-center justify-between px-4 bg-background border-b border-border/50"> |
63 | | - <div className="flex items-center space-x-2"> |
64 | | - <div |
65 | | - className="w-3 h-3 rounded-full bg-red-500 hover:bg-red-600 cursor-pointer transition-colors window-controls" |
66 | | - onClick={handleClose} |
67 | | - title="Close" |
68 | | - /> |
69 | | - <div |
70 | | - className="w-3 h-3 rounded-full bg-yellow-500 hover:bg-yellow-600 cursor-pointer transition-colors window-controls" |
71 | | - onClick={handleMinimize} |
72 | | - title="Minimize" |
73 | | - /> |
74 | | - <div |
75 | | - className="w-3 h-3 rounded-full bg-green-500 hover:bg-green-600 cursor-pointer transition-colors window-controls" |
76 | | - onClick={handleMaximize} |
77 | | - title="Maximize" |
78 | | - /> |
79 | | - </div> |
80 | | - <div |
81 | | - className="flex-1 text-center select-none" |
82 | | - data-tauri-drag-region |
83 | | - > |
84 | | - <span className="text-sm font-medium text-foreground/70"> |
85 | | - Nookat |
86 | | - </span> |
87 | | - </div> |
88 | | - <div className="w-12" /> |
89 | | - </div> |
90 | | - |
91 | | - <div className="flex flex-1 min-h-0"> |
92 | | - <Sidebar /> |
93 | | - <div className="flex-1 flex flex-col min-w-0"> |
94 | | - <Header /> |
95 | | - <main className="flex-1 overflow-auto"> |
96 | | - <Routes> |
97 | | - <Route path="/" element={<ContainersPage />} /> |
98 | | - <Route path="/images" element={<ImagesPage />} /> |
99 | | - <Route path="/networks" element={<NetworksPage />} /> |
100 | | - <Route path="/volumes" element={<VolumesPage />} /> |
101 | | - <Route path="/settings" element={<SettingsPage />} /> |
102 | | - </Routes> |
103 | | - </main> |
104 | | - </div> |
| 14 | + <WindowFrame> |
| 15 | + <Sidebar /> |
| 16 | + <div className="flex-1 flex flex-col min-w-0"> |
| 17 | + <Header /> |
| 18 | + <main className="flex-1 overflow-auto"> |
| 19 | + <Routes> |
| 20 | + <Route path="/" element={<ContainersPage />} /> |
| 21 | + <Route path="/images" element={<ImagesPage />} /> |
| 22 | + <Route path="/networks" element={<NetworksPage />} /> |
| 23 | + <Route path="/volumes" element={<VolumesPage />} /> |
| 24 | + <Route path="/settings" element={<SettingsPage />} /> |
| 25 | + </Routes> |
| 26 | + </main> |
105 | 27 | </div> |
106 | | - </div> |
| 28 | + </WindowFrame> |
107 | 29 | <Toaster /> |
108 | 30 | </ThemeProvider> |
109 | 31 | ); |
|
0 commit comments