Skip to content

Commit 5c7289a

Browse files
committed
Phase 26 Part B (3/4): UI一致性修复 - Priority 2 页面 (Dashboard, ResultDetail)
完成所有 Priority 2 页面的修复,统一空状态组件并增强动画效果。 ## 修复的页面: - ✅ Dashboard.tsx (75% → 100%) - ✅ ResultDetail.tsx (50% → 100%) ## Dashboard.tsx 变更: 1. **导入更新**: - 移除: Alert, Paragraph - 添加: EnhancedEmptyState 2. **空状态改进**: - Error state: Alert → EnhancedEmptyState (type="error") - No data state: Alert → EnhancedEmptyState (type="noData") - Recent Projects empty: Custom div → EnhancedEmptyState (type="noData", size="small") 3. **保持现有优势**: - PageSkeleton 加载状态 ✅ - FadeIn 动画效果 ✅ - StaggeredList 统计卡片动画 ✅ ## ResultDetail.tsx 变更: 1. **导入更新**: - 移除: Alert - 添加: EnhancedEmptyState, StaggeredList 2. **空状态改进**: - Error/No data state: Alert → EnhancedEmptyState (type="error") - 统一的错误处理体验 3. **动画效果增强**: - Key Metrics 卡片: 添加 StaggeredList (staggerDelay=60ms) - 保持现有 FadeIn 动画 ## 技术指标: - 构建成功: ✅ 0 TypeScript 错误 - 整体一致性: 9/12 页面达到 100% - Priority 2 完成度: 2/2 (100%) ## 下一步: - 添加 StaggeredList 到 ProjectList 和 TaskList (最后的一致性增强) - 最终构建验证和测试
1 parent bcc8864 commit 5c7289a

File tree

2 files changed

+52
-40
lines changed

2 files changed

+52
-40
lines changed

