feat(electron): track router history (#2336)

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
Himself65
2023-05-14 23:13:30 -07:00
committed by GitHub
parent e5330b1917
commit 23b4f9ee12
7 changed files with 219 additions and 7 deletions
@@ -21,9 +21,10 @@ import {
updateAvailableAtom,
} from './index.jotai';
import { ResizeIndicator } from './resize-indicator';
import type { SidebarHeaderProps } from './sidebar-header';
import { SidebarHeader } from './sidebar-header';
export type AppSidebarProps = PropsWithChildren;
export type AppSidebarProps = PropsWithChildren<SidebarHeaderProps>;
function useEnableAnimation() {
const [enable, setEnable] = useState(false);
@@ -35,6 +36,11 @@ function useEnableAnimation() {
return enable;
}
export type History = {
stack: string[];
current: number;
};
export function AppSidebar(props: AppSidebarProps): ReactElement {
const [open, setOpen] = useAtom(appSidebarOpenAtom);
const appSidebarWidth = useAtomValue(appSidebarWidthAtom);
@@ -91,7 +97,7 @@ export function AppSidebar(props: AppSidebarProps): ReactElement {
data-enable-animation={enableAnimation && !isResizing}
>
<nav className={navStyle} ref={navRef} data-testid="app-sidebar">
<SidebarHeader />
<SidebarHeader router={props.router} />
<div className={navBodyStyle} data-testid="sliderBar-inner">
{props.children}
</div>