Harden catalog admin: fix translate/quick-add, RCON sync, and confirm UX.
Local Build and Deploy / deploy (push) Successful in 1m18s

Restore broken Quick Add search, correct Translate saves to items_base and FurnitureData, reparent page deletes, sync RCON on create/toggle/BC mutations, and replace native confirms/prompts with dialogs.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-17 21:12:58 +02:00
1 parent de9f837da1
commit b52e25578d
20 files changed
+557 -216

No files matched your search

@@ -18,6 +18,7 @@ import { deleteCatalogPage, updateCatalogPage } from "@/actions/catalog";
import { CatalogImagePicker } from "@/components/admin/catalog/catalog-image-picker";
import { IconPicker } from "@/components/admin/catalog/icon-picker";
import { ImagePreview } from "@/components/admin/catalog-manager/image-preview";
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
import { CatalogIcon, LAYOUT_COLORS } from "@/components/admin/catalog-tree";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
@@ -90,6 +91,7 @@ export function CatalogPageForm({
allPages,
}: CatalogPageFormProps) {
const { isPending, run } = useServerAction();
const { confirm, dialog: confirmDialog } = useConfirmDialog();
const formRef = useRef<HTMLFormElement>(null);
const [form, setForm] = useState({
@@ -140,13 +142,18 @@ export function CatalogPageForm({
});
}
function handleDelete() {
async function handleDelete() {
const childCount = childPages.length;
const msg =
const description =
childCount > 0
? `Delete this catalog page? Its ${childCount} child page(s) will be moved to root. All items in this page will be deleted.`
? `Delete this catalog page? Its ${childCount} child page(s) will be moved to the parent. All items on this page will be deleted.`
: "Delete this catalog page and all its items?";
if (!confirm(msg)) return;
const ok = await confirm({
title: "Delete catalog page",
description,
confirmLabel: "Delete",
});
if (!ok) return;
run(() => deleteCatalogPage({ id: catalogPage.id }), {
successMessage: "Page deleted.",
redirectTo: "/admin/catalog",
@@ -157,7 +164,9 @@ export function CatalogPageForm({
LAYOUT_COLORS[form.pageLayout] || "bg-muted text-muted-foreground";
return (
<form ref={formRef} onSubmit={handleSubmit}>
<>
{confirmDialog}
<form ref={formRef} onSubmit={handleSubmit}>
<div className="grid gap-4 lg:grid-cols-3">
{/* ── Left column (2/3): tabs ─────────────────────────── */}
<div className="lg:col-span-2 space-y-4">
@@ -495,6 +504,7 @@ export function CatalogPageForm({
</div>
</div>
</form>
</>
);
}