import { useMemo } from "react"; import { TbArrowLeft, TbDots } from "react-icons/tb"; import { Link, useLocation } from "wouter"; import { IconButton } from "../../components/buttons/IconButton"; import { Dropdown } from "../../components/overlay/Dropdown"; import { useEvent } from "../../hooks/use-event"; import { useNavigate } from "ui/lib/routes"; type Breadcrumb = { label: string | Element; onClick?: () => void; href?: string; }; export type Breadcrumbs2Props = { path: Breadcrumb[]; backTo?: string; onBack?: () => void; }; export const Breadcrumbs2 = ({ path: _path, backTo, onBack }: Breadcrumbs2Props) => { const [, , _goBack] = useNavigate(); const path = Array.isArray(_path) ? _path : [_path]; const hasBack = path.length > 1; const goBack = onBack ? onBack : () => _goBack({ fallback: backTo }); const crumbs = useMemo( () => path.map((p, key) => { const last = key === path.length - 1; return { last, ...p, }; }), [path], ); return (