frontend: мобильная версия отключена

- Удалён /mobile-роут и MobileFormPage; " /" всегда ведёт на /desktop
  (user-agent/width-детекция выпилена — ЦОУ работает только на десктопе).
- Тема mobile в index.css оставлена (мёртвый CSS, не мешает).
- CaseForm.isMobile не тронут: DesktopSARPage передаёт false явно.
This commit is contained in:
2026-09-09 19:03:19 +03:00
parent d762fd104c
commit d4f2cb4f20
2 changed files with 5 additions and 34 deletions
+5 -22
View File
@@ -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 { BrowserRouter as Router, Routes, Route, Navigate, useLocation } from "react-router-dom";
import AdminDashboard from "./pages/AdminDashboard"; import AdminDashboard from "./pages/AdminDashboard";
import MobileFormPage from "./pages/MobileFormPage";
import DesktopSARPage from "./pages/DesktopSARPage"; import DesktopSARPage from "./pages/DesktopSARPage";
import AnalysisResult from "./pages/analysis/AnalysisResult"; import AnalysisResult from "./pages/analysis/AnalysisResult";
import Login from "./pages/Login"; import Login from "./pages/Login";
@@ -14,15 +13,13 @@ function ThemeProvider({ children }) {
useEffect(() => { useEffect(() => {
let theme = "desktop"; let theme = "desktop";
if (location.pathname.startsWith("/mobile") || location.pathname.startsWith("/m")) { if (location.pathname.startsWith("/admin")) {
theme = "mobile";
} else if (location.pathname.startsWith("/admin")) {
theme = "admin"; theme = "admin";
} else if (location.pathname.startsWith("/sar") || location.pathname.startsWith("/desktop") || location.pathname.startsWith("/analysis")) { } else if (location.pathname.startsWith("/sar") || location.pathname.startsWith("/desktop") || location.pathname.startsWith("/analysis")) {
theme = "desktop"; theme = "desktop";
} }
document.documentElement.setAttribute("data-theme", theme); document.documentElement.setAttribute("data-theme", theme);
}, [location.pathname]); }, [location.pathname]);
@@ -30,18 +27,6 @@ function ThemeProvider({ children }) {
} }
function App() { 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 ( return (
<Router> <Router>
<AuthProvider> <AuthProvider>
@@ -49,7 +34,7 @@ function App() {
<Routes> <Routes>
<Route path="/login" element={<Login />} /> <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="/sar" element={<ProtectedRoute><DesktopSARPage /></ProtectedRoute>} />
<Route path="/desktop" 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="/analysis/:caseId" element={<ProtectedRoute><AnalysisResult /></ProtectedRoute>} />
<Route path="/admin/*" element={<ProtectedRoute roles={["admin"]}><AdminDashboard /></ProtectedRoute>} /> <Route path="/admin/*" element={<ProtectedRoute roles={["admin"]}><AdminDashboard /></ProtectedRoute>} />
<Route path="/mobile" element={<ProtectedRoute><MobileFormPage /></ProtectedRoute>} />
</Routes> </Routes>
</ThemeProvider> </ThemeProvider>
</AuthProvider> </AuthProvider>
-12
View File
@@ -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;