Harden catalog admin: fix translate/quick-add, RCON sync, and confirm UX.
Local Build and Deploy / deploy (push) Successful in 1m18s
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:
1 parent
de9f837da1
commit
b52e25578d
20 files changed
+557
-216
No files matched your search
@@ -41,6 +41,7 @@ import {
|
||||
} from "@/components/ui/table";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useServerAction } from "@/hooks/use-server-action";
|
||||
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
||||
|
||||
// ── Types ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -82,6 +83,7 @@ interface BcPageDetailProps {
|
||||
|
||||
export function BcPageDetail({ page, items, canEdit }: BcPageDetailProps) {
|
||||
const { isPending, run } = useServerAction();
|
||||
const { confirm, dialog: confirmDialog } = useConfirmDialog();
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
const [editingItem, setEditingItem] = useState<BcItemData | null>(null);
|
||||
const [addingItem, setAddingItem] = useState(false);
|
||||
@@ -130,6 +132,7 @@ export function BcPageDetail({ page, items, canEdit }: BcPageDetailProps) {
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{confirmDialog}
|
||||
{/* Header */}
|
||||
<div className="flex items-center gap-3">
|
||||
<Link
|
||||
@@ -338,13 +341,13 @@ export function BcPageDetail({ page, items, canEdit }: BcPageDetailProps) {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-6 w-6 p-0 text-[var(--admin-error)] hover:text-[var(--admin-error)]"
|
||||
onClick={() => {
|
||||
if (
|
||||
!confirm(
|
||||
`Delete item "${item.catalogName}"?`,
|
||||
)
|
||||
)
|
||||
return;
|
||||
onClick={async () => {
|
||||
const ok = await confirm({
|
||||
title: "Delete BC item",
|
||||
description: `Delete item "${item.catalogName}"?`,
|
||||
confirmLabel: "Delete",
|
||||
});
|
||||
if (!ok) return;
|
||||
run(() => deleteBcItem({ id: item.id }), {
|
||||
successMessage: "Item deleted.",
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user