change(ui): added missin const

This commit is contained in:
Shekar Siri 2024-06-07 13:48:30 +02:00
parent dd4e8723bf
commit 0f5b80fe97
2 changed files with 36 additions and 35 deletions

View file

@ -56,4 +56,4 @@ function ExamplePath({ onCard }: { onCard: (card: string) => void }) {
);
}
export default ExamplePath
export default ExamplePath

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Layer, Rectangle } from 'recharts';
import {Layer, Rectangle} from 'recharts';
import NodeButton from './NodeButton';
interface CustomNodeProps {
@ -14,43 +14,44 @@ interface CustomNodeProps {
}
const CustomNode: React.FC<CustomNodeProps> = (props) => {
const { x, y, width, height, index, payload, containerWidth } = props;
const {x, y, width, height, index, payload, containerWidth} = props;
const isOut = x + width + 6 > containerWidth;
const isDemo = payload.isDemo;
return (
<Layer key={`CustomNode${index}`} style={{ cursor: 'pointer' }}>
<Rectangle x={x} y={y} width={width} height={height} fill='#394EFF' fillOpacity='1' />
return (
<Layer key={`CustomNode${index}`} style={{cursor: 'pointer'}}>
<Rectangle x={x} y={y} width={width} height={height} fill='#394EFF' fillOpacity='1'/>
{/*<foreignObject*/}
{/* x={isOut ? x - 6 : x + width + 5}*/}
{/* y={0}*/}
{/* height={48}*/}
{/* style={{ width: '150px', padding: '2px' }}*/}
{/*>*/}
{/* <NodeDropdown payload={payload} />*/}
{/*</foreignObject>*/}
{/*<foreignObject*/}
{/* x={isOut ? x - 6 : x + width + 5}*/}
{/* y={0}*/}
{/* height={48}*/}
{/* style={{ width: '150px', padding: '2px' }}*/}
{/*>*/}
{/* <NodeDropdown payload={payload} />*/}
{/*</foreignObject>*/}
{!isDemo ? (
<foreignObject
x={isOut ? x - 6 : x + width + 5}
y={y + 5}
height="25"
style={{ width: "150px", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}
>
<NodeButton payload={payload} />
</foreignObject>
) : (
<foreignObject
x={isOut ? x - 6 : x + width + 5}
y={y + 5}
height="28"
style={{ width: "70px", whiteSpace: "nowrap" }}
>
<div className={'p-1 bg-white rounded border'}>{payload.name}</div>
</foreignObject>
)}
</Layer>
);
{!isDemo ? (
<foreignObject
x={isOut ? x - 6 : x + width + 5}
y={y + 5}
height="25"
style={{width: "150px", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis"}}
>
<NodeButton payload={payload}/>
</foreignObject>
) : (
<foreignObject
x={isOut ? x - 6 : x + width + 5}
y={y + 5}
height="28"
style={{width: "70px", whiteSpace: "nowrap"}}
>
<div className={'p-1 bg-white rounded border'}>{payload.name}</div>
</foreignObject>
)}
</Layer>
);
}
export default CustomNode;