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.

fix(mobile): adjust mobile UI (#8719)

CatsJuice06591db8d9f1
diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.css.ts b/packages/frontend/component/src/ui/modal/confirm-modal.css.ts
index 3c070f245a..df56bd3f27 100644
--- a/packages/frontend/component/src/ui/modal/confirm-modal.css.ts
+++ b/packages/frontend/component/src/ui/modal/confirm-modal.css.ts
@@ -1,3 +1,4 @@
+import { bodyEmphasized, bodyRegular } from '@toeverything/theme/typography';
import { style } from '@vanilla-extract/css';
// desktop
@@ -41,28 +42,25 @@ export const mobileStyles = {
padding: '12px 0 !important',
borderRadius: 22,
}),
- description: style({
- padding: '11px 22px',
- fontSize: 17,
- fontWeight: 400,
- letterSpacing: -0.43,
- lineHeight: '22px',
- }),
- header: style({
- padding: '10px 16px',
- marginBottom: '0px !important',
- fontSize: 17,
- fontWeight: 600,
- letterSpacing: -0.43,
- lineHeight: '22px',
- }),
- content: style({
- padding: '11px 22px',
- fontSize: 17,
- fontWeight: 400,
- letterSpacing: -0.43,
- lineHeight: '22px',
- }),
+ description: style([
+ bodyRegular,
+ {
+ padding: '11px 22px',
+ },
+ ]),
+ header: style([
+ bodyEmphasized,
+ {
+ padding: '10px 16px',
+ marginBottom: '0px !important',
+ },
+ ]),
+ content: style([
+ bodyRegular,
+ {
+ padding: '11px 22px',
+ },
+ ]),
footer: style({
padding: '8px 16px',
display: 'flex',
@@ -74,13 +72,14 @@ export const mobileStyles = {
},
},
}),
- action: style({
- width: '100%',
- height: 44,
- borderRadius: 8,
- fontSize: 17,
- fontWeight: 400,
- letterSpacing: -0.43,
- lineHeight: '22px',
- }),
+ action: style([
+ bodyRegular,
+ {
+ width: '100%',
+ height: 44,
+ borderRadius: 8,
+ fontSize: 17,
+ fontWeight: 400,
+ },
+ ]),
};
diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.tsx b/packages/frontend/component/src/ui/modal/confirm-modal.tsx
index 299ed53386..f69f064570 100644
--- a/packages/frontend/component/src/ui/modal/confirm-modal.tsx
+++ b/packages/frontend/component/src/ui/modal/confirm-modal.tsx
@@ -40,6 +40,7 @@ export const ConfirmModal = ({
autoFocusConfirm = true,
headerClassName,
descriptionClassName,
+ contentOptions,
...props
}: ConfirmModalProps) => {
const onConfirmClick = useCallback(() => {
@@ -50,7 +51,8 @@ export const ConfirmModal = ({
return (
<Modal
contentOptions={{
- className: styles.container,
+ ...contentOptions,
+ className: clsx(styles.container, contentOptions?.className),
onPointerDownOutside: e => {
e.stopPropagation();
onCancel?.();
diff --git a/packages/frontend/core/src/mobile/components/explorer/layouts/collapsible-section.css.ts b/packages/frontend/core/src/mobile/components/explorer/layouts/collapsible-section.css.ts
index 40b82dbe5f..a7a97549fe 100644
--- a/packages/frontend/core/src/mobile/components/explorer/layouts/collapsible-section.css.ts
+++ b/packages/frontend/core/src/mobile/components/explorer/layouts/collapsible-section.css.ts
@@ -1,5 +1,5 @@
import { cssVar } from '@toeverything/theme';
-import { title3Regular } from '@toeverything/theme/typography';
+import { headlineRegular } from '@toeverything/theme/typography';
import { cssVarV2 } from '@toeverything/theme/v2';
import { style } from '@vanilla-extract/css';
@@ -21,7 +21,7 @@ export const triggerRoot = style({
borderRadius: 4,
});
export const triggerLabel = style([
- title3Regular,
+ headlineRegular,
{
flexGrow: '0',
display: 'flex',
diff --git a/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx b/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx
index 50074f0dcb..19a660a026 100644
--- a/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx
+++ b/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx
@@ -1,3 +1,4 @@
+import { Skeleton } from '@affine/component';
import {
AuthService,
ServerConfigService,
@@ -7,7 +8,7 @@ import {
import { useLiveData, useService } from '@toeverything/infra';
import { cssVar } from '@toeverything/theme';
import { cssVarV2 } from '@toeverything/theme/v2';
-import { useEffect } from 'react';
+import { type ReactNode, useEffect } from 'react';
import { SettingGroup } from '../group';
import * as styles from './style.css';
@@ -28,11 +29,13 @@ const Progress = ({
percent,
desc,
color,
+ children,
}: {
- name: string;
- percent: number;
- desc: string;
- color: string | null;
+ name: ReactNode;
+ desc: ReactNode;
+ percent?: number;
+ color?: string | null;
+ children?: React.ReactNode;
}) => {
return (
<div className={styles.progressRoot}>
@@ -40,19 +43,33 @@ const Progress = ({
<span className={styles.progressName}>{name}</span>
<span className={styles.progressDesc}>{desc}</span>
</div>
- <div className={styles.progressTrack}>
- <div
- className={styles.progressBar}
- style={{
- width: `${percent}%`,
- backgroundColor: color ?? cssVarV2('button/primary'),
- }}
- />
- </div>
+ {children ?? (
+ <div className={styles.progressTrack}>
+ <div
+ className={styles.progressBar}
+ style={{
+ width: `${percent}%`,
+ backgroundColor: color ?? cssVarV2('button/primary'),
+ }}
+ />
+ </div>
+ )}
</div>
);
};
+const skeletonProps = { style: { margin: 0 }, animation: 'wave' } as const;
+const Loading = () => {
+ return (
+ <Progress
+ name={<Skeleton height={22} width="60" {...skeletonProps} />}
+ desc={<Skeleton height={16} width="80" {...skeletonProps} />}
+ >
+ <Skeleton height={10} {...skeletonProps} />
+ </Progress>
+ );
+};
+
const UsagePanel = () => {
const serverConfigService = useService(ServerConfigService);
const serverFeatures = useLiveData(
@@ -82,7 +99,7 @@ const CloudUsage = () => {
const loading = percent === null;
- if (loading) return null;
+ if (loading) return <Loading />;
return (
<Progress
@@ -110,7 +127,7 @@ const AiUsage = () => {
}, [copilotQuotaService]);
if (loading || loadError) {
- return null;
+ return <Loading />;
}
if (copilotActionLimit === 'unlimited') {
diff --git a/packages/frontend/core/src/mobile/styles/mobile.css.ts b/packages/frontend/core/src/mobile/styles/mobile.css.ts
index ba96a4c369..394dac3019 100644
--- a/packages/frontend/core/src/mobile/styles/mobile.css.ts
+++ b/packages/frontend/core/src/mobile/styles/mobile.css.ts
@@ -9,6 +9,7 @@ globalStyle(':root', {
vars: {
[globalVars.appTabHeight]: BUILD_CONFIG.isIOS ? '49px' : '62px',
},
+ userSelect: 'none',
});
globalStyle('body', {
diff --git a/packages/frontend/core/src/mobile/views/all-docs/style.css.ts b/packages/frontend/core/src/mobile/views/all-docs/style.css.ts
index 90ecc5775c..cb9a27851f 100644
--- a/packages/frontend/core/src/mobile/views/all-docs/style.css.ts
+++ b/packages/frontend/core/src/mobile/views/all-docs/style.css.ts
@@ -3,7 +3,7 @@ import { style } from '@vanilla-extract/css';
const basicHeader = style({
width: '100%',
- height: 56,
+ height: 44,
});
export const header = style({
width: '100%',
@@ -25,7 +25,7 @@ export const headerContent = style([
]);
export const tabs = style({
- height: 56,
+ height: 44,
gap: 16,
display: 'flex',
alignItems: 'center',
diff --git a/packages/frontend/core/src/mobile/views/sign-in/modal.tsx b/packages/frontend/core/src/mobile/views/sign-in/modal.tsx
index 6336884226..c9c4f4c098 100644
--- a/packages/frontend/core/src/mobile/views/sign-in/modal.tsx
+++ b/packages/frontend/core/src/mobile/views/sign-in/modal.tsx
@@ -1,5 +1,6 @@
-import { Modal } from '@affine/component';
+import { IconButton, Modal, SafeArea } from '@affine/component';
import { authAtom } from '@affine/core/components/atoms';
+import { CloseIcon } from '@blocksuite/icons/rc';
import { cssVarV2 } from '@toeverything/theme/v2';
import { useAtom } from 'jotai';
import { useCallback } from 'react';
@@ -35,6 +36,19 @@ export const MobileSignInModal = () => {
withoutCloseButton
>
<MobileSignIn onSkip={closeModal} />
+ <SafeArea
+ top
+ style={{ position: 'absolute', top: 0, right: 0, paddingRight: 16 }}
+ topOffset={8}
+ >
+ <IconButton
+ size="24"
+ variant="solid"
+ icon={<CloseIcon />}
+ style={{ borderRadius: 8, padding: 4 }}
+ onClick={closeModal}
+ />
+ </SafeArea>
</Modal>
);
};