mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
chore(console): optimize onboarding process (#4389)
This commit is contained in:
parent
0ff7251165
commit
294a146219
4 changed files with 16 additions and 34 deletions
|
@ -4,7 +4,6 @@ import { SignInIdentifier } from '@logto/schemas';
|
||||||
import type { SignInExperience as SignInExperienceType, ConnectorResponse } from '@logto/schemas';
|
import type { SignInExperience as SignInExperienceType, ConnectorResponse } from '@logto/schemas';
|
||||||
import { useCallback, useEffect, useMemo, useContext } from 'react';
|
import { useCallback, useEffect, useMemo, useContext } from 'react';
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import { toast } from 'react-hot-toast';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
@ -241,18 +240,6 @@ function SignInExperience() {
|
||||||
</OverlayScrollbar>
|
</OverlayScrollbar>
|
||||||
<ActionBar step={2}>
|
<ActionBar step={2}>
|
||||||
<div className={styles.continueActions}>
|
<div className={styles.continueActions}>
|
||||||
<Button
|
|
||||||
type="outline"
|
|
||||||
title="general.save"
|
|
||||||
disabled={isSubmitting}
|
|
||||||
onClick={async () => {
|
|
||||||
await handleSubmit(
|
|
||||||
submit(() => {
|
|
||||||
toast.success(t('general.saved'));
|
|
||||||
})
|
|
||||||
)();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
title="cloud.sie.finish_and_done"
|
title="cloud.sie.finish_and_done"
|
||||||
|
|
|
@ -12,39 +12,36 @@ export const defaultOnboardingSieConfig: OnboardingSieConfig = {
|
||||||
authentications: [Authentication.Password],
|
authentications: [Authentication.Password],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Email + password sign-up; password sign-in
|
||||||
const configTemplate1: OnboardingSieConfig = {
|
const configTemplate1: OnboardingSieConfig = {
|
||||||
logo: `${assetsUrl}/tVCAHjAB/logo1.png`,
|
logo: `${assetsUrl}/tVCAHjAB/logo1.png`,
|
||||||
color: '#19BEFD',
|
color: '#19BEFD',
|
||||||
identifier: SignInIdentifier.Email,
|
identifier: SignInIdentifier.Email,
|
||||||
authentications: [Authentication.Password, Authentication.VerificationCode],
|
|
||||||
};
|
|
||||||
|
|
||||||
const configTemplate2: OnboardingSieConfig = {
|
|
||||||
logo: `${assetsUrl}/IcI0snBP/logo3.png`,
|
|
||||||
color: '#FF5449',
|
|
||||||
identifier: SignInIdentifier.Username,
|
|
||||||
authentications: [Authentication.Password],
|
authentications: [Authentication.Password],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Email + password sign-up; password + code sign-in
|
||||||
|
const configTemplate2: OnboardingSieConfig = {
|
||||||
|
logo: `${assetsUrl}/IcI0snBP/logo3.png`,
|
||||||
|
color: '#FF5449',
|
||||||
|
identifier: SignInIdentifier.Email,
|
||||||
|
authentications: [Authentication.Password, Authentication.VerificationCode],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Email + code sign-up; code sign-in
|
||||||
const configTemplate3: OnboardingSieConfig = {
|
const configTemplate3: OnboardingSieConfig = {
|
||||||
logo: `${assetsUrl}/7UQyvuFc/logo4.png`,
|
logo: `${assetsUrl}/7UQyvuFc/logo4.png`,
|
||||||
color: '#CA4E96',
|
color: '#CA4E96',
|
||||||
identifier: SignInIdentifier.Email,
|
identifier: SignInIdentifier.Email,
|
||||||
authentications: [Authentication.Password],
|
|
||||||
};
|
|
||||||
|
|
||||||
const configTemplate4: OnboardingSieConfig = {
|
|
||||||
logo: `${assetsUrl}/zB2merH1/logo5.png`,
|
|
||||||
color: '#F07EFF',
|
|
||||||
identifier: SignInIdentifier.Email,
|
|
||||||
authentications: [Authentication.VerificationCode],
|
authentications: [Authentication.VerificationCode],
|
||||||
};
|
};
|
||||||
|
|
||||||
const configTemplate5: OnboardingSieConfig = {
|
// Username sign-up; password sign-in
|
||||||
|
const configTemplate4: OnboardingSieConfig = {
|
||||||
logo: `${assetsUrl}/uLoMzrlz/logo7.png`,
|
logo: `${assetsUrl}/uLoMzrlz/logo7.png`,
|
||||||
color: '#FF5449',
|
color: '#FF5449',
|
||||||
identifier: SignInIdentifier.Email,
|
identifier: SignInIdentifier.Username,
|
||||||
authentications: [Authentication.Password, Authentication.VerificationCode],
|
authentications: [Authentication.Password],
|
||||||
};
|
};
|
||||||
|
|
||||||
const sieConfigTemplates: OnboardingSieConfig[] = [
|
const sieConfigTemplates: OnboardingSieConfig[] = [
|
||||||
|
@ -52,7 +49,6 @@ const sieConfigTemplates: OnboardingSieConfig[] = [
|
||||||
configTemplate2,
|
configTemplate2,
|
||||||
configTemplate3,
|
configTemplate3,
|
||||||
configTemplate4,
|
configTemplate4,
|
||||||
configTemplate5,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const randomSieConfigTemplate = (
|
export const randomSieConfigTemplate = (
|
||||||
|
|
|
@ -68,11 +68,10 @@ function Welcome() {
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="project"
|
name="project"
|
||||||
rules={{ required: true }}
|
|
||||||
render={({ field: { onChange, value, name } }) => (
|
render={({ field: { onChange, value, name } }) => (
|
||||||
<CardSelector
|
<CardSelector
|
||||||
name={name}
|
name={name}
|
||||||
value={value}
|
value={value ?? ''}
|
||||||
options={projectOptions}
|
options={projectOptions}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -52,7 +52,7 @@ export enum Reason {
|
||||||
}
|
}
|
||||||
|
|
||||||
const questionnaireGuard = z.object({
|
const questionnaireGuard = z.object({
|
||||||
project: z.nativeEnum(Project),
|
project: z.nativeEnum(Project).optional(),
|
||||||
/** @deprecated Open-source options was for cloud preview use, no longer needed. Use default `Cloud` value for placeholder. */
|
/** @deprecated Open-source options was for cloud preview use, no longer needed. Use default `Cloud` value for placeholder. */
|
||||||
deploymentType: z.nativeEnum(DeploymentType).optional().default(DeploymentType.Cloud),
|
deploymentType: z.nativeEnum(DeploymentType).optional().default(DeploymentType.Cloud),
|
||||||
titles: z.array(z.nativeEnum(Title)).optional(),
|
titles: z.array(z.nativeEnum(Title)).optional(),
|
||||||
|
|
Loading…
Reference in a new issue