mirror of
https://github.com/zadam/trilium.git
synced 2025-12-17 05:39:55 +01:00
feat(breadcrumb): use different approach for displaying workspace icon
This commit is contained in:
@@ -15,6 +15,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
|
.bx {
|
||||||
|
margin-inline: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@@ -57,32 +57,36 @@ export default function Breadcrumb({ note, noteContext }: { note: FNote, noteCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
function BreadcrumbRoot({ noteContext }: { noteContext: NoteContext | undefined }) {
|
function BreadcrumbRoot({ noteContext }: { noteContext: NoteContext | undefined }) {
|
||||||
const note = useNote(noteContext?.hoistedNoteId);
|
const noteId = noteContext?.hoistedNoteId ?? "root";
|
||||||
useNoteLabel(note, "iconClass");
|
|
||||||
const title = useNoteProperty(note, "title");
|
|
||||||
|
|
||||||
return (note &&
|
// Root note is icon only.
|
||||||
<ActionButton
|
if (noteId === "root") {
|
||||||
className="root-note"
|
const note = froca.getNoteFromCache("root");
|
||||||
icon={note.getIcon()}
|
return (note &&
|
||||||
text={title ?? ""}
|
<ActionButton
|
||||||
onClick={() => noteContext?.setNote(note.noteId)}
|
className="root-note"
|
||||||
onContextMenu={(e) => {
|
icon={note.getIcon()}
|
||||||
e.preventDefault();
|
text={""}
|
||||||
link_context_menu.openContextMenu(note.noteId, e);
|
onClick={() => noteContext?.setNote(note.noteId)}
|
||||||
}}
|
onContextMenu={(e) => {
|
||||||
/>
|
e.preventDefault();
|
||||||
);
|
link_context_menu.openContextMenu(note.noteId, e);
|
||||||
}
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function BreadcrumbLink({ notePath }: { notePath: string }) {
|
// Hoisted workspace shows both text and icon.
|
||||||
return (
|
return (
|
||||||
<NoteLink
|
<NoteLink
|
||||||
notePath={notePath}
|
notePath={noteId}
|
||||||
|
showNoteIcon
|
||||||
|
noPreview
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function BreadcrumbLastItem({ notePath }: { notePath: string }) {
|
function BreadcrumbLastItem({ notePath }: { notePath: string }) {
|
||||||
const noteId = notePath.split("/").at(-1);
|
const noteId = notePath.split("/").at(-1);
|
||||||
const [ note ] = useState(() => froca.getNoteFromCache(noteId!));
|
const [ note ] = useState(() => froca.getNoteFromCache(noteId!));
|
||||||
@@ -114,7 +118,7 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { inde
|
|||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <BreadcrumbLink notePath={notePath} />;
|
return <NoteLink notePath={notePath} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function BreadcrumbSeparator({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) {
|
function BreadcrumbSeparator({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user