Moving the rendering of property values out to their own component.

There is going to be a bunch of logic associated with it to detect what type the value is, so I am moving it out to its own component.
This commit is contained in:
Tom Alexander 2024-01-27 17:19:37 -05:00
parent f435e73ec1
commit 3f0ac05513
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -147,7 +147,14 @@ const OrgPropertiesList = (props: {
<Fragment key={key}>
<tr>
<th scope="row">{key}:</th>
<td>{JSON.stringify(value)}</td>
<td>
<OrgPropertyValue
selectNode={props.selectNode}
parentUniqueId={props.parentUniqueId}
selectedNode={props.selectedNode}
value={value}
/>
</td>
</tr>
</Fragment>
);
@ -159,8 +166,17 @@ const OrgPropertiesList = (props: {
);
};
const OrgPropertyValue = (props: {
selectNode: Function;
parentUniqueId: string;
selectedNode: string;
value: any;
}): React.ReactNode => {
return JSON.stringify(props.value);
};
function is_object(val: any): boolean {
return (val instanceof Object && !(val instanceof Array));
return val instanceof Object && !(val instanceof Array);
}
export default OrgAst;