mirror of
https://github.com/zadam/trilium.git
synced 2026-02-19 12:14:23 +01:00
feat(collections): improve display of no children
This commit is contained in:
parent
23c50f34fe
commit
81a572af25
@ -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 <a href=\"https://triliumnext.github.io/Docs/Wiki/book-note.html\">wiki</a> 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."
|
||||
},
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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) {
|
||||
<>
|
||||
<CollectionProperties note={note} />
|
||||
|
||||
<Alert type="warning" className="note-detail-book-empty-help">
|
||||
<RawHtml html={t("book.no_children_help")} />
|
||||
</Alert>
|
||||
<NoItems icon="bx bx-collection" text={t("book.no_children_help")} />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user