diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index e2f00acec5..b12ff472dc 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -1010,7 +1010,7 @@ "no_attachments": "This note has no attachments." }, "book": { - "no_children_help": "This collection doesn't have any child notes so there's nothing to display. See wiki for details.", + "no_children_help": "This collection doesn't have any child notes so there's nothing to display.", "drag_locked_title": "Locked for editing", "drag_locked_message": "Dragging not allowed since the collection is locked for editing." }, diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx index c49802a7a4..1b2cc8f8cc 100644 --- a/apps/client/src/widgets/NoteDetail.tsx +++ b/apps/client/src/widgets/NoteDetail.tsx @@ -1,6 +1,7 @@ import "./NoteDetail.css"; import clsx from "clsx"; +import { note } from "mermaid/dist/rendering-util/rendering-elements/shapes/note.js"; import { isValidElement, VNode } from "preact"; import { useEffect, useRef, useState } from "preact/hooks"; @@ -355,6 +356,14 @@ export function checkFullHeight(noteContext: NoteContext | undefined, type: Exte // https://github.com/zadam/trilium/issues/2522 const isBackendNote = noteContext?.noteId === "_backendLog"; const isFullHeightNoteType = type && TYPE_MAPPINGS[type].isFullHeight; + + // Allow vertical centering when there are no results. + if (type === "book" && + [ "grid", "list" ].includes(noteContext.note?.getLabelValue("viewType") ?? "grid") && + !noteContext.note?.hasChildren()) { + return true; + } + return (!noteContext?.hasNoteList() && isFullHeightNoteType) || noteContext?.viewScope?.viewMode === "attachments" || isBackendNote; diff --git a/apps/client/src/widgets/type_widgets/Book.tsx b/apps/client/src/widgets/type_widgets/Book.tsx index 6d07f5fbe3..05a1e2f058 100644 --- a/apps/client/src/widgets/type_widgets/Book.tsx +++ b/apps/client/src/widgets/type_widgets/Book.tsx @@ -5,9 +5,8 @@ import { useEffect, useState } from "preact/hooks"; import { t } from "../../services/i18n"; import { ViewTypeOptions } from "../collections/interface"; import CollectionProperties from "../note_bars/CollectionProperties"; -import Alert from "../react/Alert"; import { useNoteLabelWithDefault, useTriliumEvent } from "../react/hooks"; -import RawHtml from "../react/RawHtml"; +import NoItems from "../react/NoItems"; import { TypeWidgetProps } from "./type_widget"; const VIEW_TYPES: ViewTypeOptions[] = [ "list", "grid", "presentation" ]; @@ -33,9 +32,7 @@ export default function Book({ note }: TypeWidgetProps) { <> - - - + )}