diff --git a/src/lib/components/Notifications.svelte b/src/lib/components/Notifications.svelte index 98f72b8..f7ca57a 100644 --- a/src/lib/components/Notifications.svelte +++ b/src/lib/components/Notifications.svelte @@ -70,7 +70,7 @@ let allFromMeNotifications = $state([]); // All fetched "from-me" notifications let allPublicMessages = $state([]); // All fetched public messages let currentPage = $state(1); - let itemsPerPage = 20; // Show 20 items per page + let itemsPerPage = 10; // Show 20 items per page let hasFetchedToMe = $state(false); // Track if we've already fetched "to-me" data let hasFetchedFromMe = $state(false); // Track if we've already fetched "from-me" data let hasFetchedPublic = $state(false); // Track if we've already fetched public messages @@ -650,27 +650,13 @@ } } - // AI-NOTE: Pagination navigation functions - function nextPage() { - if (hasNextPage) { - currentPage++; - updateDisplayedItems(); - } - } - - function previousPage() { - if (hasPreviousPage) { - currentPage--; - updateDisplayedItems(); - } - } - - function goToPage(page: number) { - if (page >= 1 && page <= totalPages) { - currentPage = page; - updateDisplayedItems(); - } - } + // Pagination navigation + $effect (() => { + console.log(`[Pagination] Mode: ${notificationMode}, Current Page: ${currentPage}, Total Pages: ${totalPages}`); + updateDisplayedItems(); + // scroll to top + window.scrollTo({ top: 0, behavior: 'smooth' }); + }); // AI-NOTE: Update displayed items based on current page function updateDisplayedItems() { @@ -845,36 +831,33 @@ {#if isOwnProfile && $userStore.signedIn} -
-
- Notifications - -
- - + + +
+ {#each modes as mode} + {@const modeLabel = mode === "to-me" ? "To Me" : mode === "from-me" ? "From Me" : "Public Messages"} + - - -
- {#each modes as mode} - {@const modeLabel = mode === "to-me" ? "To Me" : mode === "from-me" ? "From Me" : "Public Messages"} - - {/each} -
+ {modeLabel} + + {/each}
- + {#if loading}
@@ -1038,11 +1021,11 @@ {/if} {:else} {#if notifications.length === 0} -
+

No notifications {notificationMode === "to-me" ? "received" : "sent"} found.

-
+ {:else} -
+
{#each notifications.slice(0, 100) as notification} {@const authorProfile = authorProfiles.get(notification.pubkey)}
@@ -1147,8 +1130,7 @@
{/if} {/if} -
- + {:else} - + {#snippet title()}Note-Taking Tool{/snippet}

This editor is for creating individual notes (30041 events) only. Each section becomes a separate note event. diff --git a/src/lib/components/publications/Publication.svelte b/src/lib/components/publications/Publication.svelte index 3a25bbd..00d1cac 100644 --- a/src/lib/components/publications/Publication.svelte +++ b/src/lib/components/publications/Publication.svelte @@ -23,6 +23,7 @@ import type { SveltePublicationTree } from "./svelte_publication_tree.svelte"; import TableOfContents from "./TableOfContents.svelte"; import type { TableOfContents as TocType } from "./table_of_contents.svelte"; + import ArticleNav from "$components/util/ArticleNav.svelte"; let { rootAddress, publicationType, indexEvent, publicationTree, toc } = $props<{ rootAddress: string; @@ -252,164 +253,169 @@ -

- - {#if publicationType !== "blog" && !isLeaf} - - - publicationTree.setBookmark(address)} - onLoadMore={() => { - if (!isLoading && !isDone && publicationTree) { - loadMore(4); - } +
+ + + +
+ + {#if publicationType !== "blog" && !isLeaf} + - - {/if} - -
- - {#if $publicationColumnVisibility.main} - -
-
-
-
- - {#each leaves as leaf, i} - {#if leaf == null} - - - Error loading content. One or more events could not be loaded. - - {:else} - {@const address = leaf.tagAddress()} - onPublicationSectionMounted(el, address)} - /> - {/if} - {/each} -
- {#if isLoading} - - {:else if !isDone} - - {:else} -

- You've reached the end of the publication. -

- {/if} -
-
- {/if} - - - {#if $publicationColumnVisibility.blog} - -
-
-
-
- - {#each leaves as leaf, i} - {#if leaf} - + publicationTree.setBookmark(address)} + onLoadMore={() => { + if (!isLoading && !isDone && publicationTree) { + loadMore(4); + } + }} /> - {/if} - {/each} -
+ + {/if} - {#if isInnerActive()} - {#key currentBlog} - -
- +
+ + {#if $publicationColumnVisibility.main} + +
+
+
+
+ + {#each leaves as leaf, i} + {#if leaf == null} + + + Error loading content. One or more events could not be loaded. + + {:else} + {@const address = leaf.tagAddress()} + onPublicationSectionMounted(el, address)} + /> + {/if} + {/each} +
+ {#if isLoading} + + {:else if !isDone} + + {:else} +

+ You've reached the end of the publication. +

+ {/if} +
- {/key} - {/if} -
+ {/if} - {#if $publicationColumnVisibility.discussion} - - - -
- Discussion - + + {#if $publicationColumnVisibility.blog} + +
+
+
-
- - {#if showBlogHeader() && currentBlog && currentBlogEvent} + + {#each leaves as leaf, i} + {#if leaf} {/if} -
- -
- Unknown - 1.1.1970 -
-
- This is a very intelligent comment placeholder that applies to - all the content equally well. -
-
-
-
- - - - {/if} + {/each} +
+ {/if} + {#if isInnerActive()} + {#key currentBlog} + +
+ +
+ {/key} + {/if} +
+ + {#if $publicationColumnVisibility.discussion} + + + +
+ Discussion + +
+
+ + {#if showBlogHeader() && currentBlog && currentBlogEvent} + + {/if} +
+ +
+ Unknown + 1.1.1970 +
+
+ This is a very intelligent comment placeholder that applies to + all the content equally well. +
+
+
+
+
+
+
+ {/if} +
diff --git a/src/lib/components/util/ArticleNav.svelte b/src/lib/components/util/ArticleNav.svelte index a4c4975..0c9eb77 100644 --- a/src/lib/components/util/ArticleNav.svelte +++ b/src/lib/components/util/ArticleNav.svelte @@ -152,7 +152,7 @@