feat(breadcrumb/note_info): get basic dropdown

This commit is contained in:
Elian Doran
2025-12-11 00:18:56 +02:00
parent 19b32dd3a6
commit 2e44397c88
3 changed files with 36 additions and 2 deletions

View File

@@ -68,4 +68,12 @@
padding: 0;
}
}
.dropdown-note-info-badge {
ul {
list-style-type: none;
padding: 0.5em;
margin: 0;
}
}
}

View File

@@ -17,10 +17,36 @@ export default function BreadcrumbBadges() {
<ReadOnlyBadge />
<ShareBadge />
<BacklinksBadge />
<NoteInfoBadge />
</div>
);
}
function NoteInfoBadge() {
const { note } = useNoteContext();
return (note &&
<BadgeWithDropdown
icon="bx bx-info-circle"
className="note-info-badge"
>
<ul>
<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>} />
</ul>
</BadgeWithDropdown>
);
}
function NoteInfoValue({ text, value }: { text: string; value: ComponentChildren }) {
return (
<li>
<strong>{text}</strong>{": "}
<span>{value}</span>
</li>
);
}
function ReadOnlyBadge() {
const { note, noteContext } = useNoteContext();
const { isReadOnly, enableEditing } = useIsNoteReadOnly(note, noteContext);
@@ -83,7 +109,7 @@ function BacklinksBadge() {
}
interface BadgeProps {
text: string;
text?: string;
icon?: string;
className: string;
tooltip?: string;

View File

@@ -13,7 +13,7 @@ import FNote from "../../entities/fnote";
const isNewLayout = isExperimentalFeatureEnabled("new-layout");
export default function NoteInfoTab({ note }: TabContext) {
export default function NoteInfoTab({ note }: { note: FNote | null | undefined }) {
const { isLoading, metadata, noteSizeResponse, subtreeSizeResponse, requestSizeInfo } = useNoteMetadata(note);
return (