MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / StickyNote

Function StickyNote

packages/ui/src/views/canvas/StickyNote.jsx:18–123  ·  view source on GitHub ↗
({ data })

Source from the content-addressed store, hash-verified

16import { flowContext } from '@/store/context/ReactFlowContext'
17
18const StickyNote = ({ data }) => {
19 const theme = useTheme()
20 const canvas = useSelector((state) => state.canvas)
21 const customization = useSelector((state) => state.customization)
22 const { deleteNode, duplicateNode } = useContext(flowContext)
23 const [inputParam] = data.inputParams
24
25 const [open, setOpen] = useState(false)
26
27 const handleClose = () => {
28 setOpen(false)
29 }
30
31 const handleOpen = () => {
32 setOpen(true)
33 }
34
35 const defaultColor = '#FFE770' // fallback color if data.color is not present
36 const nodeColor = data.color || defaultColor
37
38 const getBorderColor = () => {
39 if (data.selected) return theme.palette.primary.main
40 else if (customization?.isDarkMode) return theme.palette.grey[700]
41 else return theme.palette.grey[900] + 50
42 }
43
44 const getBackgroundColor = () => {
45 if (customization?.isDarkMode) {
46 return data.selected ? darken(nodeColor, 0.7) : darken(nodeColor, 0.8)
47 } else {
48 return data.selected ? lighten(nodeColor, 0.1) : lighten(nodeColor, 0.2)
49 }
50 }
51
52 return (
53 <>
54 <NodeCardWrapper
55 content={false}
56 sx={{
57 padding: 0,
58 borderColor: getBorderColor(),
59 backgroundColor: getBackgroundColor()
60 }}
61 border={false}
62 >
63 <NodeTooltip
64 open={!canvas.canvasDialogShow && open}
65 onClose={handleClose}
66 onOpen={handleOpen}
67 disableFocusListener={true}
68 title={
69 <div
70 style={{
71 background: 'transparent',
72 display: 'flex',
73 flexDirection: 'column'
74 }}
75 >

Callers

nothing calls this directly

Calls 4

duplicateNodeFunction · 0.85
deleteNodeFunction · 0.85
getBorderColorFunction · 0.70
getBackgroundColorFunction · 0.70

Tested by

no test coverage detected