🔧 fix(parameterComponent): remove unnecessary span element to improve code readability

🔧 fix(GenericNode): remove onClick event handler that resets filterEdge state to improve code simplicity
🔧 fix(PageComponent): add onPaneClick callback function to reset filterEdge state when clicking on the pane
This commit is contained in:
Cristhian Zanforlin Lousa 2023-09-18 23:34:12 -03:00
commit 08c83fa555
3 changed files with 13 additions and 9 deletions

View file

@ -251,7 +251,6 @@ export default function ParameterComponent({
></Handle> ></Handle>
</ShadTooltip> </ShadTooltip>
</div> </div>
<span className="text-status-red">{required ? " *" : ""}</span>
</Button> </Button>
)} )}

View file

@ -85,12 +85,7 @@ export default function GenericNode({
<div className="beta-badge-content">BETA</div> <div className="beta-badge-content">BETA</div>
</div> </div>
)} )}
<div <div className="generic-node-div-title">
className="generic-node-div-title"
onClick={() => {
setFilterEdge([]);
}}
>
<div className="generic-node-title-arrangement"> <div className="generic-node-title-arrangement">
<IconComponent <IconComponent
name={name} name={name}

View file

@ -64,8 +64,13 @@ export default function Page({
setTabsState, setTabsState,
tabId, tabId,
} = useContext(TabsContext); } = useContext(TabsContext);
const { types, reactFlowInstance, setReactFlowInstance, templates } = const {
useContext(typesContext); types,
reactFlowInstance,
setReactFlowInstance,
templates,
setFilterEdge,
} = useContext(typesContext);
const reactFlowWrapper = useRef<HTMLDivElement>(null); const reactFlowWrapper = useRef<HTMLDivElement>(null);
const { takeSnapshot } = useContext(undoRedoContext); const { takeSnapshot } = useContext(undoRedoContext);
@ -382,6 +387,10 @@ export default function Page({
[] []
); );
const onPaneClick = useCallback((flow) => {
setFilterEdge([]);
}, []);
return ( return (
<div className="flex h-full overflow-hidden"> <div className="flex h-full overflow-hidden">
{!view && <ExtraSidebar />} {!view && <ExtraSidebar />}
@ -429,6 +438,7 @@ export default function Page({
zoomOnPinch={!view} zoomOnPinch={!view}
panOnDrag={!view} panOnDrag={!view}
proOptions={{ hideAttribution: true }} proOptions={{ hideAttribution: true }}
onPaneClick={onPaneClick}
> >
<Background className="" /> <Background className="" />
{!view && ( {!view && (