gpt-engineer-app[bot] commited on
Commit ·
4b1a8d8
1
Parent(s): 25811ad
Changes
Browse files- src/routes/dashboard.index.tsx +52 -45
src/routes/dashboard.index.tsx
CHANGED
|
@@ -74,59 +74,66 @@ function IncidentsPage() {
|
|
| 74 |
|
| 75 |
return (
|
| 76 |
<>
|
| 77 |
-
<header className="
|
| 78 |
-
<div>
|
| 79 |
<div className="text-[10px] uppercase tracking-widest text-muted-foreground font-mono">Operations</div>
|
| 80 |
<h1 className="text-lg font-semibold">Incident Bot</h1>
|
| 81 |
</div>
|
| 82 |
-
<
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
className=
|
| 103 |
-
"w-full text-left p-3 rounded-lg border transition-colors group",
|
| 104 |
-
selectedId === i.id
|
| 105 |
-
? "bg-surface-elevated border-primary/50 shadow-[var(--shadow-glow)]"
|
| 106 |
-
: "bg-surface border-border hover:border-primary/30"
|
| 107 |
-
)}
|
| 108 |
-
>
|
| 109 |
-
<div className="flex items-start justify-between gap-2 mb-1.5">
|
| 110 |
-
<span className="font-medium text-sm leading-tight line-clamp-2">{i.title}</span>
|
| 111 |
-
<SeverityBadge severity={i.severity} />
|
| 112 |
-
</div>
|
| 113 |
-
<div className="flex items-center gap-2 text-[10px] text-muted-foreground font-mono uppercase">
|
| 114 |
<StatusDot status={i.status} />
|
| 115 |
-
<span>{i.
|
| 116 |
-
<span>
|
| 117 |
-
|
|
|
|
| 118 |
</div>
|
| 119 |
-
</
|
| 120 |
))}
|
| 121 |
-
</
|
| 122 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
</div>
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
</>
|
| 131 |
);
|
| 132 |
}
|
|
|
|
| 74 |
|
| 75 |
return (
|
| 76 |
<>
|
| 77 |
+
<header className="border-b border-border px-8 py-4 bg-surface/40 backdrop-blur flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
| 78 |
+
<div className="min-w-0">
|
| 79 |
<div className="text-[10px] uppercase tracking-widest text-muted-foreground font-mono">Operations</div>
|
| 80 |
<h1 className="text-lg font-semibold">Incident Bot</h1>
|
| 81 |
</div>
|
| 82 |
+
<div className="flex items-center gap-2 w-full sm:w-auto">
|
| 83 |
+
<Select
|
| 84 |
+
value={selectedId ?? undefined}
|
| 85 |
+
onValueChange={(v) => setSelectedId(v)}
|
| 86 |
+
disabled={loading || incidents.length === 0}
|
| 87 |
+
>
|
| 88 |
+
<SelectTrigger className="w-full sm:w-[320px]">
|
| 89 |
+
<SelectValue
|
| 90 |
+
placeholder={
|
| 91 |
+
loading
|
| 92 |
+
? "Loading reports…"
|
| 93 |
+
: incidents.length === 0
|
| 94 |
+
? "No reports yet"
|
| 95 |
+
: `Select report (${incidents.length})`
|
| 96 |
+
}
|
| 97 |
+
/>
|
| 98 |
+
</SelectTrigger>
|
| 99 |
+
<SelectContent className="max-h-[60vh]">
|
| 100 |
+
{incidents.map((i) => (
|
| 101 |
+
<SelectItem key={i.id} value={i.id}>
|
| 102 |
+
<div className="flex items-center gap-2 min-w-0">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
<StatusDot status={i.status} />
|
| 104 |
+
<span className="truncate max-w-[220px]">{i.title}</span>
|
| 105 |
+
<span className="text-[10px] uppercase tracking-wider text-muted-foreground font-mono shrink-0">
|
| 106 |
+
{i.severity}
|
| 107 |
+
</span>
|
| 108 |
</div>
|
| 109 |
+
</SelectItem>
|
| 110 |
))}
|
| 111 |
+
</SelectContent>
|
| 112 |
+
</Select>
|
| 113 |
+
<Button variant="ghost" size="icon" onClick={load} aria-label="Refresh feed">
|
| 114 |
+
<RefreshCw className="h-4 w-4" />
|
| 115 |
+
</Button>
|
| 116 |
+
<UploadDialog onCreated={(id) => setSelectedId(id)} />
|
| 117 |
</div>
|
| 118 |
+
</header>
|
| 119 |
|
| 120 |
+
<ScrollArea className="flex-1 bg-background">
|
| 121 |
+
{loading ? (
|
| 122 |
+
<div className="py-24 text-center text-muted-foreground">
|
| 123 |
+
<Loader2 className="h-5 w-5 animate-spin mx-auto" />
|
| 124 |
+
</div>
|
| 125 |
+
) : incidents.length === 0 ? (
|
| 126 |
+
<EmptyHint />
|
| 127 |
+
) : selected ? (
|
| 128 |
+
<IncidentDetail
|
| 129 |
+
incident={selected}
|
| 130 |
+
onRerun={() => rerun(selected.id)}
|
| 131 |
+
onDelete={() => remove(selected.id)}
|
| 132 |
+
/>
|
| 133 |
+
) : (
|
| 134 |
+
<DetailEmpty />
|
| 135 |
+
)}
|
| 136 |
+
</ScrollArea>
|
| 137 |
</>
|
| 138 |
);
|
| 139 |
}
|