mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 18:34:24 +01:00
feat(breadcrumb/note_info): modification/creation date
This commit is contained in:
parent
2e44397c88
commit
e5696713de
@ -5,10 +5,12 @@ import { ComponentChildren, MouseEventHandler } from "preact";
|
|||||||
import { useRef } from "preact/hooks";
|
import { useRef } from "preact/hooks";
|
||||||
|
|
||||||
import { t } from "../services/i18n";
|
import { t } from "../services/i18n";
|
||||||
|
import { formatDateTime } from "../utils/formatters";
|
||||||
import { BacklinksList, useBacklinkCount } from "./FloatingButtonsDefinitions";
|
import { BacklinksList, useBacklinkCount } from "./FloatingButtonsDefinitions";
|
||||||
import Dropdown, { DropdownProps } from "./react/Dropdown";
|
import Dropdown, { DropdownProps } from "./react/Dropdown";
|
||||||
import { useIsNoteReadOnly, useNoteContext, useStaticTooltip } from "./react/hooks";
|
import { useIsNoteReadOnly, useNoteContext, useStaticTooltip } from "./react/hooks";
|
||||||
import Icon from "./react/Icon";
|
import Icon from "./react/Icon";
|
||||||
|
import { useNoteMetadata } from "./ribbon/NoteInfoTab";
|
||||||
import { useShareInfo } from "./shared_info";
|
import { useShareInfo } from "./shared_info";
|
||||||
|
|
||||||
export default function BreadcrumbBadges() {
|
export default function BreadcrumbBadges() {
|
||||||
@ -24,6 +26,7 @@ export default function BreadcrumbBadges() {
|
|||||||
|
|
||||||
function NoteInfoBadge() {
|
function NoteInfoBadge() {
|
||||||
const { note } = useNoteContext();
|
const { note } = useNoteContext();
|
||||||
|
const { isLoading, metadata, noteSizeResponse, subtreeSizeResponse, requestSizeInfo } = useNoteMetadata(note);
|
||||||
|
|
||||||
return (note &&
|
return (note &&
|
||||||
<BadgeWithDropdown
|
<BadgeWithDropdown
|
||||||
@ -31,6 +34,8 @@ function NoteInfoBadge() {
|
|||||||
className="note-info-badge"
|
className="note-info-badge"
|
||||||
>
|
>
|
||||||
<ul>
|
<ul>
|
||||||
|
<NoteInfoValue text={t("note_info_widget.created")} value={metadata?.dateCreated ? formatDateTime(metadata.dateCreated) : ""} />
|
||||||
|
<NoteInfoValue text={t("note_info_widget.modified")} value={metadata?.dateModified ? formatDateTime(metadata.dateModified) : ""} />
|
||||||
<NoteInfoValue text={t("note_info_widget.type")} value={<span>{note.type} {note.mime && <span>({note.mime})</span>}</span>} />
|
<NoteInfoValue text={t("note_info_widget.type")} value={<span>{note.type} {note.mime && <span>({note.mime})</span>}</span>} />
|
||||||
<NoteInfoValue text={t("note_info_widget.note_id")} value={<code>{note.noteId}</code>} />
|
<NoteInfoValue text={t("note_info_widget.note_id")} value={<code>{note.noteId}</code>} />
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@ -9,26 +9,12 @@ import { useRef } from "preact/hooks";
|
|||||||
|
|
||||||
export default function NoteTitleDetails() {
|
export default function NoteTitleDetails() {
|
||||||
const { note, noteContext } = useNoteContext();
|
const { note, noteContext } = useNoteContext();
|
||||||
const { metadata } = useNoteMetadata(note);
|
|
||||||
const isHiddenNote = note?.noteId.startsWith("_");
|
const isHiddenNote = note?.noteId.startsWith("_");
|
||||||
const isDefaultView = noteContext?.viewScope?.viewMode === "default";
|
const isDefaultView = noteContext?.viewScope?.viewMode === "default";
|
||||||
|
|
||||||
const items: ComponentChild[] = [
|
const items: ComponentChild[] = [].filter(item => !!item);
|
||||||
(isDefaultView && !isHiddenNote && metadata?.dateCreated &&
|
|
||||||
<TextWithValue
|
|
||||||
i18nKey="note_title.created_on"
|
|
||||||
value={formatDateTime(metadata.dateCreated, "medium", "none")}
|
|
||||||
valueTooltip={formatDateTime(metadata.dateCreated, "full", "long")}
|
|
||||||
/>),
|
|
||||||
(isDefaultView && !isHiddenNote && metadata?.dateModified &&
|
|
||||||
<TextWithValue
|
|
||||||
i18nKey="note_title.last_modified"
|
|
||||||
value={formatDateTime(metadata.dateModified, "medium", "none")}
|
|
||||||
valueTooltip={formatDateTime(metadata.dateModified, "full", "long")}
|
|
||||||
/>)
|
|
||||||
].filter(item => !!item);
|
|
||||||
|
|
||||||
return (
|
return items.length && (
|
||||||
<div className="title-details">
|
<div className="title-details">
|
||||||
{joinElements(items, " • ")}
|
{joinElements(items, " • ")}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
import { TabContext } from "./ribbon-interface";
|
|
||||||
import { MetadataResponse, NoteSizeResponse, SubtreeSizeResponse } from "@triliumnext/commons";
|
import { MetadataResponse, NoteSizeResponse, SubtreeSizeResponse } from "@triliumnext/commons";
|
||||||
import server from "../../services/server";
|
import server from "../../services/server";
|
||||||
import Button from "../react/Button";
|
import Button from "../react/Button";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user