Skip to content

Commit

Permalink
🐛 fix: Fix mobile safearea (fix lobehub#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Oct 10, 2023
1 parent caf8ba0 commit 68775b8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
33 changes: 16 additions & 17 deletions src/app/welcome/features/Banner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import { Icon } from '@lobehub/ui';
import { useSize } from 'ahooks';
import { Button, Upload } from 'antd';
import { SendHorizonal } from 'lucide-react';
import Link from 'next/link';
import { memo, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';

import { SESSION_CHAT_URL } from '@/const/url';
import { useImportConfig } from '@/hooks/useImportConfig';
import { useSessionStore } from '@/store/session';

Expand All @@ -23,8 +21,12 @@ const Banner = memo<{ mobile?: boolean }>(({ mobile }) => {
const width = domSize?.width || 1024;
const { t } = useTranslation('welcome');
const { styles } = useStyles();

const switchSession = useSessionStore((s) => s.switchSession);
const [switchSession, switchBackToChat, router, isMobile] = useSessionStore((s) => [
s.switchSession,
s.switchBackToChat,
s.router,
s.isMobile,
]);
const handleImport = useCallback((e: any) => {
importConfig(e);
switchSession();
Expand All @@ -47,20 +49,17 @@ const Banner = memo<{ mobile?: boolean }>(({ mobile }) => {
{t('button.import')}
</Button>
</Upload>
<Link
href={SESSION_CHAT_URL()}
onClick={(e) => {
e.preventDefault();
switchSession();
}}
<Button
block={mobile}
onClick={() => (isMobile ? router?.push('/chat') : switchBackToChat())}
size={'large'}
type={'primary'}
>
<Button block={mobile} size={'large'} type={'primary'}>
<Flexbox align={'center'} gap={4} horizontal justify={'center'}>
{t('button.start')}
<Icon icon={SendHorizonal} />
</Flexbox>
</Button>
</Link>
<Flexbox align={'center'} gap={4} horizontal justify={'center'}>
{t('button.start')}
<Icon icon={SendHorizonal} />
</Flexbox>
</Button>
</Flexbox>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/const/layoutTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FormProps } from '@lobehub/ui';

export const HEADER_HEIGHT = 64;
export const MOBILE_NABBAR_HEIGHT = 44;
export const MOBILE_TABBAR_HEIGHT = 48;
export const MOBILE_TABBAR_HEIGHT = 60;
export const CHAT_TEXTAREA_HEIGHT = 200;
export const CHAT_TEXTAREA_HEIGHT_MOBILE = 120;
export const CHAT_SIDEBAR_WIDTH = 280;
Expand Down
1 change: 1 addition & 0 deletions src/layout/AppLayout.mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const AppLayoutMobile = memo<AppMobileLayoutProps>(
<MobileTabBar className={styles.mobileTabBar} />
</>
)}
<SafeSpacing mobile position={'bottom'} />
</Flexbox>
);
},
Expand Down

0 comments on commit 68775b8

Please sign in to comment.