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

+59
View File
@@ -245,6 +245,65 @@ export async function removeFurniEntry(classname: string): Promise<boolean> {
});
}
/**
* Patch name/description on existing FurnitureData entries by classname.
* Optionally creates a minimal entry when missing.
*/
export async function patchFurniEntryNames(
updates: Array<{
classname: string;
itemType: string;
name?: string;
description?: string;
spriteId?: number;
createIfMissing?: boolean;
}>,
): Promise<{ updated: number; inserted: number }> {
if (updates.length === 0) return { updated: 0, inserted: 0 };
return withFurniDataLock(async () => {
const furniData = (await readFurniData()) as Record<
string,
{ furnitype: Array<Record<string, unknown>> }
>;
let updated = 0;
let inserted = 0;
for (const u of updates) {
const sectionKey = u.itemType === "i" ? "wallitemtypes" : "roomitemtypes";
if (!furniData[sectionKey]) furniData[sectionKey] = { furnitype: [] };
const section = furniData[sectionKey];
const idx = section.furnitype.findIndex(
(e) => e.classname === u.classname,
);
if (idx >= 0) {
const entry = { ...section.furnitype[idx] };
if (u.name !== undefined) entry.name = u.name;
if (u.description !== undefined) entry.description = u.description;
section.furnitype[idx] = entry;
updated++;
} else if (u.createIfMissing) {
section.furnitype.push({
id: u.spriteId ?? 0,
classname: u.classname,
revision: 0,
category: "unknown",
name: u.name ?? u.classname,
description: u.description ?? "",
offerid: u.spriteId ?? -1,
});
inserted++;
}
}
if (updated > 0 || inserted > 0) {
await writeFurniData(furniData as Record<string, unknown>);
}
return { updated, inserted };
});
}
export async function appendFurniEntriesBatch(
entries: Array<{ entry: Record<string, unknown>; itemType: string }>,
): Promise<void> {