Skip to content

feat(audit): primary-domain score trend + category breakdown on the hub - #264

Merged
gkhngyk merged 2 commits into
mainfrom
feat/audit-score-trend
Jun 16, 2026
Merged

gkhngyk merged 2 commits into
mainfrom
feat/audit-score-trend

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

On first visit to the Site Audit hub, show how the active brand's primary domain score has moved over time, alongside a category breakdown — so users see their trajectory before running anything.

  • Score-over-time chart (Recharts area chart) of the primary domain's completed audits, with a 7d / 30d / 90d / All range filter (default 30d) and a delta badge (▲/▼ how much the score rose or fell across the range).
  • Category breakdown grid beside it — the 5 rubric categories (Structure / Content / Authority / E-E-A-T / Trust) for the latest audit in the selected range, with mini bars.
  • Falls back to a "run at least two audits of your homepage" hint when there aren't enough data points; hidden entirely when the domain has no audits yet.

How

  • Server: GET /api/audits/trend?brandId= returns completed audits whose URL host matches the brand's primary domain (from brand_domains), with total_score + category_scores + created_at. Registered before /:id.
  • Web: getAuditTrend action; range filtering + delta computed client-side; chart in audit/_charts.tsx (Recharts, ResizeObserver width pattern like insights).

Notes

  • The trend only becomes meaningful once the homepage is audited repeatedly — a natural follow-up is a scheduled/periodic audit of the primary domain so the chart fills in automatically. For now it plots whatever audits exist.
  • Server + web; needs a server redeploy for the new /trend route. No schema changes.

gkhngyk added 2 commits June 16, 2026 18:22
On the Site Audit hub, show the active brand's primary-domain score over time
(area chart, default 30-day range with 7d/30d/90d/All presets) plus a delta
(how much it rose/fell) and a category-breakdown grid for the latest audit in
range. Adds GET /api/audits/trend (completed primary-domain audits with
score + category_scores), a getAuditTrend action, and a Recharts chart.
The score-over-time area + line now take their color from the same score
bands used across Site Audit — green (>=70), amber (40-69), red (<40) —
driven by the overall (latest-in-range) score, instead of a fixed indigo.
@gkhngyk
gkhngyk merged commit 56c0131 into main Jun 16, 2026
3 checks passed
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.

1 participant