diff --git a/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts b/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts index a79594a3e..412fcdd56 100644 --- a/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts +++ b/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts @@ -1,28 +1,65 @@ import { globalStyle, style } from '@vanilla-extract/css'; +export const layout = style({ + backgroundColor: 'var(--affine-background-primary-color)', + height: '100vh', + display: 'flex', + flexDirection: 'column', + overflow: 'hidden', + selectors: { + '&[data-is-macos-electron="true"]': { + margin: '8px', + borderRadius: '8px', + height: 'calc(100vh - 16px)', + }, + }, +}); + +export const header = style({ + paddingTop: '24px', + paddingRight: '24px', + + position: 'sticky', + top: 0, + display: 'flex', + flexDirection: 'column', + alignItems: 'flex-end', + ['WebkitAppRegion' as string]: 'drag', + selectors: { + '&[data-is-windows-electron="true"]': { + paddingTop: '0', + paddingRight: '0', + gap: '16px', + }, + }, +}); +export const footer = style({ + padding: '20px', + position: 'sticky', + bottom: 0, + backgroundColor: 'var(--affine-background-primary-color)', +}); + export const scrollableContainer = style({ display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', - height: '100vh', - padding: '0 200px', - backgroundColor: 'var(--affine-background-primary-color)', + padding: '80px 200px 160px', + '@media': { 'screen and (max-width: 1024px)': { - padding: '80px 36px', - alignItems: 'center', + padding: '0px 36px 80px', }, }, }); export const onboardingContainer = style({ maxWidth: '600px', - padding: '160px 0', '@media': { 'screen and (max-width: 1024px)': { padding: '40px 0', - width: '100%', + maxWidth: '100%', }, }, }); @@ -49,7 +86,6 @@ export const optionsWrapper = style({ flexDirection: 'column', alignItems: 'flex-start', gap: '16px', - // flexShrink: 0, flexGrow: 1, }); @@ -95,10 +131,13 @@ export const openAFFiNEButton = style({ alignSelf: 'flex-start', }); -export const rightCornerButton = style({ +export const disableButton = style({ position: 'absolute', - top: '24px', - right: '24px', + display: 'none', + pointerEvents: 'none', +}); +export const windowsAppButton = style({ + marginRight: '24px', }); export const thankContainer = style({ @@ -122,9 +161,6 @@ export const thankText = style({ export const linkGroup = style({ display: 'flex', - position: 'absolute', - bottom: '24px', - right: '24px', fontSize: 'var(--affine-font-xs)', height: '16px', gap: '6px', diff --git a/packages/frontend/component/src/components/auth-components/onboarding-page.tsx b/packages/frontend/component/src/components/auth-components/onboarding-page.tsx index a2c9ef962..96fe6a8c2 100644 --- a/packages/frontend/component/src/components/auth-components/onboarding-page.tsx +++ b/packages/frontend/component/src/components/auth-components/onboarding-page.tsx @@ -1,7 +1,8 @@ +import { apis } from '@affine/electron-api'; import { fetchWithTraceReport } from '@affine/graphql'; import { ArrowRightSmallIcon } from '@blocksuite/icons'; import clsx from 'clsx'; -import { useMemo, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { type Location, useLocation, useNavigate } from 'react-router-dom'; import useSWR from 'swr'; @@ -50,43 +51,60 @@ function getCallbackUrl(location: Location) { } export const ScrollableLayout = ({ + headerItems, children, + isMacosDesktop, + isWindowsDesktop, }: { + isMacosDesktop?: boolean; + isWindowsDesktop?: boolean; + headerItems?: React.ReactNode; children: React.ReactNode; }) => { return ( - -
{children}
- -
- - Terms of Conditions - - - - Privacy Policy - -
-
+
+
+ {headerItems} +
+ +
{children}
+
+ +
); }; export const OnboardingPage = ({ user, onOpenAffine, + windowControl, }: { user: User; onOpenAffine: () => void; + windowControl?: React.ReactNode; }) => { const location = useLocation(); const navigate = useNavigate(); @@ -104,6 +122,17 @@ export const OnboardingPage = ({ () => questions?.[questionIdx], [questionIdx, questions] ); + const isMacosDesktop = environment.isDesktop && environment.isMacOs; + const isWindowsDesktop = environment.isDesktop && environment.isWindows; + + useEffect(() => { + if (environment.isDesktop) { + // to hide macOS window control buttons + apis?.ui.handleSidebarVisibilityChange(false).catch(err => { + console.error(err); + }); + } + }, []); if (!questions) { return null; @@ -119,7 +148,25 @@ export const OnboardingPage = ({ if (question) { return ( - + + {isWindowsDesktop ? windowControl : null} + + + } + isMacosDesktop={isMacosDesktop} + isWindowsDesktop={isWindowsDesktop} + >

{question.question}

@@ -168,7 +215,7 @@ export const OnboardingPage = ({