import AttrListEdit from './components/AttrListEdit.jsx'; import JsonDisplay from './components/JsonDisplay.jsx'; function ExtendedAttributesEdit({attributes, setAttributes, ...props}) { console.log("rendering with attributes: ", attributes); if (!attributes) { return
Attributes is falsy!
; } function attributeListSetter(attributeName) { return (newValue) => setAttributes((a) => { if (a === null) return a; let newList = {...a} newList[attributeName] = newValue; return newList; }); } const newAttributes = {...attributes, parent: undefined, location: undefined, contents: undefined, verbs: undefined, prepositions: undefined } let parentSnip; if (!attributes.hasOwnProperty("parent") || attributes.parent === null || attributes.parent === undefined) { parentSnip =
This object does not have a parent.
; } else { parentSnip =
The parent of this object is # { const val = e.target.value; setAttributes((a) => {return {...a, parent: Number(val) };}); }} />.
; } let locationSnip; if (!attributes.hasOwnProperty("location") || attributes.location === null || attributes.location === undefined) { locationSnip =
This object does not have a location.
; } else { locationSnip =
The location of this object is # { const val = e.target.value; setAttributes((a) => {return {...a, location: Number(val) };}); }} />.
; } return <> {parentSnip} {locationSnip} } export default ExtendedAttributesEdit;