export interface NavigationItem { path: string; label: string; labelKey: string; hasSubmenu?: boolean; submenu?: SubMenuItem[]; icon?: string; } export interface SubMenuItem { path: string; label: string; labelKey: string; description?: string; descriptionKey?: string; icon?: string; } // 导航项配置 export const navigationConfig: Omit[] = [ { path: '/', labelKey: 'nav.home' }, { path: '/products', labelKey: 'nav.products', hasSubmenu: true, submenu: [ { path: '/products/cloud-server', labelKey: 'products.cloudServer', label: '云服务器', description: '弹性可扩展的计算服务' }, { path: '/products/storage', labelKey: 'products.cloudStorage', label: '云存储', description: '安全可靠的数据存储' }, { path: '/products/database', labelKey: 'products.cloudDatabase', label: '云数据库', description: '高性能托管数据库' }, { path: '/products/network', labelKey: 'products.networkService', label: '网络服务', description: '全球网络加速服务' } ] }, { path: '/news', labelKey: 'nav.news' }, { path: '/support', labelKey: 'nav.support' }, { path: '/about', labelKey: 'nav.about' } ]; // 语言选项配置 export interface LanguageOption { code: string; label: string; flag: string; shortCode: string; } export const languageOptions: LanguageOption[] = [ { code: 'zh-CN', label: '简体中文', flag: '🇨🇳', shortCode: '简中' }, { code: 'zh-TW', label: '繁體中文', flag: '🇹🇼', shortCode: '繁中' }, { code: 'en', label: 'English', flag: '🇺🇸', shortCode: 'EN' } ]; // 导航主题配置 export interface NavigationTheme { primary: string; primaryHover: string; secondary: string; accent: string; background: string; border: string; } export const navigationThemes = { default: { primary: 'blue-600', primaryHover: 'blue-700', secondary: 'gray-600', accent: 'blue-50', background: 'white', border: 'gray-200' }, dark: { primary: 'blue-400', primaryHover: 'blue-300', secondary: 'gray-300', accent: 'blue-900', background: 'gray-900', border: 'gray-700' } }; // 获取本地化路径的工具函数 export const getLocalizedPath = (path: string, locale: string): string => { if (locale === 'zh-CN') { return path; } return `/${locale}${path}`; }; // 检查路径是否激活的工具函数 export const isPathActive = (currentPath: string, targetPath: string): boolean => { if (targetPath === '/') { return currentPath === '/'; } return currentPath.startsWith(targetPath); };