Some checks failed
CI / Deploy (pull_request) Has been skipped
CI / go-lint (pull_request) Failing after 2s
CI / python-lint (pull_request) Failing after 11s
CI / nodejs-lint (pull_request) Failing after 2s
CI / test-go-consent (pull_request) Failing after 2s
CI / test-python-voice (pull_request) Failing after 9s
CI / test-bqas (pull_request) Failing after 8s
Adds /pitch-admin dashboard with real admin accounts (bcrypt) and full
audit attribution for every state-changing action.
Backend:
- pitch_admins + pitch_admin_sessions tables (migration 002)
- pitch_audit_logs.admin_id + target_investor_id columns
- lib/admin-auth.ts: bcryptjs hashing, single-session enforcement,
jose JWT with 'pitch-admin' audience claim, requireAdmin guard
- logAudit extended to accept admin_id and target_investor_id
- middleware.ts: gates /pitch-admin/* and /api/admin/* on the admin
cookie (with bearer-secret fallback for CLI compatibility)
- 14 API routes under /api/admin-auth and /api/admin (login, logout,
me, dashboard, investors[id] CRUD + resend, admins CRUD,
fm scenarios + assumptions PATCH)
- Existing /api/admin/{invite,investors,revoke,audit-logs} migrated
to requireAdmin and now log with admin_id + target_investor_id
- scripts/create-admin.ts CLI bootstrap (npm run admin:create)
Frontend:
- /pitch-admin/login + /pitch-admin/(authed) route group
- AdminShell with sidebar nav + StatCard + AuditLogTable components
- Dashboard with KPIs, recent logins, recent activity
- Investors list with search/filter + resend/revoke inline actions
- Investor detail with inline edit + per-investor audit timeline
- Audit log viewer with actor/action/date filters + pagination
- Financial model scenario list + per-scenario assumption editor
(categorized, inline edit, before/after diff in audit)
- Admins management (add, deactivate, reset password)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { LucideIcon } from 'lucide-react'
|
|
|
|
interface StatCardProps {
|
|
label: string
|
|
value: string | number
|
|
icon?: LucideIcon
|
|
hint?: string
|
|
accent?: 'indigo' | 'green' | 'amber' | 'rose'
|
|
}
|
|
|
|
const ACCENTS = {
|
|
indigo: 'text-indigo-400 bg-indigo-500/10 border-indigo-500/20',
|
|
green: 'text-green-400 bg-green-500/10 border-green-500/20',
|
|
amber: 'text-amber-400 bg-amber-500/10 border-amber-500/20',
|
|
rose: 'text-rose-400 bg-rose-500/10 border-rose-500/20',
|
|
}
|
|
|
|
export default function StatCard({ label, value, icon: Icon, hint, accent = 'indigo' }: StatCardProps) {
|
|
return (
|
|
<div className="bg-white/[0.04] border border-white/[0.06] rounded-2xl p-5">
|
|
<div className="flex items-start justify-between mb-3">
|
|
<span className="text-xs font-medium text-white/50 uppercase tracking-wider">{label}</span>
|
|
{Icon && (
|
|
<div className={`w-9 h-9 rounded-lg flex items-center justify-center border ${ACCENTS[accent]}`}>
|
|
<Icon className="w-4 h-4" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
<div className="text-3xl font-semibold text-white">{value}</div>
|
|
{hint && <div className="text-xs text-white/40 mt-1">{hint}</div>}
|
|
</div>
|
|
)
|
|
}
|