diff --git a/src/lib/components/EventTypeConfig.svelte b/src/lib/components/EventTypeConfig.svelte index f42039e..662b28b 100644 --- a/src/lib/components/EventTypeConfig.svelte +++ b/src/lib/components/EventTypeConfig.svelte @@ -149,10 +149,24 @@ value={config.limit} min="1" max="1000" - class="w-16 px-2 py-1 text-xs border rounded dark:bg-gray-700 dark:border-gray-600 dark:text-white" + class="w-16 px-2 py-1 text-xs border rounded dark:bg-gray-700 dark:border-gray-600 dark:text-white {(config.kind === 30041 || config.kind === 30818) && config.showAll ? 'opacity-50' : ''}" oninput={(e) => handleLimitChange(config.kind, e.currentTarget.value)} title="Max to display" + disabled={(config.kind === 30041 || config.kind === 30818) && config.showAll} /> + + + {#if config.kind === 30041 || config.kind === 30818} + + {/if} {/if} diff --git a/src/lib/stores/visualizationConfig.ts b/src/lib/stores/visualizationConfig.ts index 4b8a78d..6c7e8e9 100644 --- a/src/lib/stores/visualizationConfig.ts +++ b/src/lib/stores/visualizationConfig.ts @@ -5,6 +5,7 @@ export interface EventKindConfig { limit: number; nestedLevels?: number; // Only for kind 30040 depth?: number; // Only for kind 3 (follow lists) + showAll?: boolean; // Only for content kinds (30041, 30818) - show all loaded content instead of limit } export interface VisualizationConfig { @@ -147,6 +148,15 @@ function createVisualizationConfig() { ), })), + // Toggle showAll for content kinds (30041, 30818) + toggleShowAllContent: (kind: number) => + update((config) => ({ + ...config, + eventConfigs: config.eventConfigs.map((ec) => + ec.kind === kind ? { ...ec, showAll: !ec.showAll } : ec, + ), + })), + // Get config for a specific kind getEventConfig: (kind: number) => { let config: EventKindConfig | undefined; diff --git a/src/lib/utils/displayLimits.ts b/src/lib/utils/displayLimits.ts index 050b0a3..ade3bde 100644 --- a/src/lib/utils/displayLimits.ts +++ b/src/lib/utils/displayLimits.ts @@ -31,8 +31,15 @@ export function filterByDisplayLimits(events: NDKEvent[], limits: DisplayLimits, const eventConfig = config?.eventConfigs.find(ec => ec.kind === kind); const limit = eventConfig?.limit; - // If there's a limit configured for this kind, check it - if (limit !== undefined) { + // Special handling for content kinds (30041, 30818) with showAll option + if ((kind === 30041 || kind === 30818) && eventConfig?.showAll) { + // Show all content events when showAll is true + result.push(event); + // Still update the count for UI display + const currentCount = kindCounts.get(kind) || 0; + kindCounts.set(kind, currentCount + 1); + } else if (limit !== undefined) { + // Normal limit checking const currentCount = kindCounts.get(kind) || 0; if (currentCount < limit) { result.push(event);