0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(console): display full sign-up and sign-in config in the change alert (#2382)

This commit is contained in:
Xiao Yijun 2022-11-10 12:31:59 +08:00 committed by GitHub
parent f64a0f2df4
commit 073870f495
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@ import type { SignInExperience } from '@logto/schemas';
import SignInDiffSection from './SignInDiffSection';
import SignUpDiffSection from './SignUpDiffSection';
import SocialTargetsDiffSection from './SocialTargetsDiffSection';
import { isSignInMethodsDifferent, isSignUpDifferent, isSocialTargetsDifferent } from './utilities';
type Props = {
before: SignInExperience;
@ -11,35 +10,20 @@ type Props = {
isAfter?: boolean;
};
const SignUpAndSignInDiffSection = ({ before, after, isAfter = false }: Props) => {
const showSignUpDiff = isSignUpDifferent(before.signUp, after.signUp);
const showSignInDiff = isSignInMethodsDifferent(before.signIn.methods, after.signIn.methods);
const showSocialDiff = isSocialTargetsDifferent(
before.socialSignInConnectorTargets,
after.socialSignInConnectorTargets
);
return (
<>
{showSignUpDiff && (
<SignUpDiffSection before={before.signUp} after={after.signUp} isAfter={isAfter} />
)}
{showSignInDiff && (
<SignInDiffSection
before={before.signIn.methods}
after={after.signIn.methods}
isAfter={isAfter}
/>
)}
{showSocialDiff && (
<SocialTargetsDiffSection
before={before.socialSignInConnectorTargets}
after={after.socialSignInConnectorTargets}
isAfter={isAfter}
/>
)}
</>
);
};
const SignUpAndSignInDiffSection = ({ before, after, isAfter = false }: Props) => (
<>
<SignUpDiffSection before={before.signUp} after={after.signUp} isAfter={isAfter} />
<SignInDiffSection
before={before.signIn.methods}
after={after.signIn.methods}
isAfter={isAfter}
/>
<SocialTargetsDiffSection
before={before.socialSignInConnectorTargets}
after={after.socialSignInConnectorTargets}
isAfter={isAfter}
/>
</>
);
export default SignUpAndSignInDiffSection;