From a0e2827e7126c2110a5d840f48fcfcdbcae70a2d Mon Sep 17 00:00:00 2001 From: limina1 Date: Tue, 17 Jun 2025 17:29:05 -0400 Subject: [PATCH] Complete profile fetching implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add profileStats reactive state to track total fetched profiles and display limit - Pass profileStats through EventNetwork -> Settings -> EventTypeConfig - Update EventTypeConfig UI to show 'X of Y fetched' format for kind 0 profiles - Profile fetching now extracts all pubkeys from loaded events first - Display limit for profiles controls visualization, not fetching This completes Phase 4 of the event types panel redesign. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/lib/components/EventTypeConfig.svelte | 6 +++++- .../navigator/EventNetwork/Settings.svelte | 4 +++- src/lib/navigator/EventNetwork/index.svelte | 5 ++++- src/routes/visualize/+page.svelte | 20 +++++++++++-------- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/lib/components/EventTypeConfig.svelte b/src/lib/components/EventTypeConfig.svelte index 8d8e17c..f42039e 100644 --- a/src/lib/components/EventTypeConfig.svelte +++ b/src/lib/components/EventTypeConfig.svelte @@ -71,6 +71,10 @@ const limit = parseInt(value); if (!isNaN(limit) && limit > 0) { visualizationConfig.updateEventLimit(kind, limit); + // Update profile stats display limit if it's kind 0 + if (kind === 0) { + profileStats = { ...profileStats, displayLimit: limit }; + } } } @@ -128,7 +132,7 @@ {#if config.kind === 0} {}, eventCounts = {}, + profileStats = { totalFetched: 0, displayLimit: 50 }, } = $props<{ count: number; totalCount: number; @@ -25,6 +26,7 @@ starVisualization?: boolean; onFetchMissing?: (ids: string[]) => void; eventCounts?: { [kind: number]: number }; + profileStats?: { totalFetched: number; displayLimit: number }; }>(); let expanded = $state(false); @@ -134,7 +136,7 @@ {#if eventTypesExpanded} - + {/if} diff --git a/src/lib/navigator/EventNetwork/index.svelte b/src/lib/navigator/EventNetwork/index.svelte index 18e4056..099ba6f 100644 --- a/src/lib/navigator/EventNetwork/index.svelte +++ b/src/lib/navigator/EventNetwork/index.svelte @@ -74,7 +74,8 @@ onupdate, onclear = () => {}, onTagExpansionChange, - onFetchMissing = () => {} + onFetchMissing = () => {}, + profileStats = { totalFetched: 0, displayLimit: 50 } } = $props<{ events?: NDKEvent[]; followListEvents?: NDKEvent[]; @@ -83,6 +84,7 @@ onclear?: () => void; onTagExpansionChange?: (depth: number, tags: string[]) => void; onFetchMissing?: (ids: string[]) => void; + profileStats?: { totalFetched: number; displayLimit: number }; }>(); // Error state @@ -1215,6 +1217,7 @@ {onFetchMissing} bind:starVisualization {eventCounts} + {profileStats} /> diff --git a/src/routes/visualize/+page.svelte b/src/routes/visualize/+page.svelte index a9964e1..dae1342 100644 --- a/src/routes/visualize/+page.svelte +++ b/src/routes/visualize/+page.svelte @@ -57,6 +57,12 @@ ? `Loading profiles: ${profileLoadingProgress.current}/${profileLoadingProgress.total}` : null ); + + // Profile stats for EventTypeConfig + let profileStats = $state<{totalFetched: number, displayLimit: number}>({ + totalFetched: 0, + displayLimit: 50 + }); /** * Fetches follow lists (kind 3) with depth expansion @@ -528,14 +534,11 @@ profileLoadingProgress = null; debug("Profile fetch complete"); - // Store the total count for display - // The limit in kind0Config now controls display, not fetch - if (typeof window !== 'undefined' && window.profileStats) { - window.profileStats = { - totalFetched: allPubkeys.size, - displayLimit: kind0Config.limit - }; - } + // Update profile stats for display + profileStats = { + totalFetched: allPubkeys.size, + displayLimit: kind0Config.limit + }; } // Step 7: Apply display limits @@ -1022,6 +1025,7 @@ onclear={clearEvents} onTagExpansionChange={handleTagExpansion} onFetchMissing={fetchMissingEvents} + {profileStats} /> {/if}