diff --git a/src/components/furni-editor/views/FurniEditorEditView.tsx b/src/components/furni-editor/views/FurniEditorEditView.tsx index 60bd81c..ca434e0 100644 --- a/src/components/furni-editor/views/FurniEditorEditView.tsx +++ b/src/components/furni-editor/views/FurniEditorEditView.tsx @@ -199,6 +199,19 @@ export const FurniEditorEditView: FC = props => const isValid = useMemo(() => Object.keys(validation).length === 0, [ validation ]); + // Furnidata name editing only works when the furni has a matching furnidata + // entry: the server writer is edit-only and refuses classnames absent from + // furnidata (pets, custom items, …). furniDataEntry is the entry resolved by + // the server (by id); guard on it + a classname match so we never trigger the + // cryptic "Classname not found in furnidata" error on save. + const furnidataEditable = useMemo(() => + { + if(!furniDataEntry) return false; + const cn = String((furniDataEntry as { classname?: unknown }).classname ?? '').trim().toLowerCase(); + const itemCn = String(item?.itemName ?? '').trim().toLowerCase(); + return cn ? (cn === itemCn) : true; + }, [ furniDataEntry, item ]); + const handleSave = useCallback(() => { if(!isValid) return; @@ -267,24 +280,35 @@ export const FurniEditorEditView: FC = props =>
Display name & description - LIVE - { (furniName !== String(furniDataEntry?.name ?? '') || furniDescription !== String(furniDataEntry?.description ?? '')) && + { furnidataEditable + ? LIVE + : NO FURNIDATA } + { furnidataEditable && (furniName !== String(furniDataEntry?.name ?? '') || furniDescription !== String(furniDataEntry?.description ?? '')) && Unsaved }
-
-
- - setFurniName(e.target.value) } maxLength={ 256 } /> + { furnidataEditable ? ( + <> +
+
+ + setFurniName(e.target.value) } maxLength={ 256 } /> +
+
+ + setFurniDescription(e.target.value) } maxLength={ 256 } /> +
+
+ + + + + + ) : ( +
+ + This furni has no matching furnidata entry (e.g. a pet or custom item), so its display name can't be edited here. Clients fall back to the DB Public Name below.
-
- - setFurniDescription(e.target.value) } maxLength={ 256 } /> -
-
- - - - + ) }