Initial import: property management SaaS + security hardening + admin dashboard
Property Management Network — Next.js 16 (App Router), Better Auth, Drizzle ORM over PostgreSQL, Stripe, OpenAI, Resend. Includes: - Security hardening: access-control/IDOR fixes, TLS-by-default DB layer, constant-time cron auth, strict security headers, atomic AI quota gating, HTML/email output encoding, demo-backdoor disabled in production. - Superadmin dashboard at /admin (overview/MRR, server-paginated users with ban/impersonate/plan/delete, billing, platform activity + admin audit log, AI usage, system health) via the Better Auth admin plugin. - Seed/migration utility scripts under scripts/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
"use client"
|
||||
|
||||
import { formatCurrency } from "@/lib/utils"
|
||||
|
||||
const CATEGORY_COLORS: Record<string, string> = {
|
||||
repairs: "bg-amber-500",
|
||||
utilities: "bg-blue-500",
|
||||
insurance: "bg-violet-500",
|
||||
mortgage: "bg-indigo-500",
|
||||
taxes: "bg-red-500",
|
||||
management: "bg-emerald-500",
|
||||
supplies: "bg-cyan-500",
|
||||
other: "bg-white/20",
|
||||
}
|
||||
|
||||
interface Props {
|
||||
data: { category: string; amount: number }[]
|
||||
}
|
||||
|
||||
export function ExpenseBreakdownChart({ data }: Props) {
|
||||
const total = data.reduce((s, d) => s + d.amount, 0)
|
||||
if (!data.length || total === 0) return null
|
||||
|
||||
return (
|
||||
<div className="rounded-2xl border border-white/[0.06] bg-[#16161f] p-5">
|
||||
<h3 className="text-sm font-semibold text-white mb-4">Expense Breakdown <span className="text-white/30 font-normal">(6 months)</span></h3>
|
||||
|
||||
{/* Bar */}
|
||||
<div className="flex h-3 w-full overflow-hidden rounded-full mb-4">
|
||||
{data.map((d) => (
|
||||
<div
|
||||
key={d.category}
|
||||
className={`${CATEGORY_COLORS[d.category] ?? CATEGORY_COLORS.other} transition-all`}
|
||||
style={{ width: `${(d.amount / total) * 100}%` }}
|
||||
title={`${d.category}: ${formatCurrency(d.amount)}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Legend */}
|
||||
<div className="space-y-2">
|
||||
{data.map((d) => (
|
||||
<div key={d.category} className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className={`h-2.5 w-2.5 rounded-full ${CATEGORY_COLORS[d.category] ?? CATEGORY_COLORS.other}`} />
|
||||
<span className="text-xs capitalize text-white/60">{d.category}</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-xs text-white/30">{Math.round((d.amount / total) * 100)}%</span>
|
||||
<span className="text-xs font-medium text-white tabular-nums">{formatCurrency(d.amount)}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="flex items-center justify-between border-t border-white/[0.06] pt-2 mt-2">
|
||||
<span className="text-xs font-semibold text-white/50">Total</span>
|
||||
<span className="text-sm font-bold text-white tabular-nums">{formatCurrency(total)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user