Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(collections): integrate list/grid pagination into collection properties
Elian Doran1822970e2304
diff --git a/apps/client/src/widgets/collections/NoteList.css b/apps/client/src/widgets/collections/NoteList.cssindex d320f9d4fc..449f45d97c 100644--- a/apps/client/src/widgets/collections/NoteList.css+++ b/apps/client/src/widgets/collections/NoteList.css@@ -21,8 +21,12 @@ body.prefers-centered-content .note-list-widget:not(.full-height) {}/* #region Pagination */-.note-list-pager span.current-page {- text-decoration: underline;- font-weight: bold;+.note-list-pager {+ font-size: 1rem;++ span.current-page {+ text-decoration: underline;+ font-weight: bold;+ }}/* #endregion */diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsxindex 80f791a07d..61f79cc8da 100644--- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx+++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx@@ -8,7 +8,7 @@ import content_renderer from "../../../services/content_renderer";import { t } from "../../../services/i18n";import link from "../../../services/link";import CollectionProperties from "../../note_bars/CollectionProperties";-import { useImperativeSearchHighlighlighting, useNoteLabel, useNoteLabelBoolean } from "../../react/hooks";+import { useImperativeSearchHighlighlighting, useNoteLabel, useNoteLabelBoolean, useNoteProperty } from "../../react/hooks";import Icon from "../../react/Icon";import NoteLink from "../../react/NoteLink";import { ViewModeProps } from "../interface";@@ -20,13 +20,18 @@ export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }const noteIds = useFilteredNoteIds(note, unfilteredNoteIds);const { pageNotes, ...pagination } = usePagination(note, noteIds);const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived");+ const noteType = useNoteProperty(note, "type");+ const hasCollectionProperties = [ "book", "search" ].includes(noteType ?? "");return (<div class="note-list list-view">- <CollectionProperties note={note} />+ <CollectionProperties+ note={note}+ centerChildren={<Pager {...pagination} />}+ />{ noteIds.length > 0 && <div class="note-list-wrapper">- <Pager {...pagination} />+ {!hasCollectionProperties && <Pager {...pagination} />}<div class="note-list-container use-tn-links">{pageNotes?.map(childNote => (@@ -48,13 +53,18 @@ export function GridView({ note, noteIds: unfilteredNoteIds, highlightedTokens }const noteIds = useFilteredNoteIds(note, unfilteredNoteIds);const { pageNotes, ...pagination } = usePagination(note, noteIds);const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived");+ const noteType = useNoteProperty(note, "type");+ const hasCollectionProperties = [ "book", "search" ].includes(noteType ?? "");return (<div class="note-list grid-view">- <CollectionProperties note={note} />+ <CollectionProperties+ note={note}+ centerChildren={<Pager {...pagination} />}+ /><div class="note-list-wrapper">- <Pager {...pagination} />+ {!hasCollectionProperties && <Pager {...pagination} />}<div class="note-list-container use-tn-links">{pageNotes?.map(childNote => (diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.css b/apps/client/src/widgets/note_bars/CollectionProperties.cssindex a6b2bf963c..6332b6b9ad 100644--- a/apps/client/src/widgets/note_bars/CollectionProperties.css+++ b/apps/client/src/widgets/note_bars/CollectionProperties.css@@ -21,6 +21,7 @@.center-container {flex-grow: 1;+ justify-content: center;gap: 0.5em;}diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsxindex c1c1e5db9c..d466e813cd 100644--- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx+++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx@@ -13,7 +13,7 @@ import ActionButton from "../react/ActionButton";import Dropdown from "../react/Dropdown";import { FormDropdownDivider, FormDropdownSubmenu, FormListItem, FormListToggleableItem } from "../react/FormList";import FormTextBox from "../react/FormTextBox";-import { useNoteLabel, useNoteLabelBoolean, useNoteLabelWithDefault, useTriliumEvent } from "../react/hooks";+import { useNoteLabel, useNoteLabelBoolean, useNoteLabelWithDefault, useNoteProperty, useTriliumEvent } from "../react/hooks";import Icon from "../react/Icon";import { ParentComponent } from "../react/react_utils";import { bookPropertiesConfig, BookProperty, ButtonProperty, CheckBoxProperty, ComboBoxItem, ComboBoxProperty, NumberProperty, SplitButtonProperty } from "../ribbon/collection-properties-config";@@ -35,8 +35,9 @@ export default function CollectionProperties({ note, centerChildren, rightChildrrightChildren?: ComponentChildren;}) {const [ viewType, setViewType ] = useViewType(note);+ const noteType = useNoteProperty(note, "type");- return ([ "book", "search" ].includes(note.type) &&+ return ([ "book", "search" ].includes(noteType ?? "") &&<div className="collection-properties"><div className="left-container"><ViewTypeSwitcher viewType={viewType} setViewType={setViewType} />