Skip to content

Commit f36ee33

Browse files
committed
✨ feat(依赖更新与样式优化): 更新多个@flowgram.ai插件至0.4.8版本,提升系统稳定性;在左侧菜单组件中增加渐变背景和hover效果,优化用户交互体验;调整全局配置以支持CSS变量,增强主题灵活性。
1 parent 60d267e commit f36ee33

7 files changed

Lines changed: 310 additions & 108 deletions

File tree

bun.lock

Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
},
1313
"dependencies": {
1414
"@ant-design/v5-patch-for-react-19": "^1.0.3",
15-
"@flowgram.ai/free-container-plugin": "^0.4.7",
16-
"@flowgram.ai/free-group-plugin": "^0.4.7",
17-
"@flowgram.ai/free-layout-editor": "^0.4.7",
18-
"@flowgram.ai/free-lines-plugin": "^0.4.7",
19-
"@flowgram.ai/free-node-panel-plugin": "^0.4.7",
20-
"@flowgram.ai/free-snap-plugin": "^0.4.7",
21-
"@flowgram.ai/minimap-plugin": "^0.4.7",
15+
"@flowgram.ai/free-container-plugin": "^0.4.8",
16+
"@flowgram.ai/free-group-plugin": "^0.4.8",
17+
"@flowgram.ai/free-layout-editor": "^0.4.8",
18+
"@flowgram.ai/free-lines-plugin": "^0.4.8",
19+
"@flowgram.ai/free-node-panel-plugin": "^0.4.8",
20+
"@flowgram.ai/free-snap-plugin": "^0.4.8",
21+
"@flowgram.ai/minimap-plugin": "^0.4.8",
2222
"@monaco-editor/react": "^4.7.0",
23-
"@tanstack/react-query": "^5.85.6",
23+
"@tanstack/react-query": "^5.85.9",
2424
"@zxcvbn-ts/core": "^3.0.4",
2525
"ahooks": "^3.9.5",
2626
"antd": "^5.27.2",

src/GlobalConfigProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const GlobalConfigProvider: React.FC = () => {
2424
return (
2525
<ConfigProvider
2626
theme={{
27+
cssVar: true,
2728
token: {
2829
colorPrimary: colorPrimary,
2930
},

src/layouts/LeftMenu/component/MenuComponent.tsx

Lines changed: 35 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { memo, useCallback, useEffect, useState, useMemo } from "react";
2-
import { Empty, Menu, Spin, type MenuProps } from "antd";
3-
import { useLocation, useNavigate } from "react-router";
4-
import { useTranslation } from "react-i18next";
5-
import { Icon } from "@iconify-icon/react";
6-
import { useMenuStore, usePreferencesStore } from "@/stores/store";
7-
import { getIcon, getOpenKeys, searchRoute } from "@/utils/utils";
8-
import type { RouteItem } from "@/types/route";
9-
import { useShallow } from "zustand/shallow";
10-
import { useTabStore } from "@/stores/tabStore";
11-
12-
type MenuItem = Required<MenuProps>["items"][number];
1+
import { memo, useCallback, useEffect, useState, useMemo } from 'react';
2+
import { Empty, Menu, Spin, type MenuProps } from 'antd';
3+
import { useLocation, useNavigate } from 'react-router';
4+
import { useTranslation } from 'react-i18next';
5+
import { Icon } from '@iconify-icon/react';
6+
import { useMenuStore, usePreferencesStore } from '@/stores/store';
7+
import { getIcon, getOpenKeys, searchRoute } from '@/utils/utils';
8+
import type { RouteItem } from '@/types/route';
9+
import { useShallow } from 'zustand/shallow';
10+
import { useTabStore } from '@/stores/tabStore';
11+
12+
type MenuItem = Required<MenuProps>['items'][number];
1313

1414
/**
1515
* 菜单组件
@@ -27,17 +27,15 @@ const MenuComponent = () => {
2727
accordion: state.preferences.navigation.accordion,
2828
dynamicTitle: state.preferences.app.dynamicTitle,
2929
collapsed: state.preferences.sidebar.collapsed,
30-
}))
30+
})),
3131
);
3232
const mode = usePreferencesStore((state) => {
3333
let mode = state.preferences.theme.mode;
34-
if (mode === "auto") {
35-
mode = window.matchMedia("(prefers-color-scheme: dark)").matches
36-
? "dark"
37-
: "light";
34+
if (mode === 'auto') {
35+
mode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
3836
}
3937
if (state.preferences.theme.semiDarkSidebar) {
40-
mode = "dark";
38+
mode = 'dark';
4139
}
4240
return mode;
4341
});
@@ -51,7 +49,7 @@ const MenuComponent = () => {
5149
key?: React.Key | null,
5250
icon?: React.ReactNode,
5351
children?: MenuItem[],
54-
type?: "group"
52+
type?: 'group',
5553
): MenuItem => {
5654
return {
5755
key,
@@ -62,37 +60,21 @@ const MenuComponent = () => {
6260
} as MenuItem;
6361
};
6462

65-
const deepLoopFloat = useCallback(
66-
(menuList: RouteItem[], newArr: MenuItem[] = []) => {
67-
for (const item of menuList) {
68-
if (
69-
item?.meta?.menuType === 2 ||
70-
item?.meta?.menuType === 3 ||
71-
item?.hidden
72-
) {
73-
continue;
74-
}
75-
if (!item?.children?.length) {
76-
newArr.push(
77-
getItem(item.meta?.title, item.path, getIcon(item.meta?.icon))
78-
);
79-
continue;
80-
}
81-
newArr.push(
82-
getItem(
83-
item.meta?.title,
84-
item.path,
85-
getIcon(item.meta?.icon),
86-
deepLoopFloat(item.children)
87-
)
88-
);
63+
const deepLoopFloat = useCallback((menuList: RouteItem[], newArr: MenuItem[] = []) => {
64+
for (const item of menuList) {
65+
if (item?.meta?.menuType === 2 || item?.meta?.menuType === 3 || item?.hidden) {
66+
continue;
8967
}
90-
return newArr;
91-
},
92-
[]
93-
);
68+
if (!item?.children?.length) {
69+
newArr.push(getItem(item.meta?.title, item.path, getIcon(item.meta?.icon)));
70+
continue;
71+
}
72+
newArr.push(getItem(item.meta?.title, item.path, getIcon(item.meta?.icon), deepLoopFloat(item.children)));
73+
}
74+
return newArr;
75+
}, []);
9476

95-
const clickMenu: MenuProps["onClick"] = ({ key }: { key: string }) => {
77+
const clickMenu: MenuProps['onClick'] = ({ key }: { key: string }) => {
9678
// 使用 replace 模式,替换当前历史记录,防止用户通过浏览器后退按钮回到之前的菜单
9779
navigate(key, { replace: true });
9880
};
@@ -170,15 +152,17 @@ const MenuComponent = () => {
170152
>
171153
{menuList.length > 0 ? (
172154
<Menu
173-
style={{
155+
style={{
174156
borderRight: 0,
175157
height: '100%',
176-
overflowY: 'auto'
158+
overflowY: 'auto',
159+
overflowX: 'hidden',
177160
}}
178161
mode="inline"
179162
theme={mode}
163+
inlineCollapsed={collapsed}
180164
selectedKeys={currentSelectedKeys}
181-
openKeys={collapsed ? [] : mergedOpenKeys}
165+
{...(collapsed ? {} : { openKeys: mergedOpenKeys })}
182166
items={menuList}
183167
onClick={clickMenu}
184168
onOpenChange={onOpenChange}

src/layouts/LeftMenu/component/SystemLogo.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ const SystemLogo = () => {
1515
<div className="flex justify-between items-center toolbox">
1616
<Link to="/" style={{ width: '100%' }}>
1717
<section className="system-logo h-16 flex items-center shrink-0 box-border">
18-
<Image
19-
width={32}
20-
height={32}
21-
className="rounded-s-md transition-all duration-200 overflow-hidden shrink-0"
22-
src={logo}
23-
preview={false}
24-
/>
18+
<div className="logo-container">
19+
<Image
20+
width={32}
21+
height={32}
22+
className="logo-image"
23+
src={logo}
24+
preview={false}
25+
/>
26+
</div>
2527
<span className="system-name" style={{ color: colorPrimary }}>
2628
Nexus Admin
2729
</span>

0 commit comments

Comments
 (0)