refactor(Center): 全面优化个人中心模块

- 目录重命名:Dashboard → Center(匹配路由 /home/center)
- 删除遗留代码:Default.js、InvestmentPlansAndReviews.js、InvestmentCalendarChakra.js(共 2596 行)
- 创建 src/types/center.ts 类型定义(15+ 接口)
- 性能优化:
  - 创建 useCenterColors Hook 封装 7 个 useColorModeValue
  - 创建 utils/formatters.ts 提取纯函数
  - 修复 loadRealtimeQuotes 的 useCallback 依赖项
  - InvestmentPlanningCenter 添加 useMemo 缓存
- TypeScript 迁移:Center.js → Center.tsx

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zdl
2025-12-22 18:57:28 +08:00
parent c639b418f0
commit 18ba36a539
23 changed files with 658 additions and 2778 deletions

View File

@@ -0,0 +1,94 @@
/**
* EventEmptyState - 事件空状态组件
* 用于展示日历无事件时的引导提示
* 使用 Ant Design 实现
*/
import React from 'react';
import { Typography, Space, Empty } from 'antd';
import { CalendarOutlined } from '@ant-design/icons';
const { Text, Link } = Typography;
/**
* EventEmptyState Props
*/
export interface EventEmptyStateProps {
/** 空状态提示文字 */
message?: string;
/** 导航到计划列表 */
onNavigateToPlan?: () => void;
/** 导航到复盘列表 */
onNavigateToReview?: () => void;
/** 打开投资日历 */
onOpenInvestmentCalendar?: () => void;
}
/**
* EventEmptyState 组件
*/
export const EventEmptyState: React.FC<EventEmptyStateProps> = ({
message = '当天暂无事件',
onNavigateToPlan,
onNavigateToReview,
onOpenInvestmentCalendar,
}) => {
// 是否显示引导链接
const showGuide = onNavigateToPlan || onNavigateToReview || onOpenInvestmentCalendar;
// 渲染描述内容
const renderDescription = () => {
if (!showGuide) {
return <Text type="secondary">{message}</Text>;
}
return (
<Space direction="vertical" size={4} style={{ textAlign: 'center' }}>
<Text type="secondary">{message}</Text>
<Text type="secondary" style={{ fontSize: 12 }}>
{onNavigateToPlan && (
<Link
style={{ margin: '0 4px', color: '#8B5CF6' }}
onClick={onNavigateToPlan}
>
</Link>
)}
{onNavigateToPlan && onNavigateToReview && '或'}
{onNavigateToReview && (
<Link
style={{ margin: '0 4px', color: '#38A169' }}
onClick={onNavigateToReview}
>
</Link>
)}
{onOpenInvestmentCalendar && (
<>
<Link
style={{ margin: '0 4px', color: '#3182CE' }}
onClick={onOpenInvestmentCalendar}
>
</Link>
</>
)}
</Text>
</Space>
);
};
return (
<Empty
image={<CalendarOutlined style={{ fontSize: 48, color: '#d9d9d9' }} />}
imageStyle={{ height: 60 }}
description={renderDescription()}
/>
);
};
export default EventEmptyState;