Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(mobile): use mobile fallback for index, open home when workspace changed (#9106)

CatsJuice6f6f95a8b0fd
diff --git a/packages/frontend/apps/ios/App/App.xcodeproj/project.pbxproj b/packages/frontend/apps/ios/App/App.xcodeproj/project.pbxproj
index db3b1cfc90..7964dc8f36 100644
--- a/packages/frontend/apps/ios/App/App.xcodeproj/project.pbxproj
+++ b/packages/frontend/apps/ios/App/App.xcodeproj/project.pbxproj
@@ -163,8 +163,8 @@
isa = PBXNativeTarget;
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
buildPhases = (
- C4C97C6A2D0300E100BC2AD1 /* Build Rust */,
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
+ C4C97C6A2D0300E100BC2AD1 /* Build Rust */,
504EC3001FED79650016851F /* Sources */,
504EC3011FED79650016851F /* Frameworks */,
504EC3021FED79650016851F /* Resources */,
diff --git a/packages/frontend/apps/ios/App/Podfile.lock b/packages/frontend/apps/ios/App/Podfile.lock
index 759c19c7f5..934d930c0e 100644
--- a/packages/frontend/apps/ios/App/Podfile.lock
+++ b/packages/frontend/apps/ios/App/Podfile.lock
@@ -50,4 +50,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: e0c0ccf027ea6d51e476f0baf9d44d97b9a90a4b
-COCOAPODS: 1.15.2
+COCOAPODS: 1.16.2
diff --git a/packages/frontend/core/src/desktop/pages/index/index.tsx b/packages/frontend/core/src/desktop/pages/index/index.tsx
index 38fa4b66ed..819323a40f 100644
--- a/packages/frontend/core/src/desktop/pages/index/index.tsx
+++ b/packages/frontend/core/src/desktop/pages/index/index.tsx
@@ -10,6 +10,7 @@ import {
WorkspacesService,
} from '@toeverything/infra';
import {
+ type ReactNode,
useCallback,
useEffect,
useLayoutEffect,
@@ -34,8 +35,12 @@ import { AppContainer } from '../../components/app-container';
*/
export const Component = ({
defaultIndexRoute = 'all',
+ children,
+ fallback,
}: {
defaultIndexRoute?: string;
+ children?: ReactNode;
+ fallback?: ReactNode;
}) => {
// navigating and creating may be slow, to avoid flickering, we show workspace fallback
const [navigating, setNavigating] = useState(true);
@@ -146,24 +151,26 @@ export const Component = ({
}, [jumpToPage, openPage, workspacesService]);
if (navigating || creating) {
- return <AppContainer fallback />;
+ return fallback ?? <AppContainer fallback />;
}
// TODO(@eyhn): We need a no workspace page
return (
- <div
- style={{
- position: 'fixed',
- left: 'calc(50% - 150px)',
- top: '50%',
- }}
- >
- <WorkspaceNavigator
- open={true}
- menuContentOptions={{
- forceMount: true,
+ children ?? (
+ <div
+ style={{
+ position: 'fixed',
+ left: 'calc(50% - 150px)',
+ top: '50%',
}}
- />
- </div>
+ >
+ <WorkspaceNavigator
+ open={true}
+ menuContentOptions={{
+ forceMount: true,
+ }}
+ />
+ </div>
+ )
);
};
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 42d757348d..5d21ac7cae 100644
--- a/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx
+++ b/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx
@@ -61,7 +61,7 @@ const WorkspaceList = ({
const toggleWorkspace = useCallback(
(id: string) => {
if (id !== currentWorkspace.id) {
- jumpToPage(id, 'all');
+ jumpToPage(id, 'home');
}
onClose?.();
},
diff --git a/packages/frontend/core/src/mobile/pages/index.tsx b/packages/frontend/core/src/mobile/pages/index.tsx
index aed12fe284..8b02724119 100644
--- a/packages/frontend/core/src/mobile/pages/index.tsx
+++ b/packages/frontend/core/src/mobile/pages/index.tsx
@@ -1,8 +1,12 @@
import { Component as IndexComponent } from '@affine/core/desktop/pages/index';
+import { AppFallback } from '../components/app-fallback';
+
// Default route fallback for mobile
export const Component = () => {
// TODO: replace with a mobile version
- return <IndexComponent defaultIndexRoute={'home'} />;
+ return (
+ <IndexComponent defaultIndexRoute={'home'} fallback={<AppFallback />} />
+ );
};