|
|
|
|
@ -70,7 +70,7 @@
@@ -70,7 +70,7 @@
|
|
|
|
|
let allFromMeNotifications = $state<NDKEvent[]>([]); // All fetched "from-me" notifications |
|
|
|
|
let allPublicMessages = $state<NDKEvent[]>([]); // 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 @@
@@ -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; |
|
|
|
|
// 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,8 +831,6 @@
@@ -845,8 +831,6 @@
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
{#if isOwnProfile && $userStore.signedIn} |
|
|
|
|
<div class="mb-6 w-full"> |
|
|
|
|
<div class="flex items-center justify-between mb-4"> |
|
|
|
|
<Heading tag="h3" class="h-leather">Notifications</Heading> |
|
|
|
|
|
|
|
|
|
<div class="flex flex-row items-center gap-3"> |
|
|
|
|
@ -873,7 +857,6 @@
@@ -873,7 +857,6 @@
|
|
|
|
|
{/each} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{#if loading} |
|
|
|
|
<div class="flex items-center justify-center py-8 min-h-96"> |
|
|
|
|
@ -1038,11 +1021,11 @@
@@ -1038,11 +1021,11 @@
|
|
|
|
|
{/if} |
|
|
|
|
{:else} |
|
|
|
|
{#if notifications.length === 0} |
|
|
|
|
<div class="p-4 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-lg"> |
|
|
|
|
<AAlert color="blue"> |
|
|
|
|
<P>No notifications {notificationMode === "to-me" ? "received" : "sent"} found.</P> |
|
|
|
|
</div> |
|
|
|
|
</AAlert> |
|
|
|
|
{:else} |
|
|
|
|
<div class="max-h-[72rem] overflow-y-auto overflow-x-hidden space-y-4"> |
|
|
|
|
<div class="space-y-4"> |
|
|
|
|
{#each notifications.slice(0, 100) as notification} |
|
|
|
|
{@const authorProfile = authorProfiles.get(notification.pubkey)} |
|
|
|
|
<div class="message-container p-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm"> |
|
|
|
|
@ -1147,7 +1130,6 @@
@@ -1147,7 +1130,6 @@
|
|
|
|
|
</div> |
|
|
|
|
{/if} |
|
|
|
|
{/if} |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- New Message Modal --> |
|
|
|
|
<Modal bind:open={showNewMessageModal} size="lg" class="w-full"> |
|
|
|
|
|