From 671afb4dc4214e7d916479d6a55e74c5c05ef618 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Mon, 26 Jul 2021 19:46:25 +0200 Subject: fixed most typeerrors --- components/config.ts | 4 ++-- pages/_app.tsx | 5 +++-- pages/index.tsx | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/components/config.ts b/components/config.ts index 2153445..80f89d1 100644 --- a/components/config.ts +++ b/components/config.ts @@ -45,8 +45,8 @@ export const initialPhysics = { highlightLinkSize: 2, highlightAnim: false, animationSpeed: 250, - algorithms: options, - algorithmOptions: algorithms, + algorithms: algorithms, + algorithmOptions: options, algorithmName: 'CubicOut', orphans: false, follow: 'Local', diff --git a/pages/_app.tsx b/pages/_app.tsx index e6332de..c9dc93f 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -44,7 +44,7 @@ function MyApp({ Component, pageProps }: AppProps) { const theme = useMemo(() => { const borderColor = emacsTheme.violet + 'aa' const bgfgInterpolate = d3int.interpolate(emacsTheme.bg, emacsTheme.fg) - return extendTheme({ + const themeColors = { colors: { white: emacsTheme.bg, black: emacsTheme.fg, @@ -98,7 +98,8 @@ function MyApp({ Component, pageProps }: AppProps) { shadows: { outline: '0 0 0 3px ' + borderColor, }, - }) + } + return extendTheme(themeColors) }, [JSON.stringify(emacsTheme)]) return ( diff --git a/pages/index.tsx b/pages/index.tsx index 00d8473..3ded283 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -357,7 +357,7 @@ export const Graph = function (props: GraphProps) { } setScope((currentScope) => ({ ...currentScope, - nodeIds: [...currentScope.nodeIds, nodeId as string], + nodeIds: [...currentScope.nodeIds, node.id as string], })) } @@ -371,7 +371,7 @@ export const Graph = function (props: GraphProps) { algorithm: physics.algorithms[physics.algorithmName], }) - const lastHoverNode = useRef() + const lastHoverNode = useRef(null) useEffect(() => { if (hoverNode) { lastHoverNode.current = hoverNode @@ -429,10 +429,10 @@ export const Graph = function (props: GraphProps) { // otherwise links with parents get shown as having one note const linklen = linksByNodeId[node.id!]?.length ?? 0 const parentCiteNeighbors = linklen - ? linksByNodeId[node.id]?.filter((link) => link.type === 'parent' || link.type === 'cite') + ? linksByNodeId[node.id!]?.filter((link) => link.type === 'parent' || link.type === 'cite') .length : 0 - const neighbors = filter.parents ? linklen : linklen - parentCiteNeighbors + const neighbors = filter.parents ? linklen : linklen - parentCiteNeighbors! return theme.colors[palette[numbereWithinRange(neighbors, 0, palette.length - 1)]][500] }, @@ -444,7 +444,7 @@ export const Graph = function (props: GraphProps) { : 0 const basicSize = 3 + links.length - (!filter.parents ? parentNeighbors : 0) if (physics.highlightAnim) { - const wasNeighbor = (link) => + const wasNeighbor = (link: OrgRoamLink) => link.source === lastHoverNode.current?.id! || link.target === lastHoverNode.current?.id! const wasHighlightedNode = links.some(wasNeighbor) const highlightSize = highlightedNodes[node.id!] -- cgit v1.2.3