Skip to content

Add home comment analytics dashboard and backend aggregation#37

Open
BoxMars wants to merge 2 commits intomainfrom
codex/add-statistics-chart-to-homepage
Open

Add home comment analytics dashboard and backend aggregation#37
BoxMars wants to merge 2 commits intomainfrom
codex/add-statistics-chart-to-homepage

Conversation

@BoxMars
Copy link
Copy Markdown
Member

@BoxMars BoxMars commented Mar 24, 2026

Motivation

  • Surface comment growth metrics and recent top teachers/courses on the home page to help monitor activity and trends.

Description

  • Added a new UI component components/home-comment-analytics.tsx that renders weekly/monthly trend bars and top-ranked teachers/courses with localized labels and icons.
  • Implemented server-side aggregator lib/database/get-home-comment-analytics.ts which queries comment and prof_with_course, builds weekly (toWeekKey) and monthly (toMonthKey) buckets, computes top lists, and returns a HomeCommentAnalytics payload.
  • Wired the analytics section into the homepage by importing HomeCommentAnalytics and inserting it in app/page.tsx so the dashboard appears above the comment bank.
  • Added caching via unstable_cache with a 30-minute revalidate window and limited time window (last 365 days) for queries to bound DB load.

Testing

  • Ran TypeScript check with tsc --noEmit and a next build to validate types and server build, both succeeded.
  • No automated unit tests were added for the new aggregation or UI in this change.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-web-vhlv Error Error Mar 24, 2026 5:40am

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant