import AddressBar from "components/apps/FileExplorer/AddressBar"; import { Back, Down, Forward, Up, } from "components/apps/FileExplorer/NavigationIcons"; import SearchBar from "components/apps/FileExplorer/SearchBar"; import StyledNavigation from "components/apps/FileExplorer/StyledNavigation"; import useTitlebarContextMenu from "components/system/Window/Titlebar/useTitlebarContextMenu"; import { useMenu } from "contexts/menu"; import { useProcesses } from "contexts/process"; import useHistory from "hooks/useHistory"; import { basename, dirname } from "path"; import { forwardRef, useMemo } from "react"; import Button from "styles/common/Button"; import { ROOT_NAME } from "utils/constants"; import { haltEvent, label } from "utils/functions"; type NavigationProps = { hideSearch: boolean; id: string; }; const Navigation = forwardRef( ({ hideSearch, id }, inputRef) => { const { url: changeUrl, processes: { [id]: { url = "" }, }, } = useProcesses(); const upTo = url === "/" ? "" : basename(dirname(url)); const { contextMenu } = useMenu(); const { canGoBack, canGoForward, history, moveHistory, position } = useHistory(url, id); const { onContextMenuCapture } = useMemo( () => contextMenu?.(() => history.map((historyUrl, index) => ({ action: () => moveHistory(index - position), checked: position === index, label: basename(historyUrl) || ROOT_NAME, primary: position === index, })) ), [contextMenu, history, moveHistory, position] ); return ( {!hideSearch && } ); } ); export default Navigation;