Skip to content

[FE-39] Build /admin/stats page — charts for submissions, risk distribution, verification rate #851

Description

@mftee

Overview

Administrators need an analytics dashboard to understand platform usage trends and the health of the document pipeline. This page visualises the aggregate stats from GET /api/admin/stats (BE-72) as charts and KPI cards.

Background

File to create: frontend/app/(protected)/admin/stats/page.tsx

Access: Admin role only

Charts:

  1. Document submissions over time — line chart (last 30 days, one data point per day)
  2. Risk flag distribution — horizontal bar chart showing how often each flag is triggered
  3. Document status distribution — donut chart (PENDING / VERIFIED / FLAGGED / REJECTED)
  4. Verification success rate — gauge showing % of anchor jobs that succeeded

KPI cards (top row):

  • Total documents, Total users, Avg risk score, Verification success rate

Date range filter: Apply to all charts simultaneously

Acceptance Criteria

  • All charts rendered using Recharts (already installed) or equivalent
  • Charts are responsive — fit the container width at mobile and desktop breakpoints
  • Date range filter applied as query params to GET /api/admin/stats
  • KPI cards show sparkline trend (up/down vs. previous period)
  • Charts show a loading skeleton while data is fetching

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions