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>
37 lines
1.7 KiB
TypeScript
37 lines
1.7 KiB
TypeScript
import { cn } from "@/lib/utils"
|
|
|
|
type MaintenanceStatus = "open" | "in_progress" | "resolved" | "closed"
|
|
type Priority = "low" | "medium" | "high" | "emergency"
|
|
|
|
const statusConfig: Record<MaintenanceStatus, { label: string; className: string }> = {
|
|
open: { label: "Open", className: "text-amber-400 bg-amber-500/10 border-amber-500/20" },
|
|
in_progress: { label: "In Progress", className: "text-blue-400 bg-blue-500/10 border-blue-500/20" },
|
|
resolved: { label: "Resolved", className: "text-emerald-400 bg-emerald-500/10 border-emerald-500/20" },
|
|
closed: { label: "Closed", className: "text-white/40 bg-white/5 border-white/10" },
|
|
}
|
|
|
|
const priorityConfig: Record<Priority, { label: string; className: string }> = {
|
|
low: { label: "Low", className: "text-white/40 bg-white/5 border-white/10" },
|
|
medium: { label: "Medium", className: "text-amber-400 bg-amber-500/10 border-amber-500/20" },
|
|
high: { label: "High", className: "text-orange-400 bg-orange-500/10 border-orange-500/20" },
|
|
emergency: { label: "Emergency", className: "text-red-400 bg-red-500/10 border-red-500/20" },
|
|
}
|
|
|
|
export function MaintenanceStatusBadge({ status }: { status: MaintenanceStatus }) {
|
|
const { label, className } = statusConfig[status] ?? statusConfig.open
|
|
return (
|
|
<span className={cn("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium", className)}>
|
|
{label}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export function PriorityBadge({ priority }: { priority: Priority }) {
|
|
const { label, className } = priorityConfig[priority] ?? priorityConfig.medium
|
|
return (
|
|
<span className={cn("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium", className)}>
|
|
{label}
|
|
</span>
|
|
)
|
|
}
|