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

+5 -22
View File
@@ -1,8 +1,8 @@
"use server";
import { requirePermission } from "@/lib/admin/guard";
import { db, WebsiteBadges } from "@/lib/db";
import { PERMS } from "@/lib/permissions";
import { importBadgeSynced } from "@/lib/services/import-badge";
export async function importBadgeFromRemote({
code,
@@ -14,26 +14,9 @@ export async function importBadgeFromRemote({
description: string;
}) {
await requirePermission(PERMS.ASSETS_IMPORT);
try {
const now = new Date();
await db
.insert(WebsiteBadges)
.values({
badgeKey: code,
badgeName: name,
badgeDescription: description,
createdAt: now,
updatedAt: now,
})
.onDuplicateKeyUpdate({
set: {
badgeName: name,
badgeDescription: description,
updatedAt: now,
},
});
return { ok: true as const };
} catch {
return { ok: false as const, error: "Failed to import badge" };
const result = await importBadgeSynced({ code, name, description });
if (!result.ok) {
return { ok: false as const, error: result.error };
}
return { ok: true as const };
}