feat: add dashboard timeframe switch and persistence#71
feat: add dashboard timeframe switch and persistence#712013256262li-droid wants to merge 1 commit intoflatlogic:masterfrom
Conversation
| } | ||
| }; | ||
|
|
||
| const generateChartData = (days, hasData = true) => { |
There was a problem hiding this comment.
getDashboardData() currently uses Math.random() both for the metric values and for hasData. That means the exact same timeframe can show different cards, different chart points, or even flip into the empty state after a refresh or after switching away and back. The feature request is about syncing cards/chart and persisting the selected timeframe; with this implementation the selected range persists, but the content behind it is nondeterministic and flaky to verify.
| <div className={`${s.statCardGrowth} ${isPositive ? s.statCardGrowthPositive : s.statCardGrowthNegative}`}> | ||
| {isPositive ? <ArrowUp size={14} /> : <ArrowDown size={14} />} | ||
| <span>{Math.abs(growth)}%</span> | ||
| <span className={s.statCardGrowthLabel}>vs 上期</span> |
There was a problem hiding this comment.
The existing dashboard and surrounding app are English, but this patch hardcodes Chinese strings into the new stat cards, chart labels, empty state, and growth label. That will ship a mixed-language dashboard for every current user, and it also bypasses any future localization flow because the strings are baked directly into the component. These labels need to stay in the app’s current language or be wired through a real i18n layer.
Add 7d / 30d / 90d timeframe switch on dashboard.
Sync stat cards and main chart when switching.
Persist selected timeframe after refresh.
Add empty state handling for no-data ranges.