mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
feat(mobile): use mobile fallback for index, open home when workspace changed (#9106)
This commit is contained in:
@@ -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>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user