This commit is contained in:
Jerry 2025-06-12 13:56:31 +08:00
parent 5917e26247
commit bd85dff234
4 changed files with 46 additions and 23 deletions

View File

@ -18,3 +18,10 @@
- 执行`pnpm build`进行`react`服务端构建 - 执行`pnpm build`进行`react`服务端构建
- 运行`pnpm start`启动服务端 - 运行`pnpm start`启动服务端
- 服务运行在本地`3000`端口 - 服务运行在本地`3000`端口
#### 功能(后端)
- []监控网络流量
- []扫描环境中的交换机
- []自然语言解析命令
- []下发配置到交换机
- []流量预测

View File

@ -1,7 +1,7 @@
import { Outlet, useLocation } from 'react-router-dom'; import { Outlet, useLocation } from 'react-router-dom';
import PageTransition from './PageTransition';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import { AnimatePresence } from 'framer-motion'; import { AnimatePresence } from 'framer-motion';
import PageTransition from './PageTransition';
import GithubTransitionCard from '@/components/system/layout/github/GithubTransitionCard'; import GithubTransitionCard from '@/components/system/layout/github/GithubTransitionCard';
/** /**
@ -11,12 +11,11 @@ import GithubTransitionCard from '@/components/system/layout/github/GithubTransi
*/ */
const AppShell = () => { const AppShell = () => {
const location = useLocation(); const location = useLocation();
return ( return (
<Box position={'relative'} height={'100vh'} overflow={'hidden'}> <Box position="relative" height="100vh" overflow="hidden">
<GithubTransitionCard /> <GithubTransitionCard />
<Box overflowY={'auto'} height={'100%'}> <Box overflowY="auto" height="100%">
<AnimatePresence mode={'sync'}> <AnimatePresence mode="wait" initial={false}>
<PageTransition key={location.pathname}> <PageTransition key={location.pathname}>
<Outlet /> <Outlet />
</PageTransition> </PageTransition>

View File

@ -1,29 +1,43 @@
import { motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
/** /**
* 组件载入动画 * 组件进入 / 离开时的淡入淡出动画
* @param children 子组件 * @param children 子组件
* @param delay 延迟 * @param delay 延迟
* @param yOffset y轴偏移量 * @param yOffset y轴偏移量
* @param duration 动画时间 * @param duration 动画时间
* @param className 类名 * @param className 类名
* @param props
* @returns {JSX.Element} * @returns {JSX.Element}
* @constructor * @constructor
*/ */
const FadeInWrapper = ({ children, delay = 0, yOffset = 10, duration = 0.6, className = '' }) => { const FadeInWrapper = ({
children,
delay = 0,
yOffset = 10,
duration = 0.6,
className = '',
...props
}) => {
return ( return (
<AnimatePresence mode="wait">
<motion.div <motion.div
key="fade-wrapper"
initial={{ opacity: 0, y: yOffset }} initial={{ opacity: 0, y: yOffset }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -yOffset }}
transition={{ transition={{
delay, delay,
duration, duration,
ease: [0.16, 0.77, 0.47, 0.97], ease: [0.16, 0.77, 0.47, 0.97],
}} }}
className={className} className={className}
{...props}
> >
{children} {children}
</motion.div> </motion.div>
</AnimatePresence>
); );
}; };
export default FadeInWrapper; export default FadeInWrapper;

View File

@ -3,15 +3,18 @@ import { Box, Text } from '@chakra-ui/react';
import DocumentTitle from '@/components/system/pages/DocumentTitle'; import DocumentTitle from '@/components/system/pages/DocumentTitle';
import PageContainer from '@/components/system/PageContainer'; import PageContainer from '@/components/system/PageContainer';
import DashboardBackground from '@/components/system/pages/DashboardBackground'; import DashboardBackground from '@/components/system/pages/DashboardBackground';
import FadeInWrapper from '@/components/system/layout/FadeInWrapper';
const Dashboard = () => { const Dashboard = () => {
return ( return (
<DocumentTitle title={'控制台'}> <DocumentTitle title={'控制台'}>
<DashboardBackground /> <DashboardBackground />
<PageContainer> <PageContainer>
<FadeInWrapper delay={0.1} yOffset={-5}>
<Box p={6}> <Box p={6}>
<Text fontSize={'xl'}>控制台奇怪的功能+1</Text> <Text fontSize={'xl'}>控制台奇怪的功能+1</Text>
</Box> </Box>
</FadeInWrapper>
</PageContainer> </PageContainer>
</DocumentTitle> </DocumentTitle>
); );