Skip to content

feat(admin-portal): add configurable week range selector#420

Merged
mschilling merged 4 commits intomainfrom
refactor/echarts-migration
Mar 18, 2026
Merged

feat(admin-portal): add configurable week range selector#420
mschilling merged 4 commits intomainfrom
refactor/echarts-migration

Conversation

@mschilling
Copy link
Contributor

@mschilling mschilling commented Mar 18, 2026

Summary

  • Add configurable week range selector (4w / 10w / 26w / 52w) to the trends filter bar
  • weekCount converted from static value to signal, pill buttons trigger API reload
  • No backend changes — API already supported the weeks query parameter

Test plan

  • nx build admin-portal passes
  • Week selector pills render in filter bar (right-aligned)
  • Selecting a different week range reloads data from API
  • Subtitle updates to reflect selected week count
  • Active pill highlighted correctly
  • Works in light + dark mode

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.
Copilot AI review requested due to automatic review settings March 18, 2026 14:03
@mschilling mschilling self-assigned this Mar 18, 2026
@mschilling mschilling changed the title refactor(admin-portal): migrate charts to ECharts feat(admin-portal): add configurable week range selector Mar 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 + NgxEchartsDirective across the three Trends chart components.
  • Register a tree-shaken ECharts core bundle in app.config.ts and swap dependencies to echarts + 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 call subscribe()s without cancelling prior requests, so slower responses can arrive out of order and overwrite newer results (and flip isLoading unexpectedly). Consider tracking and unsubscribing the previous subscription (unsubscribing cancels HttpClient requests), or refactoring to a single stream driven by weekCount using switchMap/takeUntilDestroyed so 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.

@mschilling mschilling merged commit 3f4f8ea into main Mar 18, 2026
1 check passed
@mschilling mschilling deleted the refactor/echarts-migration branch March 18, 2026 14:10
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