import React, { useContext, useEffect, useState } from 'react' import { UniOrg } from "../../util/uniorg" import { getOrgText } from "../../util/webSocketFunctions" import { Button, Slide, VStack, Flex, Heading, Box, CloseButton, Text, Drawer, DrawerOverlay, DrawerHeader, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, IconButton, } from '@chakra-ui/react' import { Scrollbars } from 'react-custom-scrollbars-2' import { ChevronLeftIcon, ChevronRightIcon } from '@chakra-ui/icons' import { GraphData, NodeObject, LinkObject } from 'force-graph' import { OrgRoamNode } from '../../api' import {ThemeContext} from '../../util/themecontext' export interface SidebarProps { isOpen: boolean onClose: any openNode: string nodeById: any previewNode: NodeObject, orgText: string } const Sidebar = (props: SidebarProps) => { const { isOpen, onClose, openNode, nodeById, previewNode, orgText } = props const {highlightColor}= useContext(ThemeContext) useEffect(() => { (async () => { if (!openNode) { return } if (openNode === 'nil') { return } })() const previewRoamNode = previewNode as OrgRoamNode }, [previewNode]) //maybe want to close it when clicking outside, but not sure //const outsideClickRef = useRef(); return ( } colorScheme="white" aria-label="Close file-viewer" height={100} variant="ghost" marginRight={-2} bg="alt.100" onClick={onClose} marginTop={20} /> {previewNode.title} ( )} > ) } export default Sidebar /* {previewNode.title} */