mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-07 05:16:30 +03:00
feat(core): add indicator for general ai onboarding dialog (#6687)
This commit is contained in:
parent
21cbef4e20
commit
2a2b1cea28
@ -98,11 +98,21 @@ export const footer = style({
|
|||||||
gap: 12,
|
gap: 12,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
selectors: {
|
alignItems: 'center',
|
||||||
'&[data-is-last="true"], &[data-is-first="true"]': {
|
});
|
||||||
justifyContent: 'flex-end',
|
export const actionAndIndicator = style({
|
||||||
},
|
display: 'flex',
|
||||||
},
|
gap: 16,
|
||||||
|
alignItems: 'center',
|
||||||
|
fontWeight: 500,
|
||||||
|
fontSize: cssVar('fontXs'),
|
||||||
|
lineHeight: '20px',
|
||||||
|
color: cssVar('textSecondaryColor'),
|
||||||
|
});
|
||||||
|
export const subscribeActions = style({
|
||||||
|
display: 'flex',
|
||||||
|
gap: 12,
|
||||||
|
alignItems: 'center',
|
||||||
});
|
});
|
||||||
export const baseActionButton = style({
|
export const baseActionButton = style({
|
||||||
fontSize: cssVar('fontBase'),
|
fontSize: cssVar('fontBase'),
|
||||||
@ -112,3 +122,9 @@ export const baseActionButton = style({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
export const transparentActionButton = style([
|
||||||
|
baseActionButton,
|
||||||
|
{
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Button, Modal } from '@affine/component';
|
import { Button, IconButton, Modal } from '@affine/component';
|
||||||
import { openSettingModalAtom } from '@affine/core/atoms';
|
import { openSettingModalAtom } from '@affine/core/atoms';
|
||||||
import { useBlurRoot } from '@affine/core/hooks/use-blur-root';
|
import { useBlurRoot } from '@affine/core/hooks/use-blur-root';
|
||||||
import { SubscriptionService } from '@affine/core/modules/cloud';
|
import { SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
@ -90,6 +90,9 @@ export const AIOnboardingGeneral = ({
|
|||||||
const isFirst = index === 0;
|
const isFirst = index === 0;
|
||||||
const isLast = index === list.length - 1;
|
const isLast = index === list.length - 1;
|
||||||
|
|
||||||
|
const remindLater = useCallback(() => {
|
||||||
|
showAIOnboardingGeneral$.next(false);
|
||||||
|
}, []);
|
||||||
const closeAndDismiss = useCallback(() => {
|
const closeAndDismiss = useCallback(() => {
|
||||||
showAIOnboardingGeneral$.next(false);
|
showAIOnboardingGeneral$.next(false);
|
||||||
onDismiss();
|
onDismiss();
|
||||||
@ -216,37 +219,55 @@ export const AIOnboardingGeneral = ({
|
|||||||
data-is-first={isFirst}
|
data-is-first={isFirst}
|
||||||
>
|
>
|
||||||
{isLast ? (
|
{isLast ? (
|
||||||
aiSubscription ? (
|
<>
|
||||||
<Button
|
<IconButton
|
||||||
|
size="default"
|
||||||
|
icon={<ArrowLeftSmallIcon width={20} height={20} />}
|
||||||
|
onClick={onPrev}
|
||||||
|
type="plain"
|
||||||
className={styles.baseActionButton}
|
className={styles.baseActionButton}
|
||||||
size="large"
|
/>
|
||||||
onClick={closeAndDismiss}
|
{aiSubscription ? (
|
||||||
type="primary"
|
|
||||||
>
|
|
||||||
{t['com.affine.ai-onboarding.general.get-started']()}
|
|
||||||
</Button>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Button
|
<Button
|
||||||
className={styles.baseActionButton}
|
className={styles.baseActionButton}
|
||||||
size="large"
|
size="large"
|
||||||
onClick={closeAndDismiss}
|
onClick={closeAndDismiss}
|
||||||
>
|
|
||||||
{t['com.affine.ai-onboarding.general.try-for-free']()}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
className={styles.baseActionButton}
|
|
||||||
size="large"
|
|
||||||
onClick={goToPricingPlans}
|
|
||||||
type="primary"
|
type="primary"
|
||||||
>
|
>
|
||||||
{t['com.affine.ai-onboarding.general.purchase']()}
|
{t['com.affine.ai-onboarding.general.get-started']()}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
) : (
|
||||||
)
|
<div className={styles.subscribeActions}>
|
||||||
|
<Button
|
||||||
|
className={styles.baseActionButton}
|
||||||
|
size="large"
|
||||||
|
onClick={closeAndDismiss}
|
||||||
|
>
|
||||||
|
{t['com.affine.ai-onboarding.general.try-for-free']()}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className={styles.baseActionButton}
|
||||||
|
size="large"
|
||||||
|
onClick={goToPricingPlans}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
{t['com.affine.ai-onboarding.general.purchase']()}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{isFirst ? null : (
|
{isFirst ? (
|
||||||
|
<Button
|
||||||
|
className={styles.transparentActionButton}
|
||||||
|
onClick={remindLater}
|
||||||
|
size="large"
|
||||||
|
type="default"
|
||||||
|
>
|
||||||
|
{t['com.affine.ai-onboarding.general.skip']()}
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
<Button
|
<Button
|
||||||
icon={<ArrowLeftSmallIcon />}
|
icon={<ArrowLeftSmallIcon />}
|
||||||
className={styles.baseActionButton}
|
className={styles.baseActionButton}
|
||||||
@ -257,14 +278,19 @@ export const AIOnboardingGeneral = ({
|
|||||||
{t['com.affine.ai-onboarding.general.prev']()}
|
{t['com.affine.ai-onboarding.general.prev']()}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<div className={styles.actionAndIndicator}>
|
||||||
className={styles.baseActionButton}
|
<div>
|
||||||
size="large"
|
{index + 1} / {list.length}
|
||||||
type="primary"
|
</div>
|
||||||
onClick={onNext}
|
<Button
|
||||||
>
|
className={styles.baseActionButton}
|
||||||
{t['com.affine.ai-onboarding.general.next']()}
|
size="large"
|
||||||
</Button>
|
type="primary"
|
||||||
|
onClick={onNext}
|
||||||
|
>
|
||||||
|
{t['com.affine.ai-onboarding.general.next']()}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -1294,7 +1294,7 @@
|
|||||||
"com.affine.ai-onboarding.general.4.description": "From concept to completion, turn ideas into reality.",
|
"com.affine.ai-onboarding.general.4.description": "From concept to completion, turn ideas into reality.",
|
||||||
"com.affine.ai-onboarding.general.5.title": "AFFiNE AI is ready",
|
"com.affine.ai-onboarding.general.5.title": "AFFiNE AI is ready",
|
||||||
"com.affine.ai-onboarding.general.5.description": "Go to <a>{{link}}</a> for learn more details about AFFiNE AI.",
|
"com.affine.ai-onboarding.general.5.description": "Go to <a>{{link}}</a> for learn more details about AFFiNE AI.",
|
||||||
"com.affine.ai-onboarding.general.skip": "Alert me later",
|
"com.affine.ai-onboarding.general.skip": "Remind me Later",
|
||||||
"com.affine.ai-onboarding.general.next": "Next",
|
"com.affine.ai-onboarding.general.next": "Next",
|
||||||
"com.affine.ai-onboarding.general.prev": "Back",
|
"com.affine.ai-onboarding.general.prev": "Back",
|
||||||
"com.affine.ai-onboarding.general.try-for-free": "Try for Free",
|
"com.affine.ai-onboarding.general.try-for-free": "Try for Free",
|
||||||
|
Loading…
Reference in New Issue
Block a user