Sets the highlight of a node to either true or false. * * @param address The address of the node to highlight * @param highlight Whether to highlight the node or not
(address: string, highlight: boolean)
| 766 | */ |
| 767 | |
| 768 | function setNodeHighlight(address: string, highlight: boolean) { |
| 769 | const node = nodesRecord[address]; |
| 770 | if (node) { |
| 771 | const newNode: Node = { |
| 772 | ...node, |
| 773 | data: { |
| 774 | ...node.data, |
| 775 | highlight: highlight, |
| 776 | }, |
| 777 | }; |
| 778 | setNodes((nodes) => { |
| 779 | const newNodes = nodes.filter((node) => node.id !== address); |
| 780 | newNodes.push(newNode); |
| 781 | return newNodes; |
| 782 | }); |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | // Adding New Address ------------------------------------------------------- |
| 787 |