diff --git a/packages/frontend/core/src/components/affine/auth/index.tsx b/packages/frontend/core/src/components/affine/auth/index.tsx index 6c49646ea..98bbe34b0 100644 --- a/packages/frontend/core/src/components/affine/auth/index.tsx +++ b/packages/frontend/core/src/components/affine/auth/index.tsx @@ -31,6 +31,7 @@ export type AuthPanelProps = { setAuthData: ( updates: { state: T } & Difference, AuthAtomType> ) => void; + onSkip?: () => void; } & Extract; const config: { @@ -100,7 +101,7 @@ export function AuthModal() { ); } -export function AuthPanel() { +export function AuthPanel({ onSkip }: { onSkip?: () => void }) { const t = useI18n(); const [authAtomValue, setAuthAtom] = useAtom(authAtom); const authService = useService(AuthService); @@ -137,6 +138,12 @@ export function AuthPanel() { const CurrentPanel = config[authAtomValue.state]; + const props = { + ...authAtomValue, + onSkip, + setAuthData, + }; + // @ts-expect-error checked in impls - return ; + return ; } diff --git a/packages/frontend/core/src/components/affine/auth/sign-in.tsx b/packages/frontend/core/src/components/affine/auth/sign-in.tsx index 1e38d7603..03fe90e64 100644 --- a/packages/frontend/core/src/components/affine/auth/sign-in.tsx +++ b/packages/frontend/core/src/components/affine/auth/sign-in.tsx @@ -24,6 +24,7 @@ function validateEmail(email: string) { export const SignIn: FC> = ({ setAuthData: setAuthState, + onSkip, }) => { const t = useI18n(); const authService = useService(AuthService); @@ -134,6 +135,29 @@ export const SignIn: FC> = ({ + + {onSkip ? ( + <> +
+
+ or +
+
+
+
+ {t['com.affine.mobile.sign-in.skip.hint']()} +
+ +
+ + ) : null} ); }; diff --git a/packages/frontend/core/src/components/affine/auth/style.css.ts b/packages/frontend/core/src/components/affine/auth/style.css.ts index fdbe8d55b..64257cb73 100644 --- a/packages/frontend/core/src/components/affine/auth/style.css.ts +++ b/packages/frontend/core/src/components/affine/auth/style.css.ts @@ -1,4 +1,5 @@ import { cssVar } from '@toeverything/theme'; +import { cssVarV2 } from '@toeverything/theme/v2'; import { globalStyle, style } from '@vanilla-extract/css'; export const authModalContent = style({ marginTop: '30px', @@ -113,3 +114,44 @@ export const userPlanButton = style({ }, }, }); + +export const skipDivider = style({ + display: 'flex', + gap: 12, + alignItems: 'center', + height: 20, + marginTop: 12, + marginBottom: 12, +}); + +export const skipDividerLine = style({ + flex: 1, + height: 0, + borderBottom: `1px solid ${cssVarV2('layer/insideBorder/border')}`, +}); + +export const skipDividerText = style({ + color: cssVarV2('text/secondary'), + fontSize: cssVar('fontXs'), +}); + +export const skipText = style({ + color: cssVarV2('text/primary'), + fontSize: cssVar('fontXs'), + fontWeight: 500, +}); + +export const skipLink = style({ + color: cssVarV2('text/link'), + fontSize: cssVar('fontXs'), +}); + +export const skipLinkIcon = style({ + color: cssVarV2('text/link'), +}); + +export const skipSection = style({ + display: 'flex', + flexDirection: 'column', + alignItems: 'center', +}); diff --git a/packages/frontend/core/src/pages/auth/sign-in.tsx b/packages/frontend/core/src/pages/auth/sign-in.tsx index 8a5f8c7fc..ae4b0c8f2 100644 --- a/packages/frontend/core/src/pages/auth/sign-in.tsx +++ b/packages/frontend/core/src/pages/auth/sign-in.tsx @@ -41,7 +41,7 @@ export const SignIn = () => { return (
- +
); diff --git a/packages/frontend/mobile/src/views/sign-in/layout.css.ts b/packages/frontend/mobile/src/views/sign-in/layout.css.ts index f9cedccf0..33558ead1 100644 --- a/packages/frontend/mobile/src/views/sign-in/layout.css.ts +++ b/packages/frontend/mobile/src/views/sign-in/layout.css.ts @@ -1,5 +1,3 @@ -import { cssVar } from '@toeverything/theme'; -import { cssVarV2 } from '@toeverything/theme/v2'; import { style } from '@vanilla-extract/css'; export const root = style({ @@ -18,44 +16,3 @@ export const content = style({ alignItems: 'stretch', gap: 24, }); - -export const skipDivider = style({ - display: 'flex', - gap: 12, - alignItems: 'center', - height: 20, - marginTop: 12, - marginBottom: 12, -}); - -export const skipDividerLine = style({ - flex: 1, - height: 0, - borderBottom: `1px solid ${cssVarV2('layer/insideBorder/border')}`, -}); - -export const skipDividerText = style({ - color: cssVarV2('text/secondary'), - fontSize: cssVar('fontXs'), -}); - -export const skipText = style({ - color: cssVarV2('text/primary'), - fontSize: cssVar('fontXs'), - fontWeight: 500, -}); - -export const skipLink = style({ - color: cssVarV2('text/link'), - fontSize: cssVar('fontXs'), -}); - -export const skipLinkIcon = style({ - color: cssVarV2('text/link'), -}); - -export const skipSection = style({ - display: 'flex', - flexDirection: 'column', - alignItems: 'center', -}); diff --git a/packages/frontend/mobile/src/views/sign-in/layout.tsx b/packages/frontend/mobile/src/views/sign-in/layout.tsx index 91a3810a3..115fd4c48 100644 --- a/packages/frontend/mobile/src/views/sign-in/layout.tsx +++ b/packages/frontend/mobile/src/views/sign-in/layout.tsx @@ -1,40 +1,13 @@ -import { Button } from '@affine/component'; -import { useI18n } from '@affine/i18n'; -import { ArrowRightBigIcon } from '@blocksuite/icons/rc'; import type { PropsWithChildren } from 'react'; import { SignInBackground } from './background'; import * as styles from './layout.css'; -export const MobileSignInLayout = ({ - children, - onSkip, -}: PropsWithChildren<{ - onSkip: () => void; -}>) => { - const t = useI18n(); +export const MobileSignInLayout = ({ children }: PropsWithChildren) => { return (
{children}
-
-
- or -
-
-
-
- {t['com.affine.mobile.sign-in.skip.hint']()} -
- -
); }; diff --git a/packages/frontend/mobile/src/views/sign-in/mobile-sign-in.tsx b/packages/frontend/mobile/src/views/sign-in/mobile-sign-in.tsx index 0a35891bb..7005236b3 100644 --- a/packages/frontend/mobile/src/views/sign-in/mobile-sign-in.tsx +++ b/packages/frontend/mobile/src/views/sign-in/mobile-sign-in.tsx @@ -4,8 +4,8 @@ import { MobileSignInLayout } from './layout'; export const MobileSignIn = ({ onSkip }: { onSkip: () => void }) => { return ( - - + + ); };