File size: 2,729 Bytes
a0098d0
 
 
 
 
 
 
 
60367a0
a0098d0
 
 
 
60367a0
a0098d0
 
60367a0
 
 
a0098d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { Toaster, toast } from 'react-hot-toast';
import { useEffect } from 'react';
import Layout from './components/Layout';
import Dashboard from './pages/Dashboard';
import Quantizer from './pages/Quantizer';
import Analysis from './pages/Analysis';
import ModelLoader from './pages/ModelLoader';
import { useSystemStore, useUIStore } from './store';
import './index.css';

function App() {
  const fetchSystemInfo = useSystemStore((state) => state.fetchSystemInfo);
  const theme = useUIStore((state) => state.theme);

  useEffect(() => {
    // Sync theme on mount
    document.documentElement.setAttribute('data-theme', theme);
    // Fetch system info
    fetchSystemInfo();

    const handleOffline = () => toast.error("Internet connection lost");
    const handleOnline = () => toast.success("Internet connection restored");

    window.addEventListener('offline', handleOffline);
    window.addEventListener('online', handleOnline);

    return () => {
      window.removeEventListener('offline', handleOffline);
      window.removeEventListener('online', handleOnline);
    };
  }, [fetchSystemInfo]);

  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={<Layout />}>
          <Route index element={<Navigate to="/dashboard" replace />} />
          <Route path="dashboard" element={<Dashboard />} />
          <Route path="quantize" element={<Quantizer />} />
          <Route path="analysis" element={<Analysis />} />
          <Route path="models" element={<ModelLoader />} />
        </Route>
      </Routes>
      <Toaster
        position="top-right"
        toastOptions={{
          duration: 4000,
          style: {
            background: 'rgba(15, 23, 42, 0.8)',
            color: '#e2e8f0',
            backdropFilter: 'blur(12px)',
            border: '1px solid rgba(255, 255, 255, 0.1)',
            padding: '12px 24px',
            borderRadius: '12px',
            boxShadow: '0 8px 32px rgba(0, 0, 0, 0.2)',
            fontSize: '0.95rem'
          },
          success: {
            iconTheme: {
              primary: '#6366f1',
              secondary: '#fff',
            },
            style: {
              border: '1px solid rgba(99, 102, 241, 0.2)',
              background: 'rgba(99, 102, 241, 0.1)',
            }
          },
          error: {
            iconTheme: {
              primary: '#ef4444',
              secondary: '#fff',
            },
            style: {
              border: '1px solid rgba(239, 68, 68, 0.2)',
              background: 'rgba(239, 68, 68, 0.1)',
            }
          }
        }}
      />
    </BrowserRouter>
  );
}

export default App;