diff --git a/packages/frontend/component/src/hooks/use-theme-color-meta.ts b/packages/frontend/component/src/hooks/use-theme-color-meta.ts index fa1a6aaf2b8d7..e02e6acb2120a 100644 --- a/packages/frontend/component/src/hooks/use-theme-color-meta.ts +++ b/packages/frontend/component/src/hooks/use-theme-color-meta.ts @@ -25,9 +25,13 @@ export const useThemeColorMeta = (color: string) => { const meta = getMeta(); const old = meta.content; meta.content = color; + // also modify document background (for over scroll bounce effect) + const oldBg = document.documentElement.style.backgroundColor; + document.documentElement.style.backgroundColor = color; return () => { meta.content = old; + document.documentElement.style.backgroundColor = oldBg; }; }, [color]); }; diff --git a/packages/frontend/component/src/ui/button/button.tsx b/packages/frontend/component/src/ui/button/button.tsx index acc066adf37a2..b02cf212e5cd7 100644 --- a/packages/frontend/component/src/ui/button/button.tsx +++ b/packages/frontend/component/src/ui/button/button.tsx @@ -161,7 +161,9 @@ export const Button = forwardRef( data-disabled={disabled || undefined} data-size={size} data-variant={variant} - data-no-hover={withoutHover || undefined} + data-no-hover={ + withoutHover || BUILD_CONFIG.isMobileEdition || undefined + } data-mobile={BUILD_CONFIG.isMobileEdition} onClick={handleClick} > diff --git a/packages/frontend/core/src/components/hooks/use-navigate-helper.ts b/packages/frontend/core/src/components/hooks/use-navigate-helper.ts index 68871f9374341..483735c196e8e 100644 --- a/packages/frontend/core/src/components/hooks/use-navigate-helper.ts +++ b/packages/frontend/core/src/components/hooks/use-navigate-helper.ts @@ -96,8 +96,8 @@ export function useNavigateHelper() { ); const openPage = useCallback( - (workspaceId: string, pageId: string) => { - return jumpToPage(workspaceId, pageId); + (workspaceId: string, pageId: string, logic?: RouteLogic) => { + return jumpToPage(workspaceId, pageId, logic); }, [jumpToPage] ); diff --git a/packages/frontend/core/src/desktop/pages/index.tsx b/packages/frontend/core/src/desktop/pages/index.tsx index 73723583c0e1b..6b24f8f5dd837 100644 --- a/packages/frontend/core/src/desktop/pages/index.tsx +++ b/packages/frontend/core/src/desktop/pages/index.tsx @@ -15,7 +15,10 @@ import { import { type LoaderFunction, useSearchParams } from 'react-router-dom'; import { AppFallback } from '../../components/affine/app-container'; -import { useNavigateHelper } from '../../components/hooks/use-navigate-helper'; +import { + RouteLogic, + useNavigateHelper, +} from '../../components/hooks/use-navigate-helper'; import { WorkspaceNavigator } from '../../components/workspace-selector'; import { AuthService } from '../../modules/cloud'; import { @@ -102,7 +105,7 @@ export const Component = ({ const lastId = localStorage.getItem('last_workspace_id'); const openWorkspace = list.find(w => w.id === lastId) ?? list[0]; - openPage(openWorkspace.id, defaultIndexRoute); + openPage(openWorkspace.id, defaultIndexRoute, RouteLogic.REPLACE); } }, [ createCloudWorkspace, diff --git a/packages/frontend/core/src/mobile/components/page-header/index.tsx b/packages/frontend/core/src/mobile/components/page-header/index.tsx index 9a7383b3ddf0f..661610b45e004 100644 --- a/packages/frontend/core/src/mobile/components/page-header/index.tsx +++ b/packages/frontend/core/src/mobile/components/page-header/index.tsx @@ -65,41 +65,50 @@ export const PageHeader = forwardRef( }, [backAction]); return ( - -
-
- {back ? ( - } - /> - ) : null} - {prefix} -
+ <> + +
+
+ {back ? ( + } + /> + ) : null} + {prefix} +
-
- {children} -
+
+ {children} +
-
- {suffix} -
-
-
+
+ {suffix} +
+
+
+ + {/* Spacer */} + +
+ + ); } ); diff --git a/packages/frontend/core/src/mobile/components/page-header/styles.css.ts b/packages/frontend/core/src/mobile/components/page-header/styles.css.ts index 6a2f9af0656e3..d3f790591bbde 100644 --- a/packages/frontend/core/src/mobile/components/page-header/styles.css.ts +++ b/packages/frontend/core/src/mobile/components/page-header/styles.css.ts @@ -3,13 +3,16 @@ import { style } from '@vanilla-extract/css'; export const root = style({ width: '100%', - position: 'sticky', + position: 'fixed', top: 0, zIndex: 1, backgroundColor: cssVarV2('layer/background/secondary'), }); +export const headerSpacer = style({ + height: 44, +}); export const inner = style({ - minHeight: 44, + height: 44, padding: '0 6px', display: 'flex', alignItems: 'center', diff --git a/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts b/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts index b965e4a5f086e..c49ae71218b31 100644 --- a/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts +++ b/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts @@ -3,7 +3,8 @@ import { cssVarV2 } from '@toeverything/theme/v2'; import { style } from '@vanilla-extract/css'; export const root = style({ - maxHeight: 'calc(100dvh - 100px)', + maxHeight: + 'calc(100dvh - 100px - env(safe-area-inset-bottom) - env(safe-area-inset-top))', display: 'flex', flexDirection: 'column', }); diff --git a/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx b/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx index e68732968fdf8..fd57b7e59aaba 100644 --- a/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx +++ b/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx @@ -116,7 +116,9 @@ export const SelectorMenu = ({ onClose }: { onClose?: () => void }) => { title="Cloud Sync" list={cloudWorkspaces} /> -
+ {cloudWorkspaces.length && localWorkspaces.length ? ( +
+ ) : null}