cleanup: changing some frontend components

This commit is contained in:
Mose Müller 2024-02-28 10:59:28 +01:00
parent 9c6323d38f
commit 6ed6fe5be1
3 changed files with 10 additions and 20 deletions

View File

@ -238,14 +238,13 @@ export const GenericComponent = React.memo(
<ImageComponent
name={name}
parentPath={parentPath}
value={attribute.value['value']['value'] as string}
readOnly={attribute.readonly}
docString={attribute.value['value'].doc}
// Add any other specific props for the ImageComponent here
format={attribute.value['format']['value'] as string}
addNotification={addNotification}
displayName={displayName}
id={id}
addNotification={addNotification}
// Add any other specific props for the ImageComponent here
value={attribute.value['value']['value'] as string}
format={attribute.value['format']['value'] as string}
/>
);
} else if (attribute.type === 'ColouredEnum') {

View File

@ -8,7 +8,6 @@ type ImageComponentProps = {
name: string;
parentPath: string;
value: string;
readOnly: boolean;
docString: string;
format: string;
addNotification: (message: string, levelname?: LevelName) => void;
@ -35,9 +34,6 @@ export const ImageComponent = React.memo((props: ImageComponentProps) => {
return (
<div className="component imageComponent" id={id}>
{process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div>
)}
<Card>
<Card.Header
onClick={() => setOpen(!open)}
@ -52,7 +48,6 @@ export const ImageComponent = React.memo((props: ImageComponentProps) => {
{process.env.NODE_ENV === 'development' && (
<p>Render count: {renderCount.current}</p>
)}
{/* Your component JSX here */}
{format === '' && value === '' ? (
<p>No image set in the backend.</p>
) : (

View File

@ -39,15 +39,6 @@ export const MethodComponent = React.memo((props: MethodProps) => {
triggerNotification();
};
const formContent = (
<Form onSubmit={execute} ref={formRef}>
<Button className="component" variant="primary" type="submit">
{`${displayName} `}
<DocStringComponent docString={docString} />
</Button>
</Form>
);
useEffect(() => {
renderCount.current++;
});
@ -57,7 +48,12 @@ export const MethodComponent = React.memo((props: MethodProps) => {
{process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div>
)}
<div>{formContent}</div>
<Form onSubmit={execute} ref={formRef}>
<Button className="component" variant="primary" type="submit">
{`${displayName} `}
<DocStringComponent docString={docString} />
</Button>
</Form>
</div>
);
});