From 0003ebccd4262392e19566e79ae501d929311331 Mon Sep 17 00:00:00 2001 From: limina1 Date: Wed, 23 Jul 2025 20:06:56 -0400 Subject: [PATCH] refactor: legend now using inline tailwind --- src/lib/navigator/EventNetwork/Legend.svelte | 277 +++++-------------- src/lib/navigator/EventNetwork/index.svelte | 6 +- 2 files changed, 67 insertions(+), 216 deletions(-) diff --git a/src/lib/navigator/EventNetwork/Legend.svelte b/src/lib/navigator/EventNetwork/Legend.svelte index 0e53c56..d92efb0 100644 --- a/src/lib/navigator/EventNetwork/Legend.svelte +++ b/src/lib/navigator/EventNetwork/Legend.svelte @@ -89,11 +89,14 @@ {#if expanded} -
+
-
-
-

Node Types

+
+
+

Node Types

{#if nodeTypesExpanded} @@ -104,22 +107,22 @@
{#if nodeTypesExpanded} -
    +
      {#each Object.entries(eventCounts).sort(([a], [b]) => Number(a) - Number(b)) as [kindStr, count]} {@const kind = Number(kindStr)} {@const color = getEventKindColor(kind)} {@const name = getEventKindName(kind)} - {#if count > 0} -
    • -
      + {#if (count as number) > 0} +
    • +
      - + {kind} - {name} ({count})
    • @@ -127,7 +130,7 @@ {/each} -
    • +
    • - + {#if starMode} Radial connections from centers to related events {:else} @@ -147,7 +150,7 @@ {#if showPersonNodes && personAnchors.length > 0} -
    • +
    • - + Authored by person
    • -
    • +
    • - + References person
    • @@ -179,9 +182,12 @@
-
-
tagControlsExpanded = !tagControlsExpanded}> -

Tag Anchor Controls

+
+
tagControlsExpanded = !tagControlsExpanded} + > +

Tag Anchor Controls

{#if tagControlsExpanded} @@ -200,7 +206,7 @@ showTagAnchors = !showTagAnchors; onTagSettingsChange(); }} - class="toggle-button {showTagAnchors ? 'active' : ''}" + class="px-2 py-1 border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 text-xs font-medium cursor-pointer transition-all min-w-12 hover:bg-gray-200 dark:hover:bg-gray-600 {showTagAnchors ? 'bg-blue-500 text-white border-blue-500 hover:bg-blue-600' : ''}" > {showTagAnchors ? 'ON' : 'OFF'} @@ -231,9 +237,12 @@ {#if showTags && tagAnchors.length > 0} -
-
-

Active Tag Anchors: {tagAnchors[0].type}

+
+
+

Active Tag Anchors: {tagAnchors[0].type}

{#if tagAnchorsExpanded} @@ -285,10 +294,10 @@ type="checkbox" onclick={() => { // Invert selection - toggle all tags one by one - const allTagIds = tagAnchors.map(anchor => `${anchor.type}-${anchor.label}`); + const allTagIds = tagAnchors.map((anchor: any) => `${anchor.type}-${anchor.label}`); // Process all tags - allTagIds.forEach(tagId => { + allTagIds.forEach((tagId: string) => { onTagToggle(tagId); }); }} @@ -299,23 +308,23 @@
{#each sortedAnchors as anchor} {@const tagId = `${anchor.type}-${anchor.label}`} {@const isDisabled = disabledTags.has(tagId)} @@ -406,10 +418,10 @@ type="checkbox" onclick={() => { // Invert selection - toggle all person nodes - const allPubkeys = personAnchors.map(person => person.pubkey); + const allPubkeys = personAnchors.map((person: any) => person.pubkey); // Process all persons - allPubkeys.forEach(pubkey => { + allPubkeys.forEach((pubkey: string) => { onPersonToggle(pubkey); }); }} @@ -420,13 +432,13 @@
{#each personAnchors as person} {@const isDisabled = disabledPersons.has(person.pubkey)}