Refactor user detail page: split components, unify formatters
Break the 615-line UserDetail.tsx into focused sub-components (header, stat cards, activity chart, request history, open alerts) and extract shared utilities to lib/ (format, userChart, enrichRequests). Promote storage load (GB/hr) to a stat card and collapse the chart UX to a single metric picker. Add server-wide average reference line alongside the user's own on every metric, and link request titles to their Seerr pages. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Overseerr media.status codes:
|
||||
// 1=Unknown, 2=Pending, 3=Processing, 4=Partially Available, 5=Available
|
||||
const LABEL: Record<number, string> = {
|
||||
1: "Unknown",
|
||||
2: "Pending",
|
||||
3: "Processing",
|
||||
4: "Partial",
|
||||
5: "Available",
|
||||
};
|
||||
|
||||
const COLOR: Record<number, string> = {
|
||||
1: "bg-slate-700/30 text-slate-500 border-slate-600/40",
|
||||
2: "bg-yellow-500/15 text-yellow-400 border-yellow-700/40",
|
||||
3: "bg-blue-500/15 text-blue-400 border-blue-700/40",
|
||||
4: "bg-cyan-500/15 text-cyan-400 border-cyan-700/40",
|
||||
5: "bg-green-500/15 text-green-400 border-green-700/40",
|
||||
};
|
||||
|
||||
export default function StatusBadge({ status }: { status: number }) {
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium ${
|
||||
COLOR[status] ?? "bg-slate-700 text-slate-400 border-slate-600"
|
||||
}`}
|
||||
>
|
||||
{LABEL[status] ?? `Status ${status}`}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user