feat: add history back & forward for desktop app (#1926)

This commit is contained in:
Qi
2023-04-14 17:19:52 +08:00
committed by GitHub
parent bd387f6551
commit 261a41f8da
10 changed files with 72 additions and 65 deletions
@@ -103,7 +103,7 @@ export const NavigationPath = ({
>
<IconButton
data-testid="navigation-path-expand-btn"
size="middle"
size="small"
className="collapse-btn"
onClick={() => {
setOpenExtend(!openExtend);
@@ -158,9 +158,7 @@ const NavigationPathExtendPanel = ({
show={open}
data-testid="navigation-path-expand-panel"
>
<div className="tree-container">
<TreeView data={data} indent={10} disableCollapse={true} />
</div>
<TreeView data={data} indent={10} disableCollapse={true} />
</StyledNavPathExtendContainer>
);
};
@@ -55,12 +55,7 @@ export const StyledNavPathExtendContainer = styled('div')<{ show: boolean }>(
transition: 'top .15s',
fontSize: theme.font.sm,
color: theme.colors.secondaryTextColor,
paddingTop: '46px',
paddingRight: '12px',
'.tree-container': {
padding: '0 12px 0 15px',
},
padding: '46px 12px 0 15px',
};
}
);
@@ -3,7 +3,7 @@ import type { PageMeta } from '@blocksuite/store';
export function findPath(metas: PageMeta[], meta: PageMeta): PageMeta[] {
function helper(group: PageMeta[]): PageMeta[] {
const last = group[group.length - 1];
const parent = metas.find(m => m.subpageIds.includes(last.id));
const parent = metas.find(m => (m.subpageIds ?? []).includes(last.id));
if (parent) {
return helper([...group, parent]);
}