Skip to content

feat: add dashboard timeframe switch and persistence#71

Open
2013256262li-droid wants to merge 1 commit intoflatlogic:masterfrom
2013256262li-droid:round1-dashboard-timeframe
Open

feat: add dashboard timeframe switch and persistence#71
2013256262li-droid wants to merge 1 commit intoflatlogic:masterfrom
2013256262li-droid:round1-dashboard-timeframe

Conversation

@2013256262li-droid
Copy link
Copy Markdown

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.

}
};

const generateChartData = (days, hasData = true) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants