Import Vector lab project

This commit is contained in:
root
2026-06-06 18:31:55 +00:00
commit fcc22063ed
105 changed files with 31639 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
import React, { useEffect } from "react";
import { BrowserRouter as Router, Routes, Route, Navigate, useLocation } from "react-router-dom";
import AdminDashboard from "./pages/AdminDashboard";
import MobileFormPage from "./pages/MobileFormPage";
import DesktopSARPage from "./pages/DesktopSARPage";
import AnalysisResult from "./pages/analysis/AnalysisResult";
import "./App.css";
function ThemeProvider({ children }) {
const location = useLocation();
useEffect(() => {
let theme = "desktop";
if (location.pathname.startsWith("/mobile") || location.pathname.startsWith("/m")) {
theme = "mobile";
} else if (location.pathname.startsWith("/admin")) {
theme = "admin";
} else if (location.pathname.startsWith("/sar") || location.pathname.startsWith("/desktop") || location.pathname.startsWith("/analysis")) {
theme = "desktop";
}
document.documentElement.setAttribute("data-theme", theme);
}, [location.pathname]);
return children;
}
function App() {
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768;
return (
<Router>
<ThemeProvider>
<Routes>
<Route path="/" element={<Navigate to={isMobile ? "/mobile" : "/desktop"} replace />} />
<Route path="/sar" element={<DesktopSARPage />} />
<Route path="/desktop" element={<DesktopSARPage />} />
<Route path="/analysis/:caseId" element={<AnalysisResult />} />
<Route path="/admin/*" element={<AdminDashboard />} />
<Route path="/mobile" element={<MobileFormPage />} />
</Routes>
</ThemeProvider>
</Router>
);
}
export default App;