mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(mobile): use mobile fallback for index, open home when workspace changed (#9106)
This commit is contained in:
@@ -163,8 +163,8 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
|
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
C4C97C6A2D0300E100BC2AD1 /* Build Rust */,
|
|
||||||
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
|
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
|
||||||
|
C4C97C6A2D0300E100BC2AD1 /* Build Rust */,
|
||||||
504EC3001FED79650016851F /* Sources */,
|
504EC3001FED79650016851F /* Sources */,
|
||||||
504EC3011FED79650016851F /* Frameworks */,
|
504EC3011FED79650016851F /* Frameworks */,
|
||||||
504EC3021FED79650016851F /* Resources */,
|
504EC3021FED79650016851F /* Resources */,
|
||||||
|
|||||||
@@ -50,4 +50,4 @@ SPEC CHECKSUMS:
|
|||||||
|
|
||||||
PODFILE CHECKSUM: e0c0ccf027ea6d51e476f0baf9d44d97b9a90a4b
|
PODFILE CHECKSUM: e0c0ccf027ea6d51e476f0baf9d44d97b9a90a4b
|
||||||
|
|
||||||
COCOAPODS: 1.15.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
WorkspacesService,
|
WorkspacesService,
|
||||||
} from '@toeverything/infra';
|
} from '@toeverything/infra';
|
||||||
import {
|
import {
|
||||||
|
type ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
@@ -34,8 +35,12 @@ import { AppContainer } from '../../components/app-container';
|
|||||||
*/
|
*/
|
||||||
export const Component = ({
|
export const Component = ({
|
||||||
defaultIndexRoute = 'all',
|
defaultIndexRoute = 'all',
|
||||||
|
children,
|
||||||
|
fallback,
|
||||||
}: {
|
}: {
|
||||||
defaultIndexRoute?: string;
|
defaultIndexRoute?: string;
|
||||||
|
children?: ReactNode;
|
||||||
|
fallback?: ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
// navigating and creating may be slow, to avoid flickering, we show workspace fallback
|
// navigating and creating may be slow, to avoid flickering, we show workspace fallback
|
||||||
const [navigating, setNavigating] = useState(true);
|
const [navigating, setNavigating] = useState(true);
|
||||||
@@ -146,24 +151,26 @@ export const Component = ({
|
|||||||
}, [jumpToPage, openPage, workspacesService]);
|
}, [jumpToPage, openPage, workspacesService]);
|
||||||
|
|
||||||
if (navigating || creating) {
|
if (navigating || creating) {
|
||||||
return <AppContainer fallback />;
|
return fallback ?? <AppContainer fallback />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(@eyhn): We need a no workspace page
|
// TODO(@eyhn): We need a no workspace page
|
||||||
return (
|
return (
|
||||||
<div
|
children ?? (
|
||||||
style={{
|
<div
|
||||||
position: 'fixed',
|
style={{
|
||||||
left: 'calc(50% - 150px)',
|
position: 'fixed',
|
||||||
top: '50%',
|
left: 'calc(50% - 150px)',
|
||||||
}}
|
top: '50%',
|
||||||
>
|
|
||||||
<WorkspaceNavigator
|
|
||||||
open={true}
|
|
||||||
menuContentOptions={{
|
|
||||||
forceMount: true,
|
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
</div>
|
<WorkspaceNavigator
|
||||||
|
open={true}
|
||||||
|
menuContentOptions={{
|
||||||
|
forceMount: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const WorkspaceList = ({
|
|||||||
const toggleWorkspace = useCallback(
|
const toggleWorkspace = useCallback(
|
||||||
(id: string) => {
|
(id: string) => {
|
||||||
if (id !== currentWorkspace.id) {
|
if (id !== currentWorkspace.id) {
|
||||||
jumpToPage(id, 'all');
|
jumpToPage(id, 'home');
|
||||||
}
|
}
|
||||||
onClose?.();
|
onClose?.();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import { Component as IndexComponent } from '@affine/core/desktop/pages/index';
|
import { Component as IndexComponent } from '@affine/core/desktop/pages/index';
|
||||||
|
|
||||||
|
import { AppFallback } from '../components/app-fallback';
|
||||||
|
|
||||||
// Default route fallback for mobile
|
// Default route fallback for mobile
|
||||||
|
|
||||||
export const Component = () => {
|
export const Component = () => {
|
||||||
// TODO: replace with a mobile version
|
// TODO: replace with a mobile version
|
||||||
return <IndexComponent defaultIndexRoute={'home'} />;
|
return (
|
||||||
|
<IndexComponent defaultIndexRoute={'home'} fallback={<AppFallback />} />
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user