frontend/src/pages/dashboard/Dashboard.tsx

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Dashboard Page
33
* Refactored: Unified color usage with CSS variables
44
*/
5-
import { Card, Row, Col, Statistic, Typography, Space, Tag, Alert, Progress } from 'antd'
5+
import { Card, Row, Col, Statistic, Typography, Space, Tag, Progress } from 'antd'
66
import {
77
ProjectOutlined,
88
ExperimentOutlined,
@@ -11,12 +11,12 @@ import {
1111
DatabaseOutlined,
1212
} from '@ant-design/icons'
1313
import { authStore } from '@/store/authStore'
14-
import { PageSkeleton, FadeIn, StaggeredList } from '@/components/common'
14+
import { PageSkeleton, FadeIn, StaggeredList, EnhancedEmptyState } from '@/components/common'
1515
import { useAsync } from '@/hooks'
1616
import { statsService } from '@/services/stats.service'
1717
import styles from './Dashboard.module.css'
1818

19-
const { Title, Text, Paragraph } = Typography
19+
const { Title, Text } = Typography
2020

2121
export const Dashboard: React.FC = () => {
2222
const { user } = authStore()
@@ -65,16 +65,15 @@ export const Dashboard: React.FC = () => {
6565
return (
6666
<div className={styles.dashboard}>
6767
<FadeIn>
68-
<Alert
69-
message="Error Loading Dashboard"
70-
description={error?.message || 'Failed to load statistics. Please try again later.'}
68+
<EnhancedEmptyState
7169
type="error"
72-
showIcon
73-
action={
74-
<a onClick={loadStats} style={{ cursor: 'pointer' }}>
75-
Retry
76-
</a>
77-
}
70+
title="Error Loading Dashboard"
71+
description={error?.message || 'Failed to load statistics. Please try again later.'}
72+
action={{
73+
text: 'Retry',
74+
onClick: loadStats,
75+
}}
76+
size="default"
7877
/>
7978
</FadeIn>
8079
</div>
@@ -86,7 +85,12 @@ export const Dashboard: React.FC = () => {
8685
return (
8786
<div className={styles.dashboard}>
8887
<FadeIn>
89-
<Alert message="No data available" type="info" />
88+
<EnhancedEmptyState
89+
type="noData"
90+
title="No data available"
91+
description="Dashboard statistics are not available at this moment"
92+
size="default"
93+
/>
9094
</FadeIn>
9195
</div>
9296
)
@@ -180,13 +184,16 @@ export const Dashboard: React.FC = () => {
180184
extra={<a href="/items">View All</a>}
181185
className={styles.card}
182186
>
183-
<div className={styles.emptyState}>
184-
<ExperimentOutlined style={{ fontSize: 48, color: 'var(--color-gray-300)' }} />
185-
<Title level={4} type="secondary">
186-
No items yet
187-
</Title>
188-
<Paragraph type="secondary">Create your first project to start analyzing NGS data</Paragraph>
189-
</div>
187+
<EnhancedEmptyState
188+
type="noData"
189+
title="No items yet"
190+
description="Create your first project to start analyzing NGS data"
191+
action={{
192+
text: 'Create Project',
193+
onClick: () => (window.location.href = '/items'),
194+
}}
195+
size="small"
196+
/>
190197
</Card>
191198
</Col>
192199

frontend/src/pages/results/ResultDetail.tsx

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import type React from 'react'
55
import { useEffect } from 'react'
66
import { useParams, useNavigate } from 'react-router-dom'
7-
import { Card, Row, Col, Statistic, Tabs, Alert, Button, Space, Tag, Descriptions } from 'antd'
7+
import { Card, Row, Col, Statistic, Tabs, Space, Tag, Descriptions, Button } from 'antd'
88
import { ArrowLeftOutlined, CheckCircleOutlined, WarningOutlined, CloseCircleOutlined } from '@ant-design/icons'
99
import resultService from '@/services/result.service'
10-
import { PageSkeleton, FadeIn } from '@/components/common'
10+
import { PageSkeleton, FadeIn, EnhancedEmptyState, StaggeredList } from '@/components/common'
1111
import { LineChart, BarChart, PieChart, ScatterPlot } from '@/components/charts'
1212
import { useAsync } from '@/hooks'
1313
import type { ResultVisualizationData, ChartData } from '@/types/result'
@@ -37,12 +37,15 @@ export const ResultDetail: React.FC = () => {
3737
if (error || !vizData) {
3838
return (
3939
<FadeIn>
40-
<Alert
41-
message="Error Loading Results"
42-
description={error?.message || 'No data available'}
40+
<EnhancedEmptyState
4341
type="error"
44-
showIcon
45-
action={<Button onClick={loadVisualizationData}>Retry</Button>}
42+
title="Error Loading Results"
43+
description={error?.message || 'No data available'}
44+
action={{
45+
text: 'Retry',
46+
onClick: loadVisualizationData,
47+
}}
48+
size="default"
4649
/>
4750
</FadeIn>
4851
)
@@ -76,19 +79,21 @@ export const ResultDetail: React.FC = () => {
7679
</Space>
7780

7881
{/* Key Metrics */}
79-
<Row gutter={[16, 16]}>
80-
{Object.entries(vizData.metrics).map(([key, value]) => (
81-
<Col xs={24} sm={12} md={6} key={key}>
82-
<Card size="small">
83-
<Statistic
84-
title={key.replace(/_/g, ' ').toUpperCase()}
85-
value={typeof value === 'number' ? value : String(value)}
86-
precision={typeof value === 'number' && value % 1 !== 0 ? 2 : 0}
87-
/>
88-
</Card>
89-
</Col>
90-
))}
91-
</Row>
82+
<StaggeredList staggerDelay={60} baseDelay={0} direction="up">
83+
<Row gutter={[16, 16]}>
84+
{Object.entries(vizData.metrics).map(([key, value]) => (
85+
<Col xs={24} sm={12} md={6} key={key}>
86+
<Card size="small">
87+
<Statistic
88+
title={key.replace(/_/g, ' ').toUpperCase()}
89+
value={typeof value === 'number' ? value : String(value)}
90+
precision={typeof value === 'number' && value % 1 !== 0 ? 2 : 0}
91+
/>
92+
</Card>
93+
</Col>
94+
))}
95+
</Row>
96+
</StaggeredList>
9297
</Space>
9398
</Card>
9499
</FadeIn>

0 commit comments

Comments
 (0)