frontend: мобильная версия отключена
- Удалён /mobile-роут и MobileFormPage; " /" всегда ведёт на /desktop (user-agent/width-детекция выпилена — ЦОУ работает только на десктопе). - Тема mobile в index.css оставлена (мёртвый CSS, не мешает). - CaseForm.isMobile не тронут: DesktopSARPage передаёт false явно.
This commit is contained in:
+5
-22
@@ -1,7 +1,6 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React 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 Login from "./pages/Login";
|
||||
@@ -14,15 +13,13 @@ function ThemeProvider({ children }) {
|
||||
|
||||
useEffect(() => {
|
||||
let theme = "desktop";
|
||||
|
||||
if (location.pathname.startsWith("/mobile") || location.pathname.startsWith("/m")) {
|
||||
theme = "mobile";
|
||||
} else if (location.pathname.startsWith("/admin")) {
|
||||
|
||||
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]);
|
||||
|
||||
@@ -30,18 +27,6 @@ function ThemeProvider({ children }) {
|
||||
}
|
||||
|
||||
function App() {
|
||||
const [isMobile, setIsMobile] = useState(
|
||||
() => /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const onResize = () => setIsMobile(
|
||||
/iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768
|
||||
);
|
||||
window.addEventListener('resize', onResize);
|
||||
return () => window.removeEventListener('resize', onResize);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Router>
|
||||
<AuthProvider>
|
||||
@@ -49,7 +34,7 @@ function App() {
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
|
||||
<Route path="/" element={<Navigate to={isMobile ? "/mobile" : "/desktop"} replace />} />
|
||||
<Route path="/" element={<Navigate to="/desktop" replace />} />
|
||||
|
||||
<Route path="/sar" element={<ProtectedRoute><DesktopSARPage /></ProtectedRoute>} />
|
||||
<Route path="/desktop" element={<ProtectedRoute><DesktopSARPage /></ProtectedRoute>} />
|
||||
@@ -57,8 +42,6 @@ function App() {
|
||||
<Route path="/analysis/:caseId" element={<ProtectedRoute><AnalysisResult /></ProtectedRoute>} />
|
||||
|
||||
<Route path="/admin/*" element={<ProtectedRoute roles={["admin"]}><AdminDashboard /></ProtectedRoute>} />
|
||||
|
||||
<Route path="/mobile" element={<ProtectedRoute><MobileFormPage /></ProtectedRoute>} />
|
||||
</Routes>
|
||||
</ThemeProvider>
|
||||
</AuthProvider>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import React from "react";
|
||||
import CaseForm from "../components/CaseForm";
|
||||
|
||||
const MobileFormPage = () => {
|
||||
return (
|
||||
<div className="mobile-page">
|
||||
<CaseForm isMobile={true} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MobileFormPage;
|
||||
Reference in New Issue
Block a user