Skip to content
Snippets Groups Projects

Remove edition/cloning from the Node component

Merged Loic Huder requested to merge no-edit-node into main
4 unresolved threads
Edited by Loic Huder

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
68 const [nodeSize, setNodeSize] = useState(nodeWidth);
69 45 const inExecutionMode = useStore((state) => state.inExecutionMode);
70 46 const graphInfo = useStore((state) => state.graphInfo);
71 47 const setOpenSnackbar = useStore((state) => state.setOpenSnackbar);
72 const selectedElement = useSelectedElement();
73 const [edit, setEdit] = useState(false);
74 const [labelLocal, setLabelLocal] = useState(label);
75 const [detailsL, setDetailsL] = useState(false);
76
77 const setNodeData = useNodeDataStore((state) => state.setNodeData);
78
79 useEffect(() => {
80 setNodeSize(nodeWidth);
81 setLabelLocal(label);
82 setDetailsL(details || false);
83 }, [nodeWidth, label, details, detailsL]);
  • The labelLocal state was only needed for the label edition. The rest of the states set in the useEffect may have been left-overs from previous refactorings.

    After reviewing their use, I saw that they could be removed.

  • Please register or sign in to reply
  • 217 (edit ? (
    218 <TextField
    219 label="edit node Label"
    220 multiline
    221 maxRows={4}
    222 value={labelLocal}
    223 onChange={labelChanged}
    224 variant="standard"
    225 />
    226 ) : (
    227 <div style={customTitle as React.CSSProperties}>{labelLocal}</div>
    228 ))}
    229 {!withLabel && !withImage && (
    230 <div style={customTitle as React.CSSProperties}>
    231 {label.slice(0, 1)}
    232 </div>
    • Moved this in its own component. Not too happy with the showFull/showCropped API so if you have a better idea...

      For the record, here is the desired behaviour:

      withImage withLabel Result
      true true Show image and label
      false true Show only the label
      true false Show only the image
      false false Show a cropped label
    • Yeah, might be better to have a variant prop of sorts, but good as is for now.

    • Please register or sign in to reply
  • 339 arrow
    340 placement="top"
    341 >
    342 <IconButton
    343 aria-label="exit edit mode"
    344 onClick={() => {
    345 setEdit(false);
    346 setNodeLabel();
    347 }}
    348 >
    349 <SaveIcon color="primary" />
    350 </IconButton>
    351 </Tooltip>
    352 )} */}
    353 </>
    354 )}
  • 72 72 boxShadow: '0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22)',
    73 73 },
    74 74 title: {
    75 position: 'relative',
    75 position: 'relative' as const,
  • Loic Huder requested review from @bocciare

    requested review from @bocciare

  • Loic Huder changed the description

    changed the description

  • Axel Bocciarelli approved this merge request

    approved this merge request

  • merged

  • Loic Huder mentioned in commit 3b203645

    mentioned in commit 3b203645

  • Please register or sign in to reply
    Loading