diff --git a/apps/client/src/widgets/Breadcrumb.tsx b/apps/client/src/widgets/Breadcrumb.tsx index 940f62405..29d5cc7f0 100644 --- a/apps/client/src/widgets/Breadcrumb.tsx +++ b/apps/client/src/widgets/Breadcrumb.tsx @@ -1,14 +1,16 @@ -import { Fragment } from "preact/jsx-runtime"; import "./Breadcrumb.css"; -import { useChildNotes, useNoteContext, useNoteLabel, useNoteProperty, useStaticTooltip } from "./react/hooks"; -import NoteLink from "./react/NoteLink"; -import Dropdown from "./react/Dropdown"; -import Icon from "./react/Icon"; -import { FormListItem } from "./react/FormList"; -import NoteContext from "../components/note_context"; -import ActionButton from "./react/ActionButton"; + import { useMemo } from "preact/hooks"; +import { Fragment } from "preact/jsx-runtime"; + +import NoteContext from "../components/note_context"; import froca from "../services/froca"; +import ActionButton from "./react/ActionButton"; +import Dropdown from "./react/Dropdown"; +import { FormListItem } from "./react/FormList"; +import { useChildNotes, useNoteContext, useNoteLabel, useNoteProperty } from "./react/hooks"; +import Icon from "./react/Icon"; +import NoteLink from "./react/NoteLink"; const COLLAPSE_THRESHOLD = 5; const INITIAL_ITEMS = 2; @@ -21,38 +23,38 @@ export default function Breadcrumb() { return (
{notePath.length > COLLAPSE_THRESHOLD ? ( - <> - {notePath.slice(0, INITIAL_ITEMS).map((item, index) => ( - - {index === 0 && notePath.length > 1 - ? - : - } - - - ))} - - {notePath.slice(-FINAL_ITEMS).map((item, index) => ( - - - - - ))} - + <> + {notePath.slice(0, INITIAL_ITEMS).map((item, index) => ( + + {index === 0 && notePath.length > 1 + ? + : + } + + + ))} + + {notePath.slice(-FINAL_ITEMS).map((item, index) => ( + + + + + ))} + ) : ( - notePath.map((item, index) => ( - - {index === 0 && notePath.length > 1 - ? - : - } - {(index < notePath.length - 1 || note?.hasChildren()) && - } - - )) + notePath.map((item, index) => ( + + {index === 0 && notePath.length > 1 + ? + : + } + {(index < notePath.length - 1 || note?.hasChildren()) && + } + + )) )}
- ) + ); } function BreadcrumbRoot({ noteContext }: { noteContext: NoteContext | undefined }) { @@ -66,7 +68,7 @@ function BreadcrumbRoot({ noteContext }: { noteContext: NoteContext | undefined text={title ?? ""} onClick={() => noteContext?.setNote("root")} /> - ) + ); } function BreadcrumbItem({ notePath, activeNotePath }: { notePath: string, activeNotePath: string }) { @@ -78,7 +80,7 @@ function BreadcrumbItem({ notePath, activeNotePath }: { notePath: string, active title={isRootNote && activeNotePath !== "root" ? "" : undefined} showNoteIcon={isRootNote} /> - ) + ); } function BreadcrumbSeparator({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) { @@ -92,7 +94,7 @@ function BreadcrumbSeparator({ notePath, noteContext, activeNotePath }: { notePa > - ) + ); } function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) { @@ -104,20 +106,20 @@ function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNoteP return ( - ) + ); } function BreadcrumbCollapsed({ items, noteContext }: { items: string[], noteContext: NoteContext | undefined }) { @@ -143,11 +145,11 @@ function BreadcrumbCollapsed({ items, noteContext }: { items: string[], noteCont > {note.title} - + ; })} - ) + ); } function buildNotePaths(notePathArray: string[] | undefined) {