summaryrefslogtreecommitdiff
path: root/components/Sidebar
diff options
context:
space:
mode:
Diffstat (limited to 'components/Sidebar')
-rw-r--r--components/Sidebar/Backlinks.tsx9
-rw-r--r--components/Sidebar/Link.tsx8
-rw-r--r--components/Sidebar/Note.tsx8
-rw-r--r--components/Sidebar/index.tsx6
4 files changed, 28 insertions, 3 deletions
diff --git a/components/Sidebar/Backlinks.tsx b/components/Sidebar/Backlinks.tsx
index 892af8c..6a5dd00 100644
--- a/components/Sidebar/Backlinks.tsx
+++ b/components/Sidebar/Backlinks.tsx
@@ -8,7 +8,7 @@ import React from 'react'
import { ProcessedOrg } from '../../util/processOrg'
export interface BacklinksProps {
- previewNode: any
+ previewNode: NodeObject | OrgRoamNode
setPreviewNode: any
nodeById: NodeById
linksByNodeId: LinksByNodeId
@@ -16,6 +16,8 @@ export interface BacklinksProps {
setSidebarHighlightedNode: OrgRoamNode
openContextMenu: any
outline: boolean
+ attachDir: string
+ macros: { [key: string]: string }
}
import { PreviewLink } from './Link'
@@ -32,8 +34,10 @@ export const Backlinks = (props: BacklinksProps) => {
nodeByCite,
openContextMenu,
outline,
+ macros,
+ attachDir,
} = props
- const links = linksByNodeId[previewNode?.id] ?? []
+ const links = linksByNodeId[(previewNode as OrgRoamNode)?.id] ?? []
const backLinks = links
.filter((link: LinkObject) => {
@@ -69,6 +73,7 @@ export const Backlinks = (props: BacklinksProps) => {
openContextMenu={openContextMenu}
outline={outline}
noUnderline
+ {...{ attachDir, macros }}
>
{nodeById[link as string]?.title}
</PreviewLink>
diff --git a/components/Sidebar/Link.tsx b/components/Sidebar/Link.tsx
index c4eea2f..6130eb5 100644
--- a/components/Sidebar/Link.tsx
+++ b/components/Sidebar/Link.tsx
@@ -41,6 +41,8 @@ export interface LinkProps {
linksByNodeId: LinksByNodeId
isWiki?: boolean
noUnderline?: boolean
+ attachDir: string
+ macros: { [key: string]: string }
}
export interface NodeLinkProps {
@@ -138,6 +140,8 @@ export const PreviewLink = (props: LinkProps) => {
noUnderline,
linksByNodeId,
isWiki,
+ macros,
+ attachDir,
} = props
// TODO figure out how to properly type this
// see https://github.com/rehypejs/rehype-react/issues/25
@@ -148,7 +152,7 @@ export const PreviewLink = (props: LinkProps) => {
const extraNoteStyle = outline ? outlineNoteStyle : viewerNoteStyle
console.log(previewNode)
const getText = () => {
- fetch(`http://localhost:35901/file/${file}`)
+ fetch(`http://localhost:35901/node/${id}`)
.then((res) => {
return res.text()
})
@@ -290,6 +294,8 @@ export const PreviewLink = (props: LinkProps) => {
openContextMenu,
outline,
linksByNodeId,
+ macros,
+ attachDir,
}}
previewNode={nodeById[id]!}
collapse={false}
diff --git a/components/Sidebar/Note.tsx b/components/Sidebar/Note.tsx
index 62cc8ad..2b76994 100644
--- a/components/Sidebar/Note.tsx
+++ b/components/Sidebar/Note.tsx
@@ -20,6 +20,8 @@ export interface NoteProps {
openContextMenu: any
outline: boolean
collapse: boolean
+ macros?: { [key: string]: string }
+ attachDir: string
}
export const Note = (props: NoteProps) => {
@@ -35,6 +37,8 @@ export const Note = (props: NoteProps) => {
openContextMenu,
outline,
collapse,
+ macros,
+ attachDir,
} = props
const extraStyle = outline ? outlineNoteStyle : viewerNoteStyle
@@ -68,6 +72,8 @@ export const Note = (props: NoteProps) => {
collapse,
nodeById,
linksByNodeId,
+ macros,
+ attachDir,
}}
/>
<Backlinks
@@ -80,7 +86,9 @@ export const Note = (props: NoteProps) => {
setSidebarHighlightedNode,
openContextMenu,
outline,
+ attachDir,
}}
+ macros={macros || {}}
/>
</Flex>
)}
diff --git a/components/Sidebar/index.tsx b/components/Sidebar/index.tsx
index 141c26d..66728fd 100644
--- a/components/Sidebar/index.tsx
+++ b/components/Sidebar/index.tsx
@@ -49,6 +49,8 @@ export interface SidebarProps {
setFilter: any
tagColors: TagColors
setTagColors: any
+ macros?: { [key: string]: string }
+ attachDir: string
}
const Sidebar = (props: SidebarProps) => {
@@ -75,6 +77,8 @@ const Sidebar = (props: SidebarProps) => {
setFilter,
tagColors,
setTagColors,
+ macros,
+ attachDir,
} = props
const { highlightColor } = useContext(ThemeContext)
@@ -225,6 +229,8 @@ const Sidebar = (props: SidebarProps) => {
outline,
setOutline,
collapse,
+ macros,
+ attachDir,
}}
/>
</VStack>