Files
ReelShortWeb/src/constants/icons.ts
T

106 lines
4.2 KiB
TypeScript

// Author: fruit.com.cn
/**
* 后台统一图标语义表。所有值都来自 material-symbols-rounded。
*/
export const AppIcons = {
menu: 'material-symbols:menu-rounded',
menuOpen: 'material-symbols:menu-open-rounded',
dashboard: 'material-symbols:dashboard-rounded',
content: 'material-symbols:video-library-rounded',
settings: 'material-symbols:settings-rounded',
group: 'material-symbols:group-rounded',
movieEdit: 'material-symbols:movie-edit-rounded',
policy: 'material-symbols:policy-rounded',
payments: 'material-symbols:payments-rounded',
monitoring: 'material-symbols:monitoring-rounded',
videoCameraFront: 'material-symbols:video-camera-front-rounded',
campaign: 'material-symbols:campaign-rounded',
fullscreen: 'material-symbols:fullscreen-rounded',
fullscreenExit: 'material-symbols:fullscreen-exit-rounded',
formatSize: 'material-symbols:format-size-rounded',
language: 'material-symbols:translate-rounded',
darkMode: 'material-symbols:dark-mode-rounded',
lightMode: 'material-symbols:light-mode-rounded',
refresh: 'material-symbols:refresh-rounded',
restart: 'material-symbols:restart-alt-rounded',
close: 'material-symbols:close-rounded',
chevronLeft: 'material-symbols:chevron-left-rounded',
chevronRight: 'material-symbols:chevron-right-rounded',
chevronDown: 'material-symbols:keyboard-arrow-down-rounded',
chevronUp: 'material-symbols:keyboard-arrow-up-rounded',
search: 'material-symbols:search-rounded',
viewColumn: 'material-symbols:combine-columns-rounded',
help: 'material-symbols:help-rounded',
add: 'material-symbols:add-rounded',
edit: 'material-symbols:edit-rounded',
delete: 'material-symbols:delete-rounded',
upload: 'material-symbols:upload-rounded',
download: 'material-symbols:download-rounded',
copy: 'material-symbols:content-copy-rounded',
openInNew: 'material-symbols:open-in-new-rounded',
visibility: 'material-symbols:visibility-rounded',
arrowUp: 'material-symbols:arrow-upward-rounded',
arrowDown: 'material-symbols:arrow-downward-rounded',
arrowBack: 'material-symbols:arrow-back-rounded',
arrowForward: 'material-symbols:arrow-forward-rounded',
check: 'material-symbols:check-rounded',
checkCircle: 'material-symbols:check-circle-rounded',
cancel: 'material-symbols:cancel-rounded',
lock: 'material-symbols:lock-person-rounded',
logout: 'material-symbols:logout-rounded',
person: 'material-symbols:person-rounded',
clock: 'material-symbols:schedule-rounded',
videoPlay: 'material-symbols:smart-display-rounded',
drag: 'material-symbols:drag-handle-rounded',
tag: 'material-symbols:label-rounded',
line: 'material-symbols:horizontal-rule-rounded',
splitLeft: 'material-symbols:split-scene-left-rounded',
splitRight: 'material-symbols:split-scene-right-rounded',
warning: 'material-symbols:warning-rounded',
error: 'material-symbols:error-rounded',
info: 'material-symbols:info-rounded'
} as const
/** 菜单管理提供的合法图标候选。 */
export const MenuIconOptions = [
AppIcons.dashboard,
AppIcons.content,
AppIcons.settings,
AppIcons.group,
AppIcons.movieEdit,
AppIcons.policy,
AppIcons.payments,
AppIcons.monitoring,
AppIcons.videoCameraFront,
AppIcons.campaign
] as const
const legacyIconAliases: Record<string, string> = {
Document: AppIcons.content,
DataAnalysis: AppIcons.monitoring,
Picture: AppIcons.content,
User: AppIcons.group,
Setting: AppIcons.settings,
VideoCamera: AppIcons.content,
Menu: AppIcons.menu,
Grid: AppIcons.dashboard,
'ep:setting': AppIcons.settings,
'ep:user': AppIcons.group,
'ep:user-filled': AppIcons.group,
'ep:chat-dot-round': AppIcons.policy,
'ep:coin': AppIcons.payments,
'ep:data-line': AppIcons.monitoring,
'ep:film': AppIcons.videoCameraFront,
'ep:bell': AppIcons.campaign,
'ep:video-camera': AppIcons.content,
'ant-design:dashboard-filled': AppIcons.dashboard
}
/** 兼容历史短名与旧 Iconify 名,统一返回 Material Symbols Rounded。 */
export function normalizeAppIcon(icon?: string): string {
if (!icon) return AppIcons.menu
if (icon.startsWith('material-symbols:') || icon.startsWith('svg-icon:')) return icon
return legacyIconAliases[icon] || AppIcons.menu
}