diff --git a/src/frontend/src/components/pages/dashboard/FeatureCard.jsx b/src/frontend/src/components/pages/dashboard/FeatureCard.jsx new file mode 100644 index 0000000..5da6c03 --- /dev/null +++ b/src/frontend/src/components/pages/dashboard/FeatureCard.jsx @@ -0,0 +1,43 @@ +import { Box, Button, Text } from '@chakra-ui/react'; +import React from 'react'; + +/** + * 特性卡片 + * @param title 标题 + * @param description 描述 + * @param buttonText 按钮文字 + * @param to 转向 + * @param disabled 按钮是否可用 + * @returns {JSX.Element} + * @constructor + */ +const FeatureCard = ({ title, description, buttonText, to, disabled }) => ( + + + {title} + + + {description} + + + +); + +export default FeatureCard; diff --git a/src/frontend/src/components/pages/dashboard/StatCard.jsx b/src/frontend/src/components/pages/dashboard/StatCard.jsx new file mode 100644 index 0000000..88b1937 --- /dev/null +++ b/src/frontend/src/components/pages/dashboard/StatCard.jsx @@ -0,0 +1,31 @@ +import { Box, Stat } from '@chakra-ui/react'; +import React from 'react'; + +/** + * 状态卡片 + * @param title 标题 + * @param value 内容 + * @param suffix 交换机数目 + * @param isTime 扫描时间 + * @returns {JSX.Element} + * @constructor + */ +const StatCard = ({ title, value, suffix, isTime }) => ( + + + {title} + {`${value}${suffix ? ` ${suffix}` : ''}`} + {isTime && {`上次扫描时间`}} + + +); + +export default StatCard; diff --git a/src/frontend/src/components/system/PageContainer.jsx b/src/frontend/src/components/system/PageContainer.jsx index 857c974..ba723a5 100644 --- a/src/frontend/src/components/system/PageContainer.jsx +++ b/src/frontend/src/components/system/PageContainer.jsx @@ -8,7 +8,7 @@ import { Box } from '@chakra-ui/react'; */ const PageContainer = ({ children }) => { return ( - + {children} ); diff --git a/src/frontend/src/pages/Dashboard.jsx b/src/frontend/src/pages/Dashboard.jsx index 964dd61..c1187c9 100644 --- a/src/frontend/src/pages/Dashboard.jsx +++ b/src/frontend/src/pages/Dashboard.jsx @@ -1,19 +1,117 @@ -import React from 'react'; -import { Box, Text } from '@chakra-ui/react'; +import React, { useEffect, useState } from 'react'; +import { Box, Text, VStack, HStack, SimpleGrid, Badge } from '@chakra-ui/react'; import DocumentTitle from '@/components/system/pages/DocumentTitle'; import PageContainer from '@/components/system/PageContainer'; import DashboardBackground from '@/components/system/pages/DashboardBackground'; import FadeInWrapper from '@/components/system/layout/FadeInWrapper'; +import FeatureCard from '@/components/pages/dashboard/FeatureCard'; +import StatCard from '@/components/pages/dashboard/StatCard'; +/** + * 控制台页面 + * @returns {JSX.Element} + * @constructor + */ const Dashboard = () => { + const [stats, setStats] = useState({ + totalDevices: 0, + onlineDevices: 0, + lastScan: '', + }); + + useEffect(() => {}, []); + return ( - - - 控制台奇怪的功能+1 - + + + + + {`欢迎使用智能交换机管理系统`} + + + {`实时监控您的网络设备状态,快速配置并掌控全局网络环境`} + + + + + + + + + + + + + {`网络健康状态`} + + + + {`网络连接正常`} + + + {`交换机正常运行`} + + + {`流量监控未启动`} + + + + + + + + + + + + + +