summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/Graph/drawLabels.ts17
-rw-r--r--components/Sidebar/Backlinks.tsx2
-rw-r--r--components/Sidebar/Link.tsx17
-rw-r--r--components/Sidebar/Note.tsx2
-rw-r--r--components/Sidebar/OrgImage.tsx4
-rw-r--r--components/Sidebar/Section.tsx16
-rw-r--r--components/Sidebar/Title.tsx1
-rw-r--r--components/Sidebar/Toolbar.tsx12
8 files changed, 29 insertions, 42 deletions
diff --git a/components/Graph/drawLabels.ts b/components/Graph/drawLabels.ts
index fa19270..46790e6 100644
--- a/components/Graph/drawLabels.ts
+++ b/components/Graph/drawLabels.ts
@@ -1,8 +1,10 @@
import { OrgRoamNode } from '../../api'
import { NodeObject } from 'force-graph'
import { initialVisuals } from '../config'
-import { hexToRGBA, LinksByNodeId } from '../../pages'
+import { LinksByNodeId } from '../../pages'
import wrap from 'word-wrap'
+import { nodeSize } from '../../util/nodeSize'
+import { hexToRGBA } from '../../util/hexToRGBA'
export interface drawLabelsProps {
labelBackgroundColor: string
@@ -14,7 +16,6 @@ export interface drawLabelsProps {
previouslyHighlightedNodes: { [id: string]: {} }
visuals: typeof initialVisuals
opacity: number
- nodeSize: (node: NodeObject) => number
filteredLinksByNodeId: LinksByNodeId
nodeRel: number
hoverNode: NodeObject | null
@@ -44,7 +45,6 @@ export function drawLabels(props: drawLabelsProps) {
previouslyHighlightedNodes,
visuals,
opacity,
- nodeSize,
filteredLinksByNodeId,
nodeRel,
hoverNode,
@@ -78,7 +78,16 @@ export function drawLabels(props: drawLabelsProps) {
const label = nodeTitle.substring(0, visuals.labelLength)
const nodeS = Math.cbrt(
- (visuals.nodeRel * nodeSize(node)) / Math.pow(globalScale, visuals.nodeZoomSize),
+ (visuals.nodeRel *
+ nodeSize({
+ node,
+ highlightedNodes,
+ linksByNodeId: filteredLinksByNodeId,
+ opacity,
+ previouslyHighlightedNodes,
+ visuals,
+ })) /
+ Math.pow(globalScale, visuals.nodeZoomSize),
)
const fontSize = visuals.labelFontSize / Math.cbrt(Math.pow(globalScale, visuals.nodeZoomSize))
// ? Math.max((visuals.labelFontSize * nodeS) / 2, (visuals.labelFontSize * nodeS) / 3)
diff --git a/components/Sidebar/Backlinks.tsx b/components/Sidebar/Backlinks.tsx
index 0bbf415..5a8f6fc 100644
--- a/components/Sidebar/Backlinks.tsx
+++ b/components/Sidebar/Backlinks.tsx
@@ -2,7 +2,6 @@ import { LinksByNodeId, NodeByCite, 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'
@@ -24,6 +23,7 @@ export interface BacklinksProps {
import { PreviewLink } from './Link'
import { OrgRoamNode } from '../../api'
import { Section } from './Section'
+import { normalizeLinkEnds } from '../../util/normalizeLinkEnds'
export const Backlinks = (props: BacklinksProps) => {
const {
diff --git a/components/Sidebar/Link.tsx b/components/Sidebar/Link.tsx
index 2f1ad64..73830ce 100644
--- a/components/Sidebar/Link.tsx
+++ b/components/Sidebar/Link.tsx
@@ -14,17 +14,17 @@ import {
Text,
useTheme,
} from '@chakra-ui/react'
-import React, { ReactElement, useContext, useEffect, useMemo, useState } from 'react'
+import React, { useContext, useEffect, useMemo, useState } from 'react'
import { ProcessedOrg } from '../../util/processOrg'
-import unified from 'unified'
+// import unified from 'unified'
//import createStream from 'unified-stream'
-import uniorgParse from 'uniorg-parse'
-import uniorg2rehype from 'uniorg-rehype'
+// import uniorgParse from 'uniorg-parse'
+// import uniorg2rehype from 'uniorg-rehype'
//import highlight from 'rehype-highlight'
-import katex from 'rehype-katex'
+// import katex from 'rehype-katex'
import 'katex/dist/katex.css'
-import rehype2react from 'rehype-react'
+// import rehype2react from 'rehype-react'
import { ThemeContext } from '../../util/themecontext'
import { LinksByNodeId, NodeByCite, NodeById } from '../../pages'
@@ -63,13 +63,10 @@ export interface NormalLinkProps {
children: string
}
-import { hexToRGBA, getThemeColor } from '../../pages/index'
import { defaultNoteStyle, viewerNoteStyle, outlineNoteStyle } from './noteStyle'
-import { OrgImage } from './OrgImage'
import { Scrollbars } from 'react-custom-scrollbars-2'
import { ExternalLinkIcon } from '@chakra-ui/icons'
-import { Section } from './Section'
-import { OrgRoamLink } from '../../api'
+import { getThemeColor } from '../../util/getThemeColor'
export const NodeLink = (props: NodeLinkProps) => {
const {
diff --git a/components/Sidebar/Note.tsx b/components/Sidebar/Note.tsx
index 638b43a..3d55816 100644
--- a/components/Sidebar/Note.tsx
+++ b/components/Sidebar/Note.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import { NodeObject } from 'force-graph'
-import { NodeById, NodeByCite, LinksByNodeId, normalizeLinkEnds } from '../../pages'
+import { NodeById, NodeByCite, LinksByNodeId } from '../../pages'
import { Box, Flex } from '@chakra-ui/react'
import { UniOrg } from '../../util/uniorg'
import { Backlinks } from '../../components/Sidebar/Backlinks'
diff --git a/components/Sidebar/OrgImage.tsx b/components/Sidebar/OrgImage.tsx
index 0922834..f371f49 100644
--- a/components/Sidebar/OrgImage.tsx
+++ b/components/Sidebar/OrgImage.tsx
@@ -1,5 +1,5 @@
/* eslint-disable @next/next/no-img-element */
-import React, { useEffect, useState } from 'react'
+import React, { useState } from 'react'
import Image from 'next/image'
import path from 'path'
import { Container } from '@chakra-ui/react'
@@ -13,7 +13,7 @@ export interface OrgImageProps {
export const OrgImage = (props: OrgImageProps) => {
const { src, file } = props
- const [image, setImage] = useState<any>(null)
+ // const [image, setImage] = useState<any>(null)
/* )
* .then((res) => res.blob())
diff --git a/components/Sidebar/Section.tsx b/components/Sidebar/Section.tsx
index adaf00e..7e99f4f 100644
--- a/components/Sidebar/Section.tsx
+++ b/components/Sidebar/Section.tsx
@@ -1,17 +1,7 @@
-import { Box, Collapse, Flex, IconButton } from '@chakra-ui/react'
-import React, {
- JSXElementConstructor,
- ReactChild,
- ReactElement,
- ReactNode,
- useContext,
- useEffect,
- useState,
-} from 'react'
-import { BiCaretDownCircle, BiChevronDownCircle, BiCircle } from 'react-icons/bi'
-import { ComponentLike, ComponentPropsWithoutNode } from 'rehype-react'
+import { Box, Flex, IconButton } from '@chakra-ui/react'
+import React, { ReactChild, useContext, useEffect, useState } from 'react'
import { VscCircleFilled, VscCircleOutline } from 'react-icons/vsc'
-import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon } from '@chakra-ui/icons'
+import { ChevronDownIcon, ChevronUpIcon } from '@chakra-ui/icons'
import { NoteContext } from '../../util/NoteContext'
export interface SectionProps {
diff --git a/components/Sidebar/Title.tsx b/components/Sidebar/Title.tsx
index 2c8d8b7..791cbb8 100644
--- a/components/Sidebar/Title.tsx
+++ b/components/Sidebar/Title.tsx
@@ -1,6 +1,5 @@
import { Flex, Heading } from '@chakra-ui/react'
import React from 'react'
-import { BiFile } from 'react-icons/bi'
import { OrgRoamNode } from '../../api'
export interface TitleProps {
diff --git a/components/Sidebar/Toolbar.tsx b/components/Sidebar/Toolbar.tsx
index 71f3807..f606837 100644
--- a/components/Sidebar/Toolbar.tsx
+++ b/components/Sidebar/Toolbar.tsx
@@ -1,17 +1,9 @@
import React from 'react'
-import { Text, Flex, IconButton, ButtonGroup, Tooltip } from '@chakra-ui/react'
-import {
- BiAlignJustify,
- BiAlignLeft,
- BiAlignMiddle,
- BiAlignRight,
- BiFont,
- BiRightIndent,
-} from 'react-icons/bi'
+import { Flex, IconButton, ButtonGroup, Tooltip } from '@chakra-ui/react'
+import { BiAlignJustify, BiAlignLeft, BiAlignMiddle, BiAlignRight } from 'react-icons/bi'
import { MdOutlineExpand, MdOutlineCompress } from 'react-icons/md'
import { ChevronLeftIcon, ChevronRightIcon } from '@chakra-ui/icons'
import { IoIosListBox, IoMdListBox } from 'react-icons/io'
-import { NodeObject } from 'force-graph'
export interface ToolbarProps {
setJustification: any