New functional pages: - String-Level Monitoring — simulated string data with heatmap, comparison chart, status table (Under Construction banner) - ROI Simulator — 25-year investment return calculator with IRR, NPV, payback period, cash flow chart - Knowledge Base — O&M wiki with 5 articles, search, categories - Mobile responsive — sidebar auto-collapse on small screens Under Construction stubs: - I-V Curve Diagnosis — demo chart, 4 feature preview cards - Remote Device Configuration — parameter preview, disabled actions, v2.0+ roadmap timeline Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
95 lines
3.7 KiB
TypeScript
95 lines
3.7 KiB
TypeScript
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
import { ConfigProvider, theme } from 'antd';
|
|
import zhCN from 'antd/locale/zh_CN';
|
|
import enUS from 'antd/locale/en_US';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { ThemeProvider, useTheme } from './contexts/ThemeContext';
|
|
import './i18n';
|
|
import MainLayout from './layouts/MainLayout';
|
|
import LoginPage from './pages/Login';
|
|
import Dashboard from './pages/Dashboard';
|
|
import Monitoring from './pages/Monitoring';
|
|
import Analysis from './pages/Analysis';
|
|
import Alarms from './pages/Alarms';
|
|
import Carbon from './pages/Carbon';
|
|
import Reports from './pages/Reports';
|
|
import Devices from './pages/Devices';
|
|
import DeviceDetail from './pages/DeviceDetail';
|
|
import SystemManagement from './pages/System';
|
|
import Quota from './pages/Quota';
|
|
|
|
import Maintenance from './pages/Maintenance';
|
|
import DataQuery from './pages/DataQuery';
|
|
import Management from './pages/Management';
|
|
import Prediction from './pages/Prediction';
|
|
import EnergyStrategy from './pages/EnergyStrategy';
|
|
import ROISimulator from './pages/ROISimulator';
|
|
import AIOperations from './pages/AIOperations';
|
|
import KnowledgeBase from './pages/KnowledgeBase';
|
|
import BigScreen from './pages/BigScreen';
|
|
import StringMonitoring from './pages/StringMonitoring';
|
|
import IVDiagnosis from './pages/IVDiagnosis';
|
|
import RemoteConfig from './pages/RemoteConfig';
|
|
|
|
import { isLoggedIn } from './utils/auth';
|
|
|
|
function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
|
if (!isLoggedIn()) return <Navigate to="/login" replace />;
|
|
return <>{children}</>;
|
|
}
|
|
|
|
function AppContent() {
|
|
const { darkMode } = useTheme();
|
|
const { i18n } = useTranslation();
|
|
|
|
return (
|
|
<ConfigProvider
|
|
locale={i18n.language === 'en' ? enUS : zhCN}
|
|
theme={{
|
|
algorithm: darkMode ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
token: { colorPrimary: '#52c41a', borderRadius: 6 },
|
|
}}
|
|
>
|
|
<BrowserRouter>
|
|
<Routes>
|
|
<Route path="/login" element={<LoginPage />} />
|
|
<Route path="/bigscreen" element={<BigScreen />} />
|
|
|
|
<Route path="/" element={<ProtectedRoute><MainLayout /></ProtectedRoute>}>
|
|
<Route index element={<Dashboard />} />
|
|
<Route path="monitoring" element={<Monitoring />} />
|
|
<Route path="devices" element={<Devices />} />
|
|
<Route path="devices/:id" element={<DeviceDetail />} />
|
|
<Route path="analysis" element={<Analysis />} />
|
|
<Route path="alarms" element={<Alarms />} />
|
|
<Route path="carbon" element={<Carbon />} />
|
|
<Route path="reports" element={<Reports />} />
|
|
<Route path="quota" element={<Quota />} />
|
|
|
|
<Route path="maintenance" element={<Maintenance />} />
|
|
<Route path="data-query" element={<DataQuery />} />
|
|
<Route path="management" element={<Management />} />
|
|
<Route path="prediction" element={<Prediction />} />
|
|
<Route path="energy-strategy" element={<EnergyStrategy />} />
|
|
<Route path="roi-simulator" element={<ROISimulator />} />
|
|
<Route path="ai-operations" element={<AIOperations />} />
|
|
<Route path="knowledge-base" element={<KnowledgeBase />} />
|
|
<Route path="string-monitoring" element={<StringMonitoring />} />
|
|
<Route path="iv-diagnosis" element={<IVDiagnosis />} />
|
|
<Route path="remote-config" element={<RemoteConfig />} />
|
|
<Route path="system/*" element={<SystemManagement />} />
|
|
</Route>
|
|
</Routes>
|
|
</BrowserRouter>
|
|
</ConfigProvider>
|
|
);
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<ThemeProvider>
|
|
<AppContent />
|
|
</ThemeProvider>
|
|
);
|
|
}
|