File size: 2,531 Bytes
1c0c94d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { NavLink, Navigate, Route, Routes } from 'react-router-dom'
import AnalyzePage from './pages/AnalyzePage.jsx'
import AnalyticsPage from './pages/AnalyticsPage.jsx'
import ReviewPage from './pages/ReviewPage.jsx'
import SearchPage from './pages/SearchPage.jsx'
import { useTheme } from './context/ThemeContext.jsx'
import { ShieldAlert, Activity, LayoutList, Search, Sun, Moon } from 'lucide-react'

const TABS = [
  { to: '/analyze', label: 'Analyze a photo', icon: ShieldAlert },
  { to: '/analytics', label: 'Analytics', icon: Activity },
  { to: '/review', label: 'Review queue', icon: LayoutList },
  { to: '/search', label: 'Search records', icon: Search },
]

export default function App() {
  const { theme, toggleTheme } = useTheme()
  return (
    <>
      <header style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
        <div style={{ display: 'flex', alignItems: 'flex-start', gap: '16px' }}>
          <div style={{ marginTop: '2px', color: 'var(--blue)' }}>
            <ShieldAlert size={36} strokeWidth={1.5} />
          </div>
          <div>
            <h1 style={{ fontSize: '28px', marginBottom: '6px', letterSpacing: '-0.5px' }}>AVIS Intelligence</h1>
            <p className="muted" style={{ fontSize: '15px', maxWidth: '500px', lineHeight: '1.5' }}>
              Automated road safety analysis powered by <b>Vision AI</b>. Detect violations, extract plates, and verify evidence in seconds.
            </p>
          </div>
        </div>
        <button className="icon-btn" onClick={toggleTheme} aria-label="Toggle theme">
          {theme === 'dark' ? <Sun size={20} /> : <Moon size={20} />}
        </button>
      </header>
      <nav>
        {TABS.map((t) => (
          <NavLink key={t.to} to={t.to} className={({ isActive }) => (isActive ? 'active' : '')}>
            <t.icon size={16} style={{ marginBottom: '-3px', marginRight: '6px' }} />
            {t.label}
          </NavLink>
        ))}
      </nav>
      <main>
        <Routes>
          <Route path="/" element={<Navigate to="/analyze" replace />} />
          <Route path="/analyze" element={<AnalyzePage />} />
          <Route path="/analytics" element={<AnalyticsPage />} />
          <Route path="/review" element={<ReviewPage />} />
          <Route path="/search" element={<SearchPage />} />
          <Route path="*" element={<Navigate to="/analyze" replace />} />
        </Routes>
      </main>
      <footer>
        <p>Built by team panchayat</p>
      </footer>
    </>
  )
}