feat(status_bar): note paths (no interaction yet)

This commit is contained in:
Elian Doran
2025-12-12 23:47:31 +02:00
parent 9eb9b66398
commit 0c1c7e4f8e
3 changed files with 48 additions and 22 deletions

View File

@@ -27,17 +27,19 @@ import { NoteSizeWidget, useNoteMetadata } from "../ribbon/NoteInfoTab";
import { useAttachments } from "../type_widgets/Attachment";
import { useProcessedLocales } from "../type_widgets/options/components/LocaleSelector";
import Breadcrumb from "./Breadcrumb";
import NotePathsTab, { useSortedNotePaths } from "../ribbon/NotePathsTab";
interface StatusBarContext {
note: FNote;
noteContext: NoteContext;
viewScope?: ViewScope;
hoistedNoteId?: string;
}
export default function StatusBar() {
const { note, noteContext, viewScope } = useActiveNoteContext();
const { note, noteContext, viewScope, hoistedNoteId } = useActiveNoteContext();
const [ attributesShown, setAttributesShown ] = useState(false);
const context: StatusBarContext | undefined | null = note && noteContext && { note, noteContext, viewScope };
const context: StatusBarContext | undefined | null = note && noteContext && { note, noteContext, viewScope, hoistedNoteId };
const attributesContext: AttributesProps | undefined | null = context && { ...context, attributesShown, setAttributesShown };
return (
@@ -49,6 +51,7 @@ export default function StatusBar() {
<Breadcrumb {...context} />
<div className="actions-row">
<NotePaths {...context} />
<AttributesButton {...attributesContext} />
<AttachmentCount {...context} />
<BacklinksBadge {...context} />
@@ -307,3 +310,19 @@ function AttributesPane({ note, noteContext, attributesShown, setAttributesShown
);
}
//#endregion
//#region Note paths
function NotePaths({ note, hoistedNoteId }: StatusBarContext) {
const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);
return (
<StatusBarDropdown
title={t("status_bar.note_paths_title")}
icon="bx bx-link-alt"
text={sortedNotePaths?.length}
>
</StatusBarDropdown>
)
}
//#endregion