feat: 前端集成 Prettier 代码格式化
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import { useState } from 'react';
|
||||
import { Outlet, useLocation, useNavigate } from 'react-router';
|
||||
import { ServerIcon, ChartLineIcon, SettingIcon, ChevronLeftIcon, ChevronRightIcon } from 'tdesign-icons-react';
|
||||
import { Layout, Menu, Button } from 'tdesign-react';
|
||||
import { useState } from 'react'
|
||||
import { Outlet, useLocation, useNavigate } from 'react-router'
|
||||
import { ServerIcon, ChartLineIcon, SettingIcon, ChevronLeftIcon, ChevronRightIcon } from 'tdesign-icons-react'
|
||||
import { Layout, Menu, Button } from 'tdesign-react'
|
||||
|
||||
const { MenuItem } = Menu;
|
||||
const { MenuItem } = Menu
|
||||
|
||||
export function AppLayout() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const [collapsed, setCollapsed] = useState(false)
|
||||
|
||||
const getPageTitle = () => {
|
||||
if (location.pathname === '/providers') return '供应商管理';
|
||||
if (location.pathname === '/stats') return '用量统计';
|
||||
if (location.pathname === '/settings') return '设置';
|
||||
return 'AI Gateway';
|
||||
};
|
||||
if (location.pathname === '/providers') return '供应商管理'
|
||||
if (location.pathname === '/stats') return '用量统计'
|
||||
if (location.pathname === '/settings') return '设置'
|
||||
return 'AI Gateway'
|
||||
}
|
||||
|
||||
const asideWidth = collapsed ? '64px' : '232px';
|
||||
const asideWidth = collapsed ? '64px' : '232px'
|
||||
|
||||
return (
|
||||
<Layout style={{ minHeight: '100vh' }}>
|
||||
@@ -38,34 +38,36 @@ export function AppLayout() {
|
||||
collapsed={collapsed}
|
||||
width={['232px', '64px']}
|
||||
logo={
|
||||
<div style={{
|
||||
height: 64,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
fontSize: '1.25rem',
|
||||
fontWeight: 600,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
height: 64,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
fontSize: '1.25rem',
|
||||
fontWeight: 600,
|
||||
}}
|
||||
>
|
||||
{!collapsed && 'AI Gateway'}
|
||||
</div>
|
||||
}
|
||||
operations={
|
||||
<Button
|
||||
variant="text"
|
||||
shape="square"
|
||||
variant='text'
|
||||
shape='square'
|
||||
icon={collapsed ? <ChevronRightIcon /> : <ChevronLeftIcon />}
|
||||
onClick={() => setCollapsed(!collapsed)}
|
||||
/>
|
||||
}
|
||||
style={{ height: '100%' }}
|
||||
>
|
||||
<MenuItem value="/providers" icon={<ServerIcon />}>
|
||||
<MenuItem value='/providers' icon={<ServerIcon />}>
|
||||
供应商管理
|
||||
</MenuItem>
|
||||
<MenuItem value="/stats" icon={<ChartLineIcon />}>
|
||||
<MenuItem value='/stats' icon={<ChartLineIcon />}>
|
||||
用量统计
|
||||
</MenuItem>
|
||||
<MenuItem value="/settings" icon={<SettingIcon />}>
|
||||
<MenuItem value='/settings' icon={<SettingIcon />}>
|
||||
设置
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
@@ -95,5 +97,5 @@ export function AppLayout() {
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user