diff --git a/src/lib/navigator/EventNetwork/NodeTooltip.svelte b/src/lib/navigator/EventNetwork/NodeTooltip.svelte index 545660d..cb6f779 100644 --- a/src/lib/navigator/EventNetwork/NodeTooltip.svelte +++ b/src/lib/navigator/EventNetwork/NodeTooltip.svelte @@ -1,38 +1,128 @@
-
-
{node.title}
+ +
+
{node.type} ({node.kind})
-
- ID: {node.id} - {#if node.naddr} -
{node.naddr}
- {/if} - {#if node.nevent} -
{node.nevent}
- {/if} +
+ Author: {getAuthorTag(node)}
+ + {#if node.isContainer && getSummaryTag(node)} +
+ Summary: {truncateContent(getSummaryTag(node) || "", 200)} +
+ {/if} + {#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..6a7fa61 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 @@ -303,6 +304,11 @@ updateGraph(); } }); + + function handleTooltipClose() { + tooltipVisible = false; + selectedNodeId = null; + }
{/if}
- - \ No newline at end of file diff --git a/src/routes/visualize/+page.svelte b/src/routes/visualize/+page.svelte index c74ac8d..f1f7d33 100644 --- a/src/routes/visualize/+page.svelte +++ b/src/routes/visualize/+page.svelte @@ -79,44 +79,45 @@
-

Publication Network

- - - - {#if !loading && !error} - +
+

Publication Network

+ + + {#if !loading && !error} + + {/if} +
+ {#if !loading && !error && showSettings} - {#if showSettings} -
-
-

- Visualization Settings -

+
+
+

+ Visualization Settings +

-
- - Showing {events.length} events from {$networkFetchLimit} headers - - - -
+
+ + Showing {events.length} events from {$networkFetchLimit} headers + + +
- {/if} +
{/if} + {#if loading}
@@ -155,6 +156,6 @@
{:else} -
+
{/if}