重写所有页面和组件:用纯 Tailwind CSS 替换 MUI 组件和图标

This commit is contained in:
雨霖铃
2026-05-22 00:51:11 +08:00
parent 1bc3ee59a0
commit e2dd5f5915
8 changed files with 763 additions and 680 deletions
+21 -34
View File
@@ -1,15 +1,17 @@
import { type ComponentType, lazy } from 'react';
import type { SvgIconProps } from '@mui/material/SvgIcon';
import type { LucideProps } from 'lucide-react';
import type { PageType } from '@/types/storage';
import { Clock } from 'lucide-react';
import StorageIcon from '@mui/icons-material/Storage';
import QrCodeIcon from '@mui/icons-material/QrCode';
import DescriptionIcon from '@mui/icons-material/Description';
import VpnKeyIcon from '@mui/icons-material/VpnKey';
import CompareArrowsIcon from '@mui/icons-material/CompareArrows';
import TransformIcon from '@mui/icons-material/Transform';
import CodeIcon from '@mui/icons-material/Code';
import ArticleIcon from '@mui/icons-material/Article';
import {
Clock,
Database,
QrCode,
FileText,
Key,
GitCompareArrows,
ArrowLeftRight,
Code,
File,
} from 'lucide-react';
export type PaletteColorKey = 'primary' | 'success' | 'warning' | 'error' | 'secondary' | 'info';
@@ -25,31 +27,16 @@ const Base64ConverterPage = lazy(() => import('@/pages/Base64Converter'));
const MarkdownToHtmlPage = lazy(() => import('@/pages/MarkdownToHtml'));
const HtmlToMarkdownPage = lazy(() => import('@/pages/HtmlToMarkdown'));
/**
* 功能配置接口
*
* 整合了路由信息和仪表盘卡片元数据,作为功能的单一事实来源
*/
export interface FeatureConfig {
/** 页面类型标识 */
key: PageType;
/** 功能名称翻译键 */
labelKey: string;
/** 功能描述翻译键 */
descriptionKey: string;
/** 主题颜色键(用于仪表盘卡片,映射到 theme.palette[key].main */
themeColorKey?: PaletteColorKey;
/** 图标组件引用(用于仪表盘卡片,按需实例化) */
icon?: ComponentType<SvgIconProps>;
/** 默认是否在仪表盘显示 */
icon?: ComponentType<LucideProps>;
defaultVisible: boolean;
/** 不同显示模式对应的组件 */
components: {
/** 弹窗模式组件 */
popup: ComponentType;
/** 侧边栏模式组件 */
sidepanel: ComponentType;
/** 标签页模式组件 */
tab: ComponentType;
};
}
@@ -84,7 +71,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:storageCleaner.title',
descriptionKey: 'features:storageCleaner.description',
themeColorKey: 'warning',
icon: StorageIcon,
icon: Database,
defaultVisible: true,
components: {
popup: StorageCleanerPage,
@@ -97,7 +84,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:qrCode.title',
descriptionKey: 'features:qrCode.description',
themeColorKey: 'success',
icon: QrCodeIcon,
icon: QrCode,
defaultVisible: true,
components: {
popup: QrCodePage,
@@ -110,7 +97,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:textStatistics.title',
descriptionKey: 'features:textStatistics.description',
themeColorKey: 'secondary',
icon: DescriptionIcon,
icon: FileText,
defaultVisible: true,
components: {
popup: TextStatisticsPage,
@@ -123,7 +110,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:jwt.title',
descriptionKey: 'features:jwt.description',
themeColorKey: 'info',
icon: VpnKeyIcon,
icon: Key,
defaultVisible: true,
components: {
popup: JwtPage,
@@ -136,7 +123,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:jsonDiff.title',
descriptionKey: 'features:jsonDiff.description',
themeColorKey: 'primary',
icon: CompareArrowsIcon,
icon: GitCompareArrows,
defaultVisible: true,
components: {
popup: JsonToolsPage,
@@ -149,7 +136,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:base64Converter.title',
descriptionKey: 'features:base64Converter.description',
themeColorKey: 'info',
icon: TransformIcon,
icon: ArrowLeftRight,
defaultVisible: true,
components: {
popup: Base64ConverterPage,
@@ -162,7 +149,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:markdownToHtml.title',
descriptionKey: 'features:markdownToHtml.description',
themeColorKey: 'secondary',
icon: CodeIcon,
icon: Code,
defaultVisible: true,
components: {
popup: MarkdownToHtmlPage,
@@ -175,7 +162,7 @@ export const FEATURES: FeatureConfig[] = [
labelKey: 'features:htmlToMarkdown.title',
descriptionKey: 'features:htmlToMarkdown.description',
themeColorKey: 'secondary',
icon: ArticleIcon,
icon: File,
defaultVisible: true,
components: {
popup: HtmlToMarkdownPage,