From beeb1bae43d34070f004b4b01be69e4e5505a387 Mon Sep 17 00:00:00 2001 From: Daniel LaForce Date: Wed, 23 Apr 2025 15:56:54 -0600 Subject: [PATCH] refactor: Integrate Knowledge Graph into blog section with tag/post nodes --- src/components/KnowledgeGraph.astro | 185 ++++++-------------- src/pages/index.astro | 262 +++++++++++++++------------- 2 files changed, 196 insertions(+), 251 deletions(-) diff --git a/src/components/KnowledgeGraph.astro b/src/components/KnowledgeGraph.astro index e795ffc..56079d0 100644 --- a/src/components/KnowledgeGraph.astro +++ b/src/components/KnowledgeGraph.astro @@ -28,26 +28,13 @@ interface Props { const { graphData, height = "60vh" } = Astro.props; -// Generate colors based on categories for nodes -const uniqueCategories = [...new Set(graphData.nodes.map(node => node.category || 'Uncategorized'))]; -const categoryColors = {}; -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' +// Define fixed colors for node types +const nodeTypeColors = { + post: 'var(--accent-secondary)', // Blue for posts + tag: 'var(--accent-primary)' // Cyan for tags }; -uniqueCategories.forEach((category, index) => { - if (predefinedColors[category]) { - categoryColors[category] = predefinedColors[category]; - } else { - const hue = (index * 137.5) % 360; - categoryColors[category] = `hsl(${hue}, 70%, 60%)`; - } -}); -// Calculate node sizes +// Calculate node sizes (Keep this logic) const nodeSizes = {}; const minSize = 20; const maxSize = 40; const degreeMap = new Map(); @@ -108,14 +95,9 @@ graphData.nodes.forEach(node => { Read Article - +
-
- - {uniqueCategories.map(category => ( - - ))} -
+ {/* Removed category filter buttons */}
- +
Legend
- {uniqueCategories.map(category => ( -
- - {category} -
- ))} +
+ + Post +
+
+ + Tag +
-