Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/collections/list): add note count to pagination

Elian Doran49b189e7a999
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index d76843a270..d265e02838 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2024,5 +2024,9 @@
},
"units": {
"percentage": "%"
+ },
+ "pagination": {
+ "page_title": "Page of {{startIndex}} - {{endIndex}}",
+ "total_notes": "{{count}} notes"
}
}
diff --git a/apps/client/src/widgets/collections/Pagination.tsx b/apps/client/src/widgets/collections/Pagination.tsx
index b37824e00e..9d4782da4d 100644
--- a/apps/client/src/widgets/collections/Pagination.tsx
+++ b/apps/client/src/widgets/collections/Pagination.tsx
@@ -3,6 +3,7 @@ import { Dispatch, StateUpdater, useEffect, useState } from "preact/hooks";
import FNote from "../../entities/fnote";
import froca from "../../services/froca";
import { useNoteLabel } from "../react/hooks";
+import { t } from "../../services/i18n";
interface PaginationContext {
page: number;
@@ -29,7 +30,7 @@ export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit<P
children.push((
<a
href="javascript:"
- title={`Page of ${startIndex} - ${endIndex}`}
+ title={t("pagination.page_title", { startIndex, endIndex })}
onClick={() => setPage(i)}
>
{i}
@@ -50,6 +51,8 @@ export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit<P
return (
<div class="note-list-pager">
{children}
+
+ <span className="note-list-pager-total-count">({t("pagination.total_notes", { count: totalNotes })})</span>
</div>
)
}
diff --git a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
index 28f4fd53e9..8e88ebdcf9 100644
--- a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
+++ b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
@@ -49,7 +49,7 @@ class ListOrGridView extends ViewMode<{}> {
// no need to distinguish "note" vs "notes" since in case of one result, there's no paging at all
- $pager.append(`<span class="note-list-pager-total-count">(${this.filteredNoteIds.length} notes)</span>`);
+ $pager.append(`<span class=""></span>`);
}
async renderNote(note: FNote, expand: boolean = false) {