aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Article.svelte27
-rw-r--r--src/lib/components/Navigation.svelte2
-rw-r--r--src/lib/consts.ts2
3 files changed, 16 insertions, 15 deletions
diff --git a/src/lib/Article.svelte b/src/lib/Article.svelte
index 0a17d41..96213e6 100644
--- a/src/lib/Article.svelte
+++ b/src/lib/Article.svelte
@@ -6,26 +6,27 @@
import showdown from 'showdown';
import { onMount } from 'svelte';
import { BookOutline } from 'flowbite-svelte-icons';
- import { alexandriaKinds } from './stores';
+ import { zettelKinds } from './consts';
- export let event: NDKEvent | null | undefined;
+ export let index: NDKEvent | null | undefined;
- async function getEvents(index?: NDKEvent | null | undefined): Promise<IterableIterator<NDKEvent>> {
+ $: activeHash = $page.url.hash;
+
+ const getEvents = async (index?: NDKEvent | null | undefined): Promise<Set<NDKEvent>> => {
if (index == null) {
// TODO: Add error handling.
}
- const eventSet = await $ndk.fetchEvents({
- kinds: $alexandriaKinds,
- ids: index!.getMatchingTags('e').map((value) => value[1]),
+ const eventIds = index!.getMatchingTags('e').map((value) => value[1]);
+ const events = await $ndk.fetchEvents({
+ // @ts-ignore
+ kinds: zettelKinds,
+ ids: eventIds,
});
-
- return eventSet.values();
- }
- $: eventPromises = getEvents(event);
-
- $: activeHash = $page.url.hash;
+ console.debug(`Fetched ${events.size} events from ${eventIds.length} references.`);
+ return events;
+ };
function normalizeHashPath(str: string): string {
return str
@@ -100,7 +101,7 @@
const converter = new showdown.Converter();
</script>
-{#await eventPromises}
+{#await getEvents(index)}
<Sidebar class='sidebar-leather fixed top-20 left-0 px-4 w-60'>
<SidebarWrapper>
<Skeleton/>
diff --git a/src/lib/components/Navigation.svelte b/src/lib/components/Navigation.svelte
index d682bab..0534f2e 100644
--- a/src/lib/components/Navigation.svelte
+++ b/src/lib/components/Navigation.svelte
@@ -10,7 +10,7 @@
<Navbar class={`Navbar navbar-leather ${className}`}>
<div class='flex flex-grow justify-between'>
- <NavBrand href='./'>
+ <NavBrand href='/'>
<h1 class='font-serif'>Alexandria</h1>
</NavBrand>
</div>
diff --git a/src/lib/consts.ts b/src/lib/consts.ts
index e9f766d..26f8911 100644
--- a/src/lib/consts.ts
+++ b/src/lib/consts.ts
@@ -1,6 +1,6 @@
export const wikiKind = 30818;
export const indexKind = 30040;
-export const zettelKind = 30041;
+export const zettelKinds = [ 1, 30024, 30041, 30818];
export const standardRelays = [ "wss://thecitadel.nostr1.com" ];
export enum FeedType {