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

@@ -25,6 +25,7 @@ import {
reorderTreePage,
toggleCatalogPage,
} from "@/actions/catalog";
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
import { CatalogIcon } from "@/components/admin/catalog-tree";
import { Button } from "@/components/ui/button";
import {
@@ -48,8 +49,8 @@ import type { RootTab } from "@/types/catalog";
interface RootTabsProps {
tabs: RootTab[];
activeTabId: number | null;
onTabClick: (id: number) => void;
onEditTab: (id: number) => void;
onTabClick: (id: number) => void | Promise<void>;
onEditTab: (id: number) => void | Promise<void>;
onCreateRoot: () => void;
loading?: boolean;
}
@@ -62,6 +63,7 @@ export function RootTabs({
onCreateRoot,
loading,
}: RootTabsProps) {
const { confirm, dialog: confirmDialog } = useConfirmDialog();
const [activeDragId, setActiveDragId] = useState<number | null>(null);
const sensors = useSensors(
useSensor(PointerSensor, { activationConstraint: { distance: 8 } }),
@@ -112,12 +114,12 @@ export function RootTabs({
};
const handleDelete = async (tab: RootTab) => {
if (
!confirm(
`Delete root page "${tab.caption}"? Children will be reparented.`,
)
)
return;
const ok = await confirm({
title: "Delete root page",
description: `Delete root page "${tab.caption}"? Children will be reparented.`,
confirmLabel: "Delete",
});
if (!ok) return;
try {
await deleteTreePage({ pageId: tab.id, mode: "reparent" });
toast.success(`"${tab.caption}" deleted`);
@@ -132,6 +134,7 @@ export function RootTabs({
return (
<div className="flex items-center gap-1 border-b bg-muted/30 px-2 py-1.5 overflow-x-auto shrink-0">
{confirmDialog}
{loading && (
<Loader2 className="h-4 w-4 animate-spin text-muted-foreground mx-2" />
)}