feat(admin-portal): add configurable week range selector#420
Merged
mschilling merged 4 commits intomainfrom Mar 18, 2026
Merged
feat(admin-portal): add configurable week range selector#420mschilling merged 4 commits intomainfrom
mschilling merged 4 commits intomainfrom
Conversation
Replace chart.js + ng2-charts with echarts + ngx-echarts to align with Framna's standard charting library. Tree-shakeable setup registers only LineChart, BarChart, and required components.
…tyle Prominent stat value (28px) with subtle name below. Limit "New in Top 10" to 3 visible names with "+N more" overflow to keep cards equal height.
Allow users to switch between 4, 10, 26, and 52 week views on the trends page. The API already supported the weeks parameter — this adds pill buttons to the filter bar for quick selection.
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the Admin Portal “Trends” charts from chart.js/ng2-charts to echarts via ngx-echarts, aligning chart rendering with the option-based ECharts API and updating the Trends UI with a week-range selector and redesigned Top Movers.
Changes:
- Replace Chart.js directives/config with ECharts options +
NgxEchartsDirectiveacross the three Trends chart components. - Register a tree-shaken ECharts core bundle in
app.config.tsand swap dependencies toecharts+ngx-echarts. - Add a week-range (4/10/26/52) pill selector to reload Trends data, and redesign Top Movers to a stat-card layout.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Removes chart.js/ng2-charts, adds echarts/ngx-echarts. |
| package-lock.json | Lockfile updates for the charting dependency swap. |
| apps/frontend/admin-portal/src/app/app.config.ts | Registers ECharts modules and provides provideEchartsCore. |
| apps/frontend/admin-portal/src/app/pages/trends/chart-theme.utils.ts | Replaces Chart.js defaults with shared ECharts default options and CSS-var theming helpers. |
| apps/frontend/admin-portal/src/app/pages/trends/xp-trends-chart.component.ts | Rewrites XP Trends chart rendering to ECharts options. |
| apps/frontend/admin-portal/src/app/pages/trends/rank-chart.component.ts | Rewrites Rank Movement chart rendering to ECharts options. |
| apps/frontend/admin-portal/src/app/pages/trends/activity-breakdown-chart.component.ts | Rewrites Activity Breakdown chart rendering to ECharts stacked bar options. |
| apps/frontend/admin-portal/src/app/pages/trends/top-movers.component.ts | Redesigns Top Movers presentation and adds computed helpers for newcomer display. |
| apps/frontend/admin-portal/src/app/pages/trends/trends.component.ts | Adds week selector UI + signal-based week count; reloads trends based on selection. |
Comments suppressed due to low confidence (1)
apps/frontend/admin-portal/src/app/pages/trends/trends.component.ts:213
- With the new week-range selector,
loadTrends()can be triggered repeatedly in quick succession. As written, each callsubscribe()s without cancelling prior requests, so slower responses can arrive out of order and overwrite newer results (and flipisLoadingunexpectedly). Consider tracking and unsubscribing the previous subscription (unsubscribing cancelsHttpClientrequests), or refactoring to a single stream driven byweekCountusingswitchMap/takeUntilDestroyedso only the latest request updates state.
selectWeeks(weeks: number): void {
if (weeks !== this.weekCount()) {
this.weekCount.set(weeks);
this.loadTrends();
}
}
loadTrends(): void {
this.isLoading.set(true);
this.error.set(null);
this.#trendsService.getTrends(this.weekCount()).subscribe({
next: (data) => {
this.trendsData.set(data);
this.isLoading.set(false);
},
error: (err) => {
this.error.set('Failed to load trends data. Please try again.');
this.isLoading.set(false);
console.error('Failed to load trends:', err);
},
});
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
weekCountconverted from static value to signal, pill buttons trigger API reloadweeksquery parameterTest plan
nx build admin-portalpasses