mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 23:46:19 +00:00
feat(furni-editor): sync empty public_name from furnidata name
When a furni has a matching furnidata entry with a display name but its
items_base.public_name (the DB fallback) is empty, the editor now shows a
'Sync from furnidata' button next to the Public Name field. It reuses the
generic item update (a partial { publicName } payload) to fill the DB column
from the stored furnidata name, so the read-only fallback stops being blank.
Button shows only when the entry's classname matches, the DB field is empty,
and the furnidata name is present; it disappears after the sync re-fetch.
This commit is contained in:
@@ -291,6 +291,17 @@ export const useFurniEditor = () =>
|
||||
SendMessageComposer(new FurniEditorRevertFurnidataComposer(id));
|
||||
}, []);
|
||||
|
||||
// Fill an empty items_base.public_name from the furnidata display name. Reuses
|
||||
// the generic item update (a partial { publicName } payload is accepted), so the
|
||||
// existing 'update' result path shows the toast and re-fetches the detail.
|
||||
const syncPublicName = useCallback((id: number, name: string) =>
|
||||
{
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
pendingActionRef.current = { action: 'update', itemId: id };
|
||||
SendMessageComposer(new FurniEditorUpdateComposer(id, JSON.stringify({ publicName: name })));
|
||||
}, []);
|
||||
|
||||
const importText = useCallback((id: number) =>
|
||||
{
|
||||
setLoading(true);
|
||||
@@ -323,6 +334,6 @@ export const useFurniEditor = () =>
|
||||
selectedItem, setSelectedItem, catalogItems, furniDataEntry, furniDataDiagnostic,
|
||||
interactions,
|
||||
searchItems, loadDetail, loadBySpriteId, updateItem, deleteItem, loadInteractions,
|
||||
updateFurnidata, revertFurnidata, importText, importResult
|
||||
updateFurnidata, revertFurnidata, syncPublicName, importText, importResult
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user