Browse Source

fixed broken node hyperlinks

master
silberengel 7 months ago
parent
commit
f017be32a0
  1. 28
      src/lib/navigator/EventNetwork/NodeTooltip.svelte

28
src/lib/navigator/EventNetwork/NodeTooltip.svelte

@ -105,12 +105,26 @@
if (isPublicationEvent(node.kind)) { if (isPublicationEvent(node.kind)) {
return `/publication/id/${node.id}?from=visualize`; return `/publication/id/${node.id}?from=visualize`;
} }
// For tag anchor nodes, only create URLs for supported tag types
if (node.isTagAnchor && node.tagType && node.tagValue) {
// Only create URLs for supported parameters: t, n, d
if (node.tagType === 't' || node.tagType === 'n' || node.tagType === 'd') {
return `/events?${node.tagType}=${encodeURIComponent(node.tagValue)}`;
}
// For other tag types, don't create a URL
return '';
}
// For person anchor nodes, use the pubkey to create an npub // For person anchor nodes, use the pubkey to create an npub
if (node.isPersonAnchor && node.pubkey) { if (node.isPersonAnchor && node.pubkey) {
const npub = toNpub(node.pubkey); const npub = toNpub(node.pubkey);
return `/events?id=${npub}`; return `/events?id=${npub}`;
} }
return `/events?id=${node.id}`; // For regular events, use the event ID
if (node.id && !node.id.startsWith('tag-anchor-')) {
return `/events?id=${node.id}`;
}
// For other nodes, don't create a URL
return '';
} }
/** /**
@ -198,9 +212,15 @@
<div class="tooltip-content"> <div class="tooltip-content">
<!-- Title with link --> <!-- Title with link -->
<div class="tooltip-title"> <div class="tooltip-title">
<a href={getEventUrl(node)} class="tooltip-title-link"> {#if getEventUrl(node)}
{getLinkText(node)} <a href={getEventUrl(node)} class="tooltip-title-link">
</a> {getLinkText(node)}
</a>
{:else}
<span class="tooltip-title-text">
{getLinkText(node)}
</span>
{/if}
</div> </div>
<!-- Node type and kind --> <!-- Node type and kind -->

Loading…
Cancel
Save