feat(analytics): add category popularity chart widget#592
Merged
A6dulmalik merged 1 commit intoJul 24, 2026
Merged
Conversation
|
@pope-h is attempting to deploy a commit to the aminubabafatima8-gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
- Add CategoryPopularityChart.tsx: horizontal bar chart ranking categories by unique users or puzzles solved, with a metric toggle and date range controls matching existing analytics widgets - Bars are re-sorted descending client-side on data/metric change - Add getCategoryPopularity API function and types to analyticsApi.ts for GET /analytics/categories/popularity
Joycejay17
force-pushed
the
feature/category-popularity-chart-573
branch
from
July 23, 2026 11:43
036fa3c to
5af90cf
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2 tasks
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.
Problem
Category popularity data isn't visualized anywhere on the analytics dashboard. Product/growth needs a way to see which puzzle categories are getting the most engagement (unique users and puzzles solved) so content investment can be prioritized. Closes #573.
Solution
Added
CategoryPopularityChart.tsx, a horizontal bar chart ranking categories by the selected metric, following the same structure/styling as the existingDauMauChartandRetentionCurveChartwidgets:rechartsBarChartwith categories on the Y-axis and the metric value on the X-axis.getCategoryPopularity()and its request/response types tolib/api/analyticsApi.ts, callingGET /analytics/categories/popularitywithstartDate/endDatequery params.Note: the backend endpoint (#529), provider (#513), and entity (#495) for
/analytics/categories/popularityare tracked as separate open issues and aren't implemented yet. This PR only covers the frontend widget, per the issue's scope ("Files to touch: frontend/src/components/analytics/CategoryPopularityChart.tsx"). The response shape consumed here ({ categoryId, categoryName, uniqueUsers, puzzlesSolved }inside the existingAnalyticsMetricResult-style envelope) mirrors the fields described in those backend issues so no rework should be needed once the endpoint lands. Until then, the widget will show its error/retry state against a live backend.As with the recently-merged
RetentionCurveChart, this component is added standalone and not yet wired intoapp/analytics/page.tsx, matching that PR's precedent.Acceptance Criteria
Testing Notes
npm --workspace frontend exec -- tsc --noEmit -p tsconfig.json— passes, no new errors.npm --workspace frontend run build— production build succeeds.npm --workspace frontend run lint— no new lint errors/warnings introduced (pre-existing errors in unrelated files untouched)./analytics) vianext devand confirmed the widget mounts, the metric toggle and date controls render, and it correctly shows its loading state during SSR with no console/render errors. Since the backend endpoint doesn't exist yet, the live data path (success/empty/sorted-bars rendering) couldn't be exercised end-to-end against real data — only the wiring, sort logic, and states around it were verified. No headless browser was available in this environment to capture a visual screenshot.