import { LinksByNodeId, NodeById } from '../../pages/index' import { GraphData, NodeObject, LinkObject } from 'force-graph' import { normalizeLinkEnds } from '../../pages/index' import { VStack, Box, Button, Heading, StackDivider } from '@chakra-ui/react' import React from 'react' import { ProcessedOrg } from '../../util/processOrg' export interface BacklinksProps { previewNode: any setPreviewNode: any nodeById: NodeById linksByNodeId: LinksByNodeId getText: any } import { PreviewLink } from './Link' export const Backlinks = (props: BacklinksProps) => { const { previewNode, setPreviewNode, nodeById, linksByNodeId, getText } = props const links = linksByNodeId[previewNode?.id] ?? [] return ( {'Backlinks (' + links.length + ')'} } align="stretch" color="gray.800" > {previewNode?.id && links.map((link: LinkObject, i: number) => { const [source, target] = normalizeLinkEnds(link) if (source === previewNode?.id) { return } return ( ) })} ) }