Skip to content

feat: lead summary dashboard at /admin/leads#1

Open
brooksRoley wants to merge 1 commit into
mainfrom
feat/admin-leads-summary
Open

feat: lead summary dashboard at /admin/leads#1
brooksRoley wants to merge 1 commit into
mainfrom
feat/admin-leads-summary

Conversation

@brooksRoley

Copy link
Copy Markdown
Owner

Summary

Read-only dashboard for consulting attribution signal at /admin/leads. Reuses the existing tracker_session cookie / /login flow — no new auth surface.

  • src/middleware.ts matcher extended to /admin/:path* and /api/admin/:path*. The API path returns JSON 401 instead of redirecting to the HTML login page so client fetches see the error.
  • src/pages/api/admin/leads.ts — single roundtrip: total, last_7d vs. prior_7d, budget_set vs. unset, top 5 source breakdown.
  • src/pages/admin/leads.tsx — three stat cards + horizontal bar of top sources, forest palette.

Livelihood stream: Consulting (instrumentation — measure whether the source/UTM attribution shipped this week is producing signal).

Notes / context

The original prompt referenced a utm_source column. The actual leads table has a single source column (set by /api/consulting/leads). The dashboard groups by that. If we later split into proper UTM fields (utm_source, utm_medium, utm_campaign), the API can be updated without touching the page layout.

This PR does not touch the three Stripe / monetization prompts (consulting pricing grid, /funding Payment Links, Model Arena email gate). Those were either blocked by the LLC status, contradicted the "no monetization UI yet" preference, or required external setup (Stripe Dashboard product creation). Flagged separately in chat.

Test plan

  • Visit /admin/leads while logged out — middleware redirects to /login?from=/admin/leads
  • After login, /admin/leads renders and shows totals + 7d delta + top source bar
  • GET /api/admin/leads while logged out returns {"error":"Unauthorized"} with status 401 (not an HTML redirect)
  • GET /api/admin/leads while logged in returns the summary JSON
  • Existing /tracker still works (unchanged behavior — same cookie)

Verification before push

  • npx eslint src/middleware.ts src/pages/api/admin/leads.ts src/pages/admin/leads.tsx --max-warnings 0 — exit 0
  • npx tsc --noEmit — exit 0
  • npm test — 281/281 passing
  • npm run build/admin/leads (○ static), /api/admin/leads (ƒ function) both present, no warnings

Read-only dashboard for consulting attribution signal. Reuses the
tracker_session cookie via the existing /login flow; middleware now also
gates /admin/* and /api/admin/* (the API path returns JSON 401 instead
of redirecting to the HTML login page so fetches surface the error).

Summary covers total leads, last 7d vs. prior 7d delta, budget-set vs.
unset, and top 5 source breakdown. Column is `source` (set by the leads
form); UTM-style attribution lives in that column today.
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
zero-next Ready Ready Preview, Comment Jun 12, 2026 7:10pm

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