Refactor GenericNode component and add duration string
This commit is contained in:
parent
4bb6290f3c
commit
aa6d57d134
1 changed files with 15 additions and 4 deletions
|
|
@ -86,6 +86,18 @@ export default function GenericNode({
|
||||||
// State for outline color
|
// State for outline color
|
||||||
const isBuilding = useFlowStore((state) => state.isBuilding);
|
const isBuilding = useFlowStore((state) => state.isBuilding);
|
||||||
|
|
||||||
|
// should be empty string if no duration
|
||||||
|
// else should be `Duration: ${duration}`
|
||||||
|
const getDurationString = (duration: number | null): string => {
|
||||||
|
if (duration === null) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return `Duration: ${duration}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const durationString = getDurationString(validationStatus?.data.duration);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setNodeDescription(data.node!.description);
|
setNodeDescription(data.node!.description);
|
||||||
}, [data.node!.description]);
|
}, [data.node!.description]);
|
||||||
|
|
@ -164,8 +176,7 @@ export default function GenericNode({
|
||||||
numberOfHandles={handles}
|
numberOfHandles={handles}
|
||||||
showNode={showNode}
|
showNode={showNode}
|
||||||
openAdvancedModal={false}
|
openAdvancedModal={false}
|
||||||
onCloseAdvancedModal={() => {
|
onCloseAdvancedModal={() => {}}
|
||||||
}}
|
|
||||||
></NodeToolbarComponent>
|
></NodeToolbarComponent>
|
||||||
</NodeToolbar>
|
</NodeToolbar>
|
||||||
|
|
||||||
|
|
@ -399,12 +410,12 @@ export default function GenericNode({
|
||||||
) : (
|
) : (
|
||||||
<div className="max-h-96 overflow-auto">
|
<div className="max-h-96 overflow-auto">
|
||||||
{typeof validationStatus.params === "string"
|
{typeof validationStatus.params === "string"
|
||||||
? `Duration: ${validationStatus.data.duration}\n${validationStatus.params}`
|
? `${durationString}\n${validationStatus.params}`
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map((line, index) => (
|
.map((line, index) => (
|
||||||
<div key={index}>{line}</div>
|
<div key={index}>{line}</div>
|
||||||
))
|
))
|
||||||
: ""}
|
: durationString}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue