mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 06:14:28 +01:00
feat(note_info): display user-friendly note type name & icon
This commit is contained in:
parent
7222b233f0
commit
2e563b0a1f
@ -13,6 +13,7 @@ import FNote from "../../entities/fnote";
|
||||
import attributes from "../../services/attributes";
|
||||
import { t } from "../../services/i18n";
|
||||
import { ViewScope } from "../../services/link";
|
||||
import { NOTE_TYPES } from "../../services/note_types";
|
||||
import server from "../../services/server";
|
||||
import { openInAppHelpFromUrl } from "../../services/utils";
|
||||
import { formatDateTime } from "../../utils/formatters";
|
||||
@ -219,8 +220,10 @@ export function NoteInfoBadge({ note, setSimilarNotesShown }: NoteInfoContext) {
|
||||
const dropdownRef = useRef<BootstrapDropdown>(null);
|
||||
const { metadata, ...sizeProps } = useNoteMetadata(note);
|
||||
const [ originalFileName ] = useNoteLabel(note, "originalFileName");
|
||||
const currentNoteType = useNoteProperty(note, "type");
|
||||
const currentNoteTypeData = useMemo(() => NOTE_TYPES.find(t => t.type === currentNoteType), [ currentNoteType ]);
|
||||
|
||||
return (note &&
|
||||
return (note && currentNoteTypeData &&
|
||||
<StatusBarDropdown
|
||||
icon="bx bx-info-circle"
|
||||
title={t("status_bar.note_info_title")}
|
||||
@ -232,7 +235,7 @@ export function NoteInfoBadge({ note, setSimilarNotesShown }: NoteInfoContext) {
|
||||
{originalFileName && <NoteInfoValue text={t("file_properties.original_file_name")} value={originalFileName} />}
|
||||
<NoteInfoValue text={t("note_info_widget.created")} value={formatDateTime(metadata?.dateCreated)} />
|
||||
<NoteInfoValue text={t("note_info_widget.modified")} value={formatDateTime(metadata?.dateModified)} />
|
||||
<NoteInfoValue text={t("note_info_widget.type")} value={note.type} />
|
||||
<NoteInfoValue text={t("note_info_widget.type")} value={<><Icon icon={`bx ${currentNoteTypeData.icon}`}/>{" "}{currentNoteTypeData?.title}</>} />
|
||||
<NoteInfoValue text={t("note_info_widget.mime")} value={note.mime} />
|
||||
<NoteInfoValue text={t("note_info_widget.note_id")} value={<code>{note.noteId}</code>} />
|
||||
<NoteInfoValue text={t("note_info_widget.note_size")} title={t("note_info_widget.note_size_info")} value={<NoteSizeWidget {...sizeProps} />} />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user