From ece42f30218d275cba271a7caf3464a3a94c7f46 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Wed, 9 Apr 2025 17:53:30 +0200 Subject: [PATCH] Fix a type error. Got rid of unused style and applied a style from the main css. Implemented Svelte props. Made sure entire element is visible on page, and added a hyperlink to the publication based upon eventID. Limit content to 200 chars. --- .../navigator/EventNetwork/NodeTooltip.svelte | 66 +++++++++++++++---- src/lib/navigator/EventNetwork/index.svelte | 12 +--- 2 files changed, 57 insertions(+), 21 deletions(-) diff --git a/src/lib/navigator/EventNetwork/NodeTooltip.svelte b/src/lib/navigator/EventNetwork/NodeTooltip.svelte index 072ea96..0c40287 100644 --- a/src/lib/navigator/EventNetwork/NodeTooltip.svelte +++ b/src/lib/navigator/EventNetwork/NodeTooltip.svelte @@ -1,10 +1,17 @@
-
{node.title}
+
{node.type} ({node.isContainer ? "30040" : "30041"})
Author: {getAuthorTag(node)}
- + {#if node.content}
- {node.content} + {truncateContent(node.content)}
{/if} {#if selected} diff --git a/src/lib/navigator/EventNetwork/index.svelte b/src/lib/navigator/EventNetwork/index.svelte index 9246df3..23aa12b 100644 --- a/src/lib/navigator/EventNetwork/index.svelte +++ b/src/lib/navigator/EventNetwork/index.svelte @@ -8,6 +8,7 @@ import { createSimulation, setupDragHandlers, applyGlobalLogGravity, applyConnectedGravity } from "./utils/forceSimulation"; import Legend from "./Legend.svelte"; import NodeTooltip from "./NodeTooltip.svelte"; + import type { NetworkNode, NetworkLink } from "./types"; let { events = [] } = $props<{ events?: NDKEvent[] }>(); @@ -90,14 +91,14 @@ function updateGraph() { if (!svg || !events?.length || !svgGroup) return; - const { nodes, links } = generateGraph(events, currentLevels); + const { nodes, links } = generateGraph(events, Number(currentLevels)); if (!nodes.length) return; // Stop any existing simulation if (simulation) simulation.stop(); // Create new simulation - simulation = createSimulation(nodes, links, nodeRadius, linkDistance); + simulation = createSimulation(nodes, links, Number(nodeRadius), Number(linkDistance)); const dragHandler = setupDragHandlers(simulation); // Update links @@ -326,10 +327,3 @@
- - \ No newline at end of file