feat(admin): server-safe StatusCard and Import hub polish
CI / check (push) Failing after 8s
CI / release (push) Skipped
CI / deploy (push) Skipped

Split OnlineUsersWidget from StatusCard, decouple ad delete button, sync badge import to ExternalTexts+WebsiteBadges, add Import section hub with cancelable SSE jobs and upload SQL option.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 15:48:21 +02:00
1 parent db957d7fb1
commit 9c4949186c
21 files changed
+576 -249

No files matched your search

@@ -209,6 +209,7 @@ export function ImportFurniClient() {
// Reorganize catalog
const [reorganizing, setReorganizing] = useState(false);
const searchRef = useRef<HTMLInputElement>(null);
const batchAbortRef = useRef<AbortController | null>(null);
// Confirmation dialogs
const [confirmBatch, setConfirmBatch] = useState(false);
@@ -484,6 +485,9 @@ export function ImportFurniClient() {
}
setBatchProgress(new Map(initialProgress));
const abort = new AbortController();
batchAbortRef.current = abort;
try {
const res = await adminFetch("/api/admin/import/furni/batch", {
method: "POST",
@@ -500,6 +504,7 @@ export function ImportFurniClient() {
})),
concurrency: 3,
}),
signal: abort.signal,
});
if (!res.ok || !res.body) {
@@ -561,10 +566,17 @@ export function ImportFurniClient() {
}
}
} catch (err) {
console.error("[Import] Batch import error:", err);
toast.error("Connection lost during batch import. Check results above.");
if ((err as Error).name === "AbortError") {
toast.info("Batch import cancelled");
} else {
console.error("[Import] Batch import error:", err);
toast.error(
"Connection lost during batch import. Check results above.",
);
}
} finally {
setBatchImporting(false);
batchAbortRef.current = null;
setSelected(new Set());
fetchStats();
}
@@ -1105,6 +1117,14 @@ export function ImportFurniClient() {
{progressStats.failed} failed
</span>
)}
<Button
variant="outline"
size="sm"
className="h-7 ml-auto"
onClick={() => batchAbortRef.current?.abort()}
>
Cancel
</Button>
</div>
<div className="max-h-[250px] overflow-y-auto space-y-0.5">
{Array.from(batchProgress.values()).map((item) => (
@@ -1425,6 +1445,16 @@ export function ImportFurniClient() {
}
</Button>
)}
{batchImporting && (
<Button
variant="outline"
size="sm"
className="h-8"
onClick={() => batchAbortRef.current?.abort()}
>
Cancel
</Button>
)}
{hasImported && (
<Button
variant="destructive"