diff --git a/src/components/App/SideBar/SelectedNodeView/Default/index.tsx b/src/components/App/SideBar/SelectedNodeView/Default/index.tsx index c043388f5..efdb4c80a 100644 --- a/src/components/App/SideBar/SelectedNodeView/Default/index.tsx +++ b/src/components/App/SideBar/SelectedNodeView/Default/index.tsx @@ -23,11 +23,6 @@ import { Link, Node } from '~/types' import { colors } from '~/utils/colors' import { BoostAmt } from '../../../Helper/BoostAmt' -interface SequencedNode { - node: Node - sequence: number -} - interface EdgeWithTargetNode extends Link { target_node?: Node properties?: { @@ -41,7 +36,7 @@ export const Default = () => { const audioRef = useRef(null) const { currentPlayingAudio, setCurrentPlayingAudio } = useAppStore((s) => s) const [isPlaying, setIsPlaying] = useState(false) - const [sequencedNodes, setSequencedNodes] = useState([]) + const [sequencedNodes, setSequencedNodes] = useState([]) const [boostAmount, setBoostAmount] = useState(selectedNode?.properties?.boost || 0) const getIndexByType = useSchemaStore((s) => s.getIndexByType) @@ -63,18 +58,18 @@ export const Default = () => { }) if (response) { - const nodesWithSequence = - response.edges - ?.filter( - (edge: EdgeWithTargetNode) => edge.properties?.sequence !== undefined && edge.target_node !== undefined, - ) - .map((edge: EdgeWithTargetNode) => ({ - node: edge.target_node as Node, - sequence: edge.properties?.sequence as number, - })) - .sort((a, b) => a.sequence - b.sequence) || [] - - setSequencedNodes(nodesWithSequence) + const nodesWithSequence = response.edges + ?.filter((edge: EdgeWithTargetNode) => edge.properties?.sequence !== undefined) + .map((edge: EdgeWithTargetNode) => ({ + node: edge.target, + sequence: edge.properties?.sequence as number, + })) + .sort((a, b) => a.sequence - b.sequence) + .map((i) => response.nodes.find((n) => n.ref_id === i.node)) + + const filteredNodes = nodesWithSequence.filter((i) => !!i) + + setSequencedNodes(filteredNodes as Node[]) } } } @@ -185,10 +180,10 @@ export const Default = () => { {sequencedNodes.length > 0 && ( - {sequencedNodes.map((item, idx) => ( - - {getNodeContent(item.node)} - {idx < sequencedNodes.length - 1 && } + {sequencedNodes.map((item, index) => ( + + {getNodeContent(item)} + {index < sequencedNodes.length - 1 && } ))} @@ -373,6 +368,5 @@ const StyledSequenceWrapper = styled(Flex)` const StyledLineBreak = styled.div` width: 100%; height: 1px; - background-color: ${colors.GRAY3}; margin: 8px 0; ` diff --git a/src/components/Universe/index.tsx b/src/components/Universe/index.tsx index d2a16d578..3a5ce713e 100644 --- a/src/components/Universe/index.tsx +++ b/src/components/Universe/index.tsx @@ -21,7 +21,6 @@ import { Flex } from '../common/Flex' import { outlineEffectColor } from './constants' import { Controls } from './Controls' import { initialCameraPosition } from './Controls/CameraAnimations/constants' -import { CursorTooltip } from './CursorTooltip' import { Graph } from './Graph' import { Lights } from './Lights' import { Overlay } from './Overlay' @@ -148,7 +147,6 @@ const _Universe = () => { {universeQuestionIsOpen && } {isLoading && } - )