@@ -373,7 +389,9 @@
showPersonNodes = !showPersonNodes;
onPersonSettingsChange();
}}
+ onkeydown={(e) => e.key === 'Enter' || e.key === ' ' ? (showPersonNodes = !showPersonNodes, onPersonSettingsChange()) : null}
class="px-2 py-1 border border-gray-300 dark:border-gray-700 rounded text-xs font-medium cursor-pointer transition min-w-[3rem] hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-primary-500 {showPersonNodes ? 'bg-blue-600 text-white border-blue-600 hover:bg-blue-700 dark:bg-blue-600 dark:text-white dark:border-blue-600 dark:hover:bg-blue-700' : 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300'}"
+ aria-pressed={showPersonNodes}
>
{showPersonNodes ? 'ON' : 'OFF'}
@@ -430,37 +448,30 @@
>
{#each personAnchors as person}
{@const isDisabled = disabledPersons.has(person.pubkey)}
-
+
{/each}
- {:else if showPersonNodes}
-
- No people found in the current events.
-
{/if}
{/if}
diff --git a/src/lib/navigator/EventNetwork/Settings.svelte b/src/lib/navigator/EventNetwork/Settings.svelte
index 584834b..cd4e1e8 100644
--- a/src/lib/navigator/EventNetwork/Settings.svelte
+++ b/src/lib/navigator/EventNetwork/Settings.svelte
@@ -42,7 +42,13 @@
-
+
+
{#if expanded}
-
+
Showing {count} of {totalCount} events
@@ -63,9 +69,12 @@
-
-
+
{#if eventTypesExpanded}
-
+
+
+
{/if}
-
-
-
-
+
{#if visualSettingsExpanded}
-
-
-
-
-
- Toggle between star clusters (on) and linear sequence (off)
- visualization
-
+
+
+
+
+
+ Toggle between star clusters (on) and linear sequence (off)
+ visualization
+
+
+
-
-
-
{/if}
diff --git a/src/lib/navigator/EventNetwork/TagTable.svelte b/src/lib/navigator/EventNetwork/TagTable.svelte
index fa02295..55e603d 100644
--- a/src/lib/navigator/EventNetwork/TagTable.svelte
+++ b/src/lib/navigator/EventNetwork/TagTable.svelte
@@ -12,12 +12,12 @@
}>();
// Computed property for unique tags
- let uniqueTags = $derived(() => {
- const tagMap = new Map();
+ let uniqueTags = $derived.by(() => {
+ const tagMap = new Map
();
- events.forEach(event => {
+ events.forEach((event: NDKEvent) => {
const tags = event.tags || [];
- tags.forEach(tag => {
+ tags.forEach((tag: string[]) => {
if (tag[0] === selectedTagType) {
const tagValue = tag[1];
const count = tagMap.get(tagValue)?.count || 0;
diff --git a/src/lib/navigator/EventNetwork/utils/personNetworkBuilder.ts b/src/lib/navigator/EventNetwork/utils/personNetworkBuilder.ts
index b998703..aaafa00 100644
--- a/src/lib/navigator/EventNetwork/utils/personNetworkBuilder.ts
+++ b/src/lib/navigator/EventNetwork/utils/personNetworkBuilder.ts
@@ -293,13 +293,15 @@ export function createPersonLinks(
connectionType = 'referenced';
}
- return {
+ const link: PersonLink = {
source: anchor,
target: node,
isSequential: false,
connectionType,
};
- }).filter(Boolean); // Remove undefineds
+
+ return link;
+ }).filter((link): link is PersonLink => link !== undefined); // Remove undefineds and type guard
});
debug("Created person links", { linkCount: links.length });
diff --git a/src/lib/stores/index.ts b/src/lib/stores/index.ts
deleted file mode 100644
index 467f6e7..0000000
--- a/src/lib/stores/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './relayStore';
-export * from './displayLimits';
\ No newline at end of file
diff --git a/src/lib/utils/nostr_identifiers.ts b/src/lib/utils/nostr_identifiers.ts
index 246fc9b..8e789d7 100644
--- a/src/lib/utils/nostr_identifiers.ts
+++ b/src/lib/utils/nostr_identifiers.ts
@@ -1,9 +1,9 @@
import { VALIDATION } from './search_constants';
-import type { NostrEventId } from './nostr_identifiers';
/**
* Nostr identifier types
*/
+export type NostrEventId = string; // 64-character hex string
export type NostrCoordinate = string; // kind:pubkey:d-tag format
export type NostrIdentifier = NostrEventId | NostrCoordinate;
diff --git a/src/lib/utils/websocket_utils.ts b/src/lib/utils/websocket_utils.ts
index 9d0d382..bad0818 100644
--- a/src/lib/utils/websocket_utils.ts
+++ b/src/lib/utils/websocket_utils.ts
@@ -27,7 +27,7 @@ export async function fetchNostrEvent(filter: NostrFilter): Promise
const ws = await WebSocketPool.instance.acquire("wss://thecitadel.nostr1.com");
const subId = crypto.randomUUID();
- const res = new Promise((resolve, reject) => {
+ const res = new Promise((resolve, reject) => {
ws.addEventListener("message", (ev) => {
const data = JSON.parse(ev.data);
@@ -42,7 +42,7 @@ export async function fetchNostrEvent(filter: NostrFilter): Promise
reject(new Error(`[WebSocket Utils]: Subscription ${subId} closed`));
break;
case "EOSE":
- resolve(null);
+ reject(new Error(`[WebSocket Utils]: Event not found`));
break;
}
diff --git a/src/routes/publication/[type]/[identifier]/+layout.server.ts b/src/routes/publication/[type]/[identifier]/+layout.server.ts
index b89da64..f2c64dc 100644
--- a/src/routes/publication/[type]/[identifier]/+layout.server.ts
+++ b/src/routes/publication/[type]/[identifier]/+layout.server.ts
@@ -1,6 +1,7 @@
import { error } from "@sveltejs/kit";
import type { LayoutServerLoad } from "./$types";
-import { fetchEventByDTag, fetchEventById, fetchEventByNaddr, fetchEventByNevent, NostrEvent } from "../../../../lib/utils/websocket_utils.ts";
+import { fetchEventByDTag, fetchEventById, fetchEventByNaddr, fetchEventByNevent } from "../../../../lib/utils/websocket_utils.ts";
+import type { NostrEvent } from "../../../../lib/utils/websocket_utils.ts";
export const load: LayoutServerLoad = async ({ params, url }) => {
const { type, identifier } = params;
diff --git a/src/routes/publication/[type]/[identifier]/+page.server.ts b/src/routes/publication/[type]/[identifier]/+page.server.ts
index 18a5e41..b23adcf 100644
--- a/src/routes/publication/[type]/[identifier]/+page.server.ts
+++ b/src/routes/publication/[type]/[identifier]/+page.server.ts
@@ -1,6 +1,7 @@
import { error } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types";
-import { fetchEventByDTag, fetchEventById, fetchEventByNaddr, fetchEventByNevent, NostrEvent } from "../../../../lib/utils/websocket_utils.ts";
+import { fetchEventByDTag, fetchEventById, fetchEventByNaddr, fetchEventByNevent } from "../../../../lib/utils/websocket_utils.ts";
+import type { NostrEvent } from "../../../../lib/utils/websocket_utils.ts";
export const load: PageServerLoad = async ({ params }) => {
const { type, identifier } = params;