diff --git a/src/pages/AnnualReportPage.scss b/src/pages/AnnualReportPage.scss index e5839c4..5f58d7f 100644 --- a/src/pages/AnnualReportPage.scss +++ b/src/pages/AnnualReportPage.scss @@ -5,6 +5,7 @@ justify-content: center; min-height: 100%; text-align: center; + padding: 40px 24px; } .header-icon { @@ -25,6 +26,63 @@ margin: 0 0 48px; } +.report-sections { + display: flex; + flex-direction: column; + gap: 32px; + width: min(760px, 100%); +} + +.report-section { + width: 100%; + background: var(--card-bg); + border: 1px solid var(--border-color); + border-radius: 20px; + padding: 28px; + text-align: left; +} + +.section-header { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 16px; + margin-bottom: 20px; +} + +.section-title { + margin: 0; + font-size: 20px; + font-weight: 700; + color: var(--text-primary); +} + +.section-desc { + margin: 8px 0 0; + font-size: 14px; + color: var(--text-tertiary); +} + +.section-badge { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 6px 10px; + border-radius: 999px; + background: color-mix(in srgb, var(--primary) 12%, transparent); + color: var(--primary); + border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); + font-size: 12px; + font-weight: 600; + white-space: nowrap; +} + +.section-hint { + margin: 12px 0 0; + font-size: 12px; + color: var(--text-tertiary); +} + .year-grid { display: flex; flex-wrap: wrap; @@ -34,6 +92,12 @@ margin-bottom: 48px; } +.report-section .year-grid { + justify-content: flex-start; + max-width: none; + margin-bottom: 24px; +} + .year-card { width: 120px; height: 100px; @@ -104,6 +168,13 @@ opacity: 0.6; cursor: not-allowed; } + + &.secondary { + background: var(--card-bg); + color: var(--text-primary); + border: 1px solid var(--border-color); + box-shadow: none; + } } .spin { diff --git a/src/pages/AnnualReportPage.tsx b/src/pages/AnnualReportPage.tsx index 7931764..304c9b1 100644 --- a/src/pages/AnnualReportPage.tsx +++ b/src/pages/AnnualReportPage.tsx @@ -1,12 +1,15 @@ import { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' -import { Calendar, Loader2, Sparkles } from 'lucide-react' +import { Calendar, Loader2, Sparkles, Users } from 'lucide-react' import './AnnualReportPage.scss' +type YearOption = number | 'all' + function AnnualReportPage() { const navigate = useNavigate() const [availableYears, setAvailableYears] = useState([]) - const [selectedYear, setSelectedYear] = useState(null) + const [selectedYear, setSelectedYear] = useState(null) + const [selectedPairYear, setSelectedPairYear] = useState(null) const [isLoading, setIsLoading] = useState(true) const [isGenerating, setIsGenerating] = useState(false) const [loadError, setLoadError] = useState(null) @@ -23,6 +26,7 @@ function AnnualReportPage() { if (result.success && result.data && result.data.length > 0) { setAvailableYears(result.data) setSelectedYear(result.data[0]) + setSelectedPairYear(result.data[0]) } else if (!result.success) { setLoadError(result.error || '加载年度数据失败') } @@ -35,7 +39,7 @@ function AnnualReportPage() { } const handleGenerateReport = async () => { - if (!selectedYear) return + if (!selectedYear || selectedYear === 'all') return setIsGenerating(true) try { navigate(`/annual-report/view?year=${selectedYear}`) @@ -67,42 +71,97 @@ function AnnualReportPage() { ) } + const yearOptions: YearOption[] = availableYears.length > 0 + ? ['all', ...availableYears] + : [] + + const getYearLabel = (value: YearOption | null) => { + if (!value) return '' + return value === 'all' ? '全部时间' : `${value} 年` + } + return (

年度报告

选择年份,生成你的微信聊天年度回顾

-
- {availableYears.map(year => ( -
setSelectedYear(year)} - > - {year} - +
+
+
+
+

总年度报告

+

包含所有会话与消息

+
- ))} -
- +
+ {yearOptions.map(option => ( +
setSelectedYear(option)} + > + {option === 'all' ? '全部' : option} + {option === 'all' ? '时间' : '年'} +
+ ))} +
+ + + {selectedYear === 'all' ? ( +

全部时间报告功能准备中

+ ) : null} + + +
+
+
+

双人年度报告

+

选择一位好友,只看你们的私聊

+
+
+ + 私聊 +
+
+ +
+ {yearOptions.map(option => ( +
setSelectedPairYear(option)} + > + {option === 'all' ? '全部' : option} + {option === 'all' ? '时间' : '年'} +
+ ))} +
+ + +

双人年度报告入口已留出,功能在开发中

+
+
) }