From da0fdde71c1661ac4f64410d27273e72a28dc04b Mon Sep 17 00:00:00 2001 From: Daniel LaForce Date: Sat, 26 Apr 2025 21:38:56 -0600 Subject: [PATCH] fix(MiniGraph): Resolve init error, add cose layout & fullscreen features --- src/components/MiniGraph.astro | 1037 +++++++++++++++++++++++++++----- 1 file changed, 891 insertions(+), 146 deletions(-) diff --git a/src/components/MiniGraph.astro b/src/components/MiniGraph.astro index 65318f5..bf1b5ca 100644 --- a/src/components/MiniGraph.astro +++ b/src/components/MiniGraph.astro @@ -1,5 +1,5 @@ --- -// MiniGraph.astro - A standalone mini knowledge graph component +// MiniGraph.astro - A standalone mini knowledge graph component with fullscreen capability // This component is designed to work independently from the blog structure // Define props interface @@ -68,7 +68,9 @@ const nodes = [ id: slug, label: title, type: "post", - level: 0 + level: 0, + category: category, + tags: tags }, // Level 1: Tag nodes ...tags.map(tag => ({ @@ -82,7 +84,9 @@ const nodes = [ id: post.slug, label: post.data.title, type: "post", - level: 1 + level: 1, + category: post.data.category || "Uncategorized", + tags: post.data.tags || [] })), // Level 2: Related tags nodes ...relatedPostsTags.map(tag => ({ @@ -96,7 +100,9 @@ const nodes = [ id: post.slug, label: post.data.title, type: "post", - level: 2 + level: 2, + category: post.data.category || "Uncategorized", + tags: post.data.tags || [] })), // Level 2: Tags from Level 2 posts ...[...level2Tags].map(tag => ({ @@ -141,18 +147,100 @@ const edges = [ // Prepare graph data object const graphData = { nodes, edges }; + +// Define colors for categories +const predefinedColors = { + 'Kubernetes': '#326CE5', 'Docker': '#2496ED', 'DevOps': '#FF6F61', + 'Homelab': '#06B6D4', 'Networking': '#9333EA', 'Infrastructure': '#10B981', + 'Automation': '#F59E0B', 'Security': '#EF4444', 'Monitoring': '#6366F1', + 'Storage': '#8B5CF6', 'Obsidian': '#7C3AED', 'Tutorial': '#3B82F6', + 'Uncategorized': '#A0AEC0' +}; ---

Post Connections

+ + + +
+ + +
+
+
Knowledge Graph
+ +
+ +
+ +
+ + +
+
+

Node Info

+ +
+ +
+
+ Type: + Post +
+ +
+ Category: + Category +
+ +
+ Tags: +
+
+ +
+ Connections: +
    +
    + + View Content +
    +
    +
    -