Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/config/menu.config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
ProjectOutlined,
FileTextOutlined,
ThunderboltOutlined,
ToolOutlined,
ToolOutlined
} from '@ant-design/icons'

// 静态菜单配置
Expand Down Expand Up @@ -84,21 +84,21 @@ const rawMainLayoutMenu = [
label: 'Vue3 API',
i18nKey: 'menu.vue3Api',
key: '/tech/frontend/plugins/vue3',
icon: <FileTextOutlined />,
icon: <FileTextOutlined />
},
{
label: '性能优化',
i18nKey: 'menu.performanceOptimization',
key: '/tech/frontend/plugins/perf',
icon: <ThunderboltOutlined />,
},
],
},
],
icon: <ThunderboltOutlined />
}
]
}
]
},
{ label: 'Angular', i18nKey: 'menu.angular', key: '/tech/frontend/angular', icon: <Html5Outlined /> },
{ label: 'Node', i18nKey: 'menu.node', key: '/tech/frontend/node', icon: <CloudServerOutlined /> },
],
{ label: 'Node', i18nKey: 'menu.node', key: '/tech/frontend/node', icon: <CloudServerOutlined /> }
]
},
{
label: '后端技术栈',
Expand All @@ -108,8 +108,8 @@ const rawMainLayoutMenu = [
children: [
{ label: 'Node', i18nKey: 'menu.node', key: '/tech/backend/node', icon: <CodeOutlined /> },
{ label: 'Java', i18nKey: 'menu.java', key: '/tech/backend/java', icon: <CodeOutlined /> },
{ label: 'Go', i18nKey: 'menu.go', key: '/tech/backend/go', icon: <CodeOutlined /> },
],
{ label: 'Go', i18nKey: 'menu.go', key: '/tech/backend/go', icon: <CodeOutlined /> }
]
},
{
label: '构建工具',
Expand All @@ -118,21 +118,21 @@ const rawMainLayoutMenu = [
icon: <ApartmentOutlined />,
children: [
{ label: 'Webpack', i18nKey: 'menu.webpack', key: '/build/webpack', icon: <ToolOutlined /> },
{ label: 'Vite', i18nKey: 'menu.vite', key: '/build/vite', icon: <ThunderboltOutlined /> },
],
{ label: 'Vite', i18nKey: 'menu.vite', key: '/build/vite', icon: <ThunderboltOutlined /> }
]
},

{
label: 'Error',
i18nKey: 'menu.error',
key: '/sub-error',
icon: <QuestionCircleOutlined />,
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 }
Expand Down
24 changes: 12 additions & 12 deletions src/locales/en/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const en = {
nav: {
home: 'Home',
dashboard: 'Dashboard',
portfolio: 'My Portfolio',
portfolio: 'My Portfolio'
},
header: {
search: 'Menu search',
Expand All @@ -21,7 +21,7 @@ const en = {
userCenter: 'Profile',
userSettings: 'Settings',
contactMe: 'Contact',
logout: 'Log out',
logout: 'Log out'
},
settingDrawer: {
title: 'Preferences',
Expand All @@ -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: {
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -110,7 +110,7 @@ const en = {
vite: 'Vite',

error: 'Error',
errorBoundary: 'ErrorBoundary',
errorBoundary: 'ErrorBoundary'
},
svp: {
ariaPlaybackSettings: 'Playback settings',
Expand Down Expand Up @@ -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
24 changes: 12 additions & 12 deletions src/locales/zh/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const zh = {
nav: {
home: '首页',
dashboard: '多路由设置',
portfolio: '我的作品集',
portfolio: '我的作品集'
},
header: {
search: '菜单搜索',
Expand All @@ -21,7 +21,7 @@ const zh = {
userCenter: '个人中心',
userSettings: '个人设置',
contactMe: '联 系 我',
logout: '退出登录',
logout: '退出登录'
},
settingDrawer: {
title: '偏好设置',
Expand All @@ -31,11 +31,11 @@ const zh = {
navigationMode: '导航模式',
contentWidth: '内容区域宽度',
other: '其他设置',
visualEffects: '视觉特效',
visualEffects: '视觉特效'
},
navTheme: {
light: '亮色菜单风格',
dark: '暗色菜单风格',
dark: '暗色菜单风格'
},
enableDarkMode: '开启暗黑模式',
colors: {
Expand All @@ -46,13 +46,13 @@ const zh = {
cyan: '明青',
auroraGreen: '极光绿',
geekBlue: 'Geek Blue',
purple: '酱紫',
purple: '酱紫'
},
customColor: '自定义颜色',
layout: {
side: '侧边菜单布局',
top: '顶部菜单布局',
mix: '混合菜单布局',
mix: '混合菜单布局'
},
contentWidth: '内容区域宽度',
contentWidthFixed: '固定',
Expand All @@ -62,12 +62,12 @@ const zh = {
grayMode: '灰色模式',
compactMode: '紧凑模式',
fixedHeader: '固定 Header',
fixedSider: '固定侧边菜单',
fixedSider: '固定侧边菜单'
},
effects: {
pointerFollow: '指针跟随',
pointerTrail: '指针轨迹',
},
pointerTrail: '指针轨迹'
}
},
menu: {
motion: '动效',
Expand Down Expand Up @@ -110,7 +110,7 @@ const zh = {
vite: 'Vite',

error: '错误',
errorBoundary: '错误边界',
errorBoundary: '错误边界'
},
svp: {
ariaPlaybackSettings: '播放设置',
Expand Down Expand Up @@ -189,8 +189,8 @@ const zh = {
videoNetworkError: '网络错误导致视频加载失败',
videoDecodeError: '视频解码失败(格式/编码不兼容)',
videoSourceNotSupported: '视频源不可用(404/跨域/类型不支持)',
videoLoadFailed: '视频加载失败',
},
videoLoadFailed: '视频加载失败'
}
}

export default zh
12 changes: 6 additions & 6 deletions src/pages/layout/primaryNav/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ export const usePrimaryNavItems = () => {
i18nKey: 'nav.home',
icon: <HomeOutlined style={{ fontSize: 16 }} />,
onClick: () => redirectTo('/'),
show: true,
show: true
},
{
key: 'dashboard',
label: '多路由设置',
i18nKey: 'nav.dashboard',
icon: <DashboardOutlined style={{ fontSize: 16 }} />,
onClick: () => redirectTo('dashboard'),
show: hasAccess('/dashboard'),
show: hasAccess('/dashboard')
},
{
key: 'portfilo',
label: 'My Portfilo',
i18nKey: 'nav.portfolio',
icon: <ProjectOutlined style={{ fontSize: 16 }} />,
onClick: () => redirectTo('portfilo'),
show: hasAccess('/portfilo'),
},
show: hasAccess('/portfilo')
}
]

return items.filter((item) => item.show).map(({ show, ...rest }) => rest)
Expand All @@ -92,7 +92,7 @@ const PrimaryNav = ({ layout = '' }) => {
return (
<Space style={{ marginRight: 16 }}>
{filterItems.map((item) => (
<Button key={item.key} type="link" icon={item.icon} onClick={item.onClick}>
<Button key={item.key} type='link' icon={item.icon} onClick={item.onClick}>
{item.i18nKey ? t(item.i18nKey) : item.label}
</Button>
))}
Expand All @@ -101,7 +101,7 @@ const PrimaryNav = ({ layout = '' }) => {
}

PrimaryNav.propTypes = {
layout: PropTypes.string,
layout: PropTypes.string
}

export default PrimaryNav
4 changes: 2 additions & 2 deletions src/pages/layout/proContent/breadcrumb/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
}
Expand All @@ -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
Expand Down
Loading
Loading