From ff657f29d46b46973053250d7217ac7dc1e0a4fe Mon Sep 17 00:00:00 2001 From: skycurtain Date: Mon, 4 Aug 2025 10:58:38 +0800 Subject: [PATCH] chore: basic layout --- src/{App.tsx => layouts/app-layout.tsx} | 33 ++-- src/main.tsx | 27 ++- src/routeTree.gen.ts | 213 ++++++++++++++++++++++++ src/routes/__root.tsx | 11 ++ src/routes/_app.tsx | 7 + src/routes/_app/alarm.tsx | 9 + src/routes/_app/dashboard.tsx | 11 ++ src/routes/_app/device.tsx | 9 + src/routes/_app/log.tsx | 9 + src/routes/_app/statistics.tsx | 9 + src/routes/index.tsx | 8 + src/routes/login.tsx | 13 ++ 12 files changed, 336 insertions(+), 23 deletions(-) rename src/{App.tsx => layouts/app-layout.tsx} (66%) create mode 100644 src/routeTree.gen.ts create mode 100644 src/routes/__root.tsx create mode 100644 src/routes/_app.tsx create mode 100644 src/routes/_app/alarm.tsx create mode 100644 src/routes/_app/dashboard.tsx create mode 100644 src/routes/_app/device.tsx create mode 100644 src/routes/_app/log.tsx create mode 100644 src/routes/_app/statistics.tsx create mode 100644 src/routes/index.tsx create mode 100644 src/routes/login.tsx diff --git a/src/App.tsx b/src/layouts/app-layout.tsx similarity index 66% rename from src/App.tsx rename to src/layouts/app-layout.tsx index 527ad04..ac81865 100644 --- a/src/App.tsx +++ b/src/layouts/app-layout.tsx @@ -2,12 +2,13 @@ import type { MenuTheme } from 'antd'; import type { FC } from 'react'; import { AlertFilled, AreaChartOutlined, FileTextFilled, HomeFilled, VideoCameraFilled } from '@ant-design/icons'; +import { Link, Outlet } from '@tanstack/react-router'; import { Layout, Menu, theme } from 'antd'; import { useState } from 'react'; const { Content, Footer, Header, Sider } = Layout; -const App: FC = () => { +export const AppLayout: FC = () => { const { token: { colorBgContainer } } = theme.useToken(); const [menuTheme] = useState('light'); @@ -19,46 +20,48 @@ const App: FC = () => { 实时数据看板, + key: '/dashboard', icon: , theme: menuTheme, }, { - label: '实时设备状态', - key: 'device', + label: 实时设备状态, + key: '/device', icon: , theme: menuTheme, }, { - label: '设备告警记录', - key: 'alarm', + label: 设备告警记录, + key: '/alarm', icon: , theme: menuTheme, }, { - label: '设备性能统计', - key: 'statistics', // analysis + label: 设备性能统计, + key: '/statistics', // analysis icon: , theme: menuTheme, }, { - label: '系统日志记录', - key: 'log', + label: 系统日志记录, + key: '/log', icon: , theme: menuTheme, - } + }, ]} > {/* 内容区域 */} - + +