mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-21 07:21:37 +03:00
feat(mobile): use mobile fallback for index, open home when workspace changed (#9106)
This commit is contained in:
parent
974c6de1d2
commit
6f6f95a8b0
@ -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 */,
|
||||
|
@ -50,4 +50,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: e0c0ccf027ea6d51e476f0baf9d44d97b9a90a4b
|
||||
|
||||
COCOAPODS: 1.15.2
|
||||
COCOAPODS: 1.16.2
|
||||
|
@ -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>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ const WorkspaceList = ({
|
||||
const toggleWorkspace = useCallback(
|
||||
(id: string) => {
|
||||
if (id !== currentWorkspace.id) {
|
||||
jumpToPage(id, 'all');
|
||||
jumpToPage(id, 'home');
|
||||
}
|
||||
onClose?.();
|
||||
},
|
||||
|
@ -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 />} />
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user