diff --git a/src/config/menu.config.jsx b/src/config/menu.config.jsx index 9fb5d10e1..e684807a4 100644 --- a/src/config/menu.config.jsx +++ b/src/config/menu.config.jsx @@ -32,7 +32,7 @@ import { ProjectOutlined, FileTextOutlined, ThunderboltOutlined, - ToolOutlined, + ToolOutlined } from '@ant-design/icons' // 静态菜单配置 @@ -84,21 +84,21 @@ const rawMainLayoutMenu = [ label: 'Vue3 API', i18nKey: 'menu.vue3Api', key: '/tech/frontend/plugins/vue3', - icon: , + icon: }, { label: '性能优化', i18nKey: 'menu.performanceOptimization', key: '/tech/frontend/plugins/perf', - icon: , - }, - ], - }, - ], + icon: + } + ] + } + ] }, { label: 'Angular', i18nKey: 'menu.angular', key: '/tech/frontend/angular', icon: }, - { label: 'Node', i18nKey: 'menu.node', key: '/tech/frontend/node', icon: }, - ], + { label: 'Node', i18nKey: 'menu.node', key: '/tech/frontend/node', icon: } + ] }, { label: '后端技术栈', @@ -108,8 +108,8 @@ const rawMainLayoutMenu = [ children: [ { label: 'Node', i18nKey: 'menu.node', key: '/tech/backend/node', icon: }, { label: 'Java', i18nKey: 'menu.java', key: '/tech/backend/java', icon: }, - { label: 'Go', i18nKey: 'menu.go', key: '/tech/backend/go', icon: }, - ], + { label: 'Go', i18nKey: 'menu.go', key: '/tech/backend/go', icon: } + ] }, { label: '构建工具', @@ -118,8 +118,8 @@ const rawMainLayoutMenu = [ icon: , children: [ { label: 'Webpack', i18nKey: 'menu.webpack', key: '/build/webpack', icon: }, - { label: 'Vite', i18nKey: 'menu.vite', key: '/build/vite', icon: }, - ], + { label: 'Vite', i18nKey: 'menu.vite', key: '/build/vite', icon: } + ] }, { @@ -127,12 +127,12 @@ const rawMainLayoutMenu = [ i18nKey: 'menu.error', key: '/sub-error', icon: , - children: [{ label: 'ErrorBoundary', i18nKey: 'menu.errorBoundary', key: '/error' }], - }, + children: [{ label: 'ErrorBoundary', i18nKey: 'menu.errorBoundary', key: '/error' }] + } ] // 规范化菜单:为每个项保证存在 `path` 字段(优先使用已有 path,否则复制 key)。 -function normalizeMenu(items) { +function normalizeMenu (items) { return items.map((it) => { const { children, ...rest } = it const normalized = { ...rest, path: (it && it.path) || it.key } diff --git a/src/locales/en/translation.js b/src/locales/en/translation.js index f9363d631..7ff2be1b3 100644 --- a/src/locales/en/translation.js +++ b/src/locales/en/translation.js @@ -5,7 +5,7 @@ const en = { nav: { home: 'Home', dashboard: 'Dashboard', - portfolio: 'My Portfolio', + portfolio: 'My Portfolio' }, header: { search: 'Menu search', @@ -21,7 +21,7 @@ const en = { userCenter: 'Profile', userSettings: 'Settings', contactMe: 'Contact', - logout: 'Log out', + logout: 'Log out' }, settingDrawer: { title: 'Preferences', @@ -31,11 +31,11 @@ const en = { navigationMode: 'Navigation mode', contentWidth: 'Content width', other: 'Other settings', - visualEffects: 'Visual effects', + visualEffects: 'Visual effects' }, navTheme: { light: 'Light menu style', - dark: 'Dark menu style', + dark: 'Dark menu style' }, enableDarkMode: 'Enable dark mode', colors: { @@ -46,13 +46,13 @@ const en = { cyan: 'Cyan', auroraGreen: 'Aurora Green', geekBlue: 'Geek Blue', - purple: 'Purple', + purple: 'Purple' }, customColor: 'Custom color', layout: { side: 'Side menu layout', top: 'Top menu layout', - mix: 'Mixed menu layout', + mix: 'Mixed menu layout' }, contentWidth: 'Content width', contentWidthFixed: 'Fixed', @@ -62,12 +62,12 @@ const en = { grayMode: 'Grayscale mode', compactMode: 'Compact mode', fixedHeader: 'Fixed header', - fixedSider: 'Fixed sidebar', + fixedSider: 'Fixed sidebar' }, effects: { pointerFollow: 'Pointer follow', - pointerTrail: 'Pointer trail', - }, + pointerTrail: 'Pointer trail' + } }, menu: { motion: 'Motion', @@ -110,7 +110,7 @@ const en = { vite: 'Vite', error: 'Error', - errorBoundary: 'ErrorBoundary', + errorBoundary: 'ErrorBoundary' }, svp: { ariaPlaybackSettings: 'Playback settings', @@ -189,8 +189,8 @@ const en = { videoNetworkError: 'Network error: failed to load video', videoDecodeError: 'Decode error (unsupported format/codec)', videoSourceNotSupported: 'Video source unavailable (404/CORS/type unsupported)', - videoLoadFailed: 'Failed to load video', - }, + videoLoadFailed: 'Failed to load video' + } } export default en diff --git a/src/locales/zh/translation.js b/src/locales/zh/translation.js index bcb3b63ed..4bab78065 100644 --- a/src/locales/zh/translation.js +++ b/src/locales/zh/translation.js @@ -5,7 +5,7 @@ const zh = { nav: { home: '首页', dashboard: '多路由设置', - portfolio: '我的作品集', + portfolio: '我的作品集' }, header: { search: '菜单搜索', @@ -21,7 +21,7 @@ const zh = { userCenter: '个人中心', userSettings: '个人设置', contactMe: '联 系 我', - logout: '退出登录', + logout: '退出登录' }, settingDrawer: { title: '偏好设置', @@ -31,11 +31,11 @@ const zh = { navigationMode: '导航模式', contentWidth: '内容区域宽度', other: '其他设置', - visualEffects: '视觉特效', + visualEffects: '视觉特效' }, navTheme: { light: '亮色菜单风格', - dark: '暗色菜单风格', + dark: '暗色菜单风格' }, enableDarkMode: '开启暗黑模式', colors: { @@ -46,13 +46,13 @@ const zh = { cyan: '明青', auroraGreen: '极光绿', geekBlue: 'Geek Blue', - purple: '酱紫', + purple: '酱紫' }, customColor: '自定义颜色', layout: { side: '侧边菜单布局', top: '顶部菜单布局', - mix: '混合菜单布局', + mix: '混合菜单布局' }, contentWidth: '内容区域宽度', contentWidthFixed: '固定', @@ -62,12 +62,12 @@ const zh = { grayMode: '灰色模式', compactMode: '紧凑模式', fixedHeader: '固定 Header', - fixedSider: '固定侧边菜单', + fixedSider: '固定侧边菜单' }, effects: { pointerFollow: '指针跟随', - pointerTrail: '指针轨迹', - }, + pointerTrail: '指针轨迹' + } }, menu: { motion: '动效', @@ -110,7 +110,7 @@ const zh = { vite: 'Vite', error: '错误', - errorBoundary: '错误边界', + errorBoundary: '错误边界' }, svp: { ariaPlaybackSettings: '播放设置', @@ -189,8 +189,8 @@ const zh = { videoNetworkError: '网络错误导致视频加载失败', videoDecodeError: '视频解码失败(格式/编码不兼容)', videoSourceNotSupported: '视频源不可用(404/跨域/类型不支持)', - videoLoadFailed: '视频加载失败', - }, + videoLoadFailed: '视频加载失败' + } } export default zh diff --git a/src/pages/layout/primaryNav/index.jsx b/src/pages/layout/primaryNav/index.jsx index b9c72f56b..b8339ca2b 100644 --- a/src/pages/layout/primaryNav/index.jsx +++ b/src/pages/layout/primaryNav/index.jsx @@ -62,7 +62,7 @@ export const usePrimaryNavItems = () => { i18nKey: 'nav.home', icon: , onClick: () => redirectTo('/'), - show: true, + show: true }, { key: 'dashboard', @@ -70,7 +70,7 @@ export const usePrimaryNavItems = () => { i18nKey: 'nav.dashboard', icon: , onClick: () => redirectTo('dashboard'), - show: hasAccess('/dashboard'), + show: hasAccess('/dashboard') }, { key: 'portfilo', @@ -78,8 +78,8 @@ export const usePrimaryNavItems = () => { i18nKey: 'nav.portfolio', icon: , onClick: () => redirectTo('portfilo'), - show: hasAccess('/portfilo'), - }, + show: hasAccess('/portfilo') + } ] return items.filter((item) => item.show).map(({ show, ...rest }) => rest) @@ -92,7 +92,7 @@ const PrimaryNav = ({ layout = '' }) => { return ( {filterItems.map((item) => ( - ))} @@ -101,7 +101,7 @@ const PrimaryNav = ({ layout = '' }) => { } PrimaryNav.propTypes = { - layout: PropTypes.string, + layout: PropTypes.string } export default PrimaryNav diff --git a/src/pages/layout/proContent/breadcrumb/util.js b/src/pages/layout/proContent/breadcrumb/util.js index 62aeb6819..6c442a9fc 100644 --- a/src/pages/layout/proContent/breadcrumb/util.js +++ b/src/pages/layout/proContent/breadcrumb/util.js @@ -62,7 +62,7 @@ export const findRouteChain = (routes, pathname) => { const resolvedKey = matched.path || matched.key || pathToCheck chain.push({ ...matched, - i18nKey: matched.i18nKey || getMenuI18nKeyByPath(resolvedKey), + i18nKey: matched.i18nKey || getMenuI18nKeyByPath(resolvedKey) }) } } @@ -87,7 +87,7 @@ export const getRouteList = (result, arrList, queryItem) => { path: item.path, key: item.key, name: item.name, - i18nKey: item.i18nKey, + i18nKey: item.i18nKey }) }) return result diff --git a/src/pages/layout/proHeader/index.jsx b/src/pages/layout/proHeader/index.jsx index a6996a661..076cd17e0 100644 --- a/src/pages/layout/proHeader/index.jsx +++ b/src/pages/layout/proHeader/index.jsx @@ -15,7 +15,7 @@ import { MoreOutlined, RocketOutlined, BookOutlined, - SearchOutlined, + SearchOutlined } from '@ant-design/icons' import { useNavigate } from 'react-router-dom' import { removeLocalStorage, getLocalStorage } from '@utils/publicFn' @@ -63,7 +63,7 @@ const buildUserMenuItems = ({ t, tokenValue, isAuthenticated, user, redirectTo } { key: 'token', label: <>{tokenValue}, - disabled: true, + disabled: true }, { type: 'divider' }, { @@ -72,7 +72,7 @@ const buildUserMenuItems = ({ t, tokenValue, isAuthenticated, user, redirectTo } icon: , onClick: () => { redirectTo('/profile') - }, + } }, { key: '2', @@ -80,7 +80,7 @@ const buildUserMenuItems = ({ t, tokenValue, isAuthenticated, user, redirectTo } icon: , onClick: () => { redirectTo('/setting') - }, + } }, { key: '3', @@ -88,7 +88,7 @@ const buildUserMenuItems = ({ t, tokenValue, isAuthenticated, user, redirectTo } icon: , onClick: () => { redirectTo('/contact') - }, + } }, { key: '4', @@ -103,8 +103,8 @@ const buildUserMenuItems = ({ t, tokenValue, isAuthenticated, user, redirectTo } safeLogoutCleanup() removeLocalStorage('token') redirectTo('/signin') - }, - }, + } + } ] const buildMobileMoreItems = ({ @@ -113,43 +113,43 @@ const buildMobileMoreItems = ({ onSettingClick, redirectGithub, redirectWiki, - redirectWrapped, + redirectWrapped }) => [ ...(Array.isArray(primaryNavItems) ? primaryNavItems : []).map((it) => ({ ...it, - label: it?.i18nKey ? t(it.i18nKey) : it?.label, + label: it?.i18nKey ? t(it.i18nKey) : it?.label })), { type: 'divider' }, { key: 'notification', label: , icon: null, - onClick: undefined, + onClick: undefined }, { key: 'github', label: t('header.github'), icon: , - onClick: redirectGithub, + onClick: redirectGithub }, { key: 'wiki', label: t('header.wiki'), icon: , - onClick: redirectWiki, + onClick: redirectWiki }, { key: 'wrapped', label: t('header.wrapped'), icon: , - onClick: redirectWrapped, + onClick: redirectWrapped }, { key: 'setting', label: t('header.preferences'), icon: , - onClick: onSettingClick, - }, + onClick: onSettingClick + } ] const safeLogoutCleanup = () => { @@ -190,7 +190,7 @@ const renderMobileMenuTrigger = (isMobile, onMobileMenuClick) => { if (!isMobile) return null return (