From 0efef3cebf9e475a12f94d6cab45699e2ef78d5f Mon Sep 17 00:00:00 2001 From: Tuan Cao Date: Mon, 18 Apr 2022 16:37:59 +0700 Subject: [PATCH] ... --- components/MDContent.js | 6 +++--- lib/transformer.js | 2 +- lib/utils.js | 15 +++++++++++---- pages/note/[id].js | 15 +++++++++++++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/components/MDContent.js b/components/MDContent.js index 380dee5..7b55019 100644 --- a/components/MDContent.js +++ b/components/MDContent.js @@ -14,12 +14,12 @@ function BackLinks({linkList}) {
{linkList.map(aLink =>
- - + {/**/} +

{aLink.title}

{aLink.shortSummary}

- + {/**/}
)}
diff --git a/lib/transformer.js b/lib/transformer.js index 029837f..7f1b0a0 100644 --- a/lib/transformer.js +++ b/lib/transformer.js @@ -42,7 +42,7 @@ export const Transformer = { // permalink = permalink.replace("ç", "c").replace("ı", "i").replace("ş", "s") // console.log(`/note/${toSlug(result)}`) if (result === undefined || result.length === 0) { - console.log("Cannot resolve file path " + pageName) + // console.log("Cannot resolve file path " + pageName) } // console.log("Internal Link resolved: [" + pageName + "] ==> [" + temp[0] +"]") diff --git a/lib/utils.js b/lib/utils.js index b521d7d..f561a26 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -106,7 +106,7 @@ export function constructGraphData() { } nodes.push(aNode) - console.log("Constructing graph for node: " + aFilePath ) + // console.log("Constructing graph for node: " + aFilePath ) const internalLinks = Transformer.getInternalLinks(aFilePath) internalLinks.forEach(aLink => { @@ -117,10 +117,10 @@ export function constructGraphData() { target: aLink.slug, } edges.push(anEdge) - console.log("Source: " + anEdge.source) - console.log("Target: " + anEdge.target) + // console.log("Source: " + anEdge.source) + // console.log("Target: " + anEdge.target) }) - console.log("==============Constructing graph" ) + // console.log("==============Constructing graph" ) } ) @@ -170,8 +170,15 @@ export function getLocalGraphData(currentNodeId) { const localNodes = newNodes.filter(aNode => localNodeIds.includes(aNode.data.id)) var localEdges = newEdges.filter(edge => localNodeIds.includes(edge.data.source)).filter(edge => localNodeIds.includes(edge.data.target)) + localEdges.forEach(edge => { + if (edge.data.target === '/') { + console.log(edge.data.target) + } + + }) // Filter self-reference edges localEdges = localEdges.filter(edge => edge.data.source !== edge.data.target) + localEdges = localEdges.filter(edge => edge.data.target !== '/') return { nodes: localNodes, edges: localEdges diff --git a/pages/note/[id].js b/pages/note/[id].js index c575f58..510e61b 100644 --- a/pages/note/[id].js +++ b/pages/note/[id].js @@ -10,7 +10,7 @@ import { import FolderTree from "../../components/FolderTree"; import {getFlattenArray} from "../../lib/utils"; import MDContent from "../../components/MDContent"; - +// import import dynamic from 'next/dynamic' const DynamicGraph = dynamic( @@ -19,6 +19,17 @@ const DynamicGraph = dynamic( ) export default function Home({note, backLinks, fileNames, tree, flattenNodes, graphData}) { + + // const router = useRouter(); + // + // useEffect(() => { + // if (isMenuOpen) { + // setMenuOpen(!isMenuOpen); + // } + // }, [router.asPath]); + // + + return ( @@ -29,7 +40,7 @@ export default function Home({note, backLinks, fileNames, tree, flattenNodes, gr - +