From fd4edbd6a854275c10c5b21173f0875921d547d1 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Thu, 7 Oct 2021 01:42:14 +0200 Subject: feat(preview): hover links + ui upgrade --- components/Sidebar/Backlinks.tsx | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 components/Sidebar/Backlinks.tsx (limited to 'components/Sidebar/Backlinks.tsx') diff --git a/components/Sidebar/Backlinks.tsx b/components/Sidebar/Backlinks.tsx new file mode 100644 index 0000000..f899d3e --- /dev/null +++ b/components/Sidebar/Backlinks.tsx @@ -0,0 +1,55 @@ +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 ( + + + + ) + })} + + + ) +} -- cgit v1.2.3