Fix labels on auth forms

This commit is contained in:
ErickSkrauch 2020-07-24 19:19:11 +03:00
parent 208817f69e
commit 108e5eb0e9
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
12 changed files with 47 additions and 40 deletions

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './AcceptRulesBody'; import Body from './AcceptRulesBody';
const messages = defineMessages({ const messages = defineMessages({
title: 'User Agreement', title: 'User Agreement',
accept: 'Accept',
declineAndLogout: 'Decline and logout', declineAndLogout: 'Decline and logout',
}); });
@ -14,7 +15,7 @@ export default factory({
footer: { footer: {
color: 'darkBlue', color: 'darkBlue',
autoFocus: true, autoFocus: true,
label: messages.accept, children: <Message key="accept" defaultMessage="Accept" />,
}, },
links: { links: {
label: messages.declineAndLogout, label: messages.declineAndLogout,

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './ActivationBody'; import Body from './ActivationBody';
const messages = defineMessages({ const messages = defineMessages({
accountActivationTitle: 'Account activation', accountActivationTitle: 'Account activation',
confirmEmail: 'Confirm Email',
didNotReceivedEmail: 'Did not received Email?', didNotReceivedEmail: 'Did not received Email?',
}); });
@ -13,7 +14,7 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'blue', color: 'blue',
label: messages.confirmEmail, children: <Message key="confirmEmail" defaultMessage="Confirm Email" />,
}, },
links: { links: {
label: messages.didNotReceivedEmail, label: messages.didNotReceivedEmail,

View File

@ -1,10 +1,10 @@
import { defineMessages } from 'react-intl'; import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './ChooseAccountBody'; import Body from './ChooseAccountBody';
const messages = defineMessages({ const messages = defineMessages({
chooseAccountTitle: 'Choose an account', chooseAccountTitle: 'Choose an account',
addAccount: 'Log into another account',
logoutAll: 'Log out from all accounts', logoutAll: 'Log out from all accounts',
}); });
@ -12,7 +12,7 @@ export default factory({
title: messages.chooseAccountTitle, title: messages.chooseAccountTitle,
body: Body, body: Body,
footer: { footer: {
label: messages.addAccount, children: <Message key="addAccount" defaultMessage="Log into another account" />,
}, },
links: [ links: [
{ {

View File

@ -1,9 +1,10 @@
import React, { ComponentProps, ComponentType } from 'react'; import React, { ComponentProps, ComponentType } from 'react';
import { MessageDescriptor } from 'react-intl';
import { Button } from 'app/components/ui/form'; import { Button } from 'app/components/ui/form';
import RejectionLink from 'app/components/auth/RejectionLink'; import RejectionLink from 'app/components/auth/RejectionLink';
import AuthTitle from 'app/components/auth/AuthTitle'; import AuthTitle from 'app/components/auth/AuthTitle';
import { MessageDescriptor } from 'react-intl';
import { Color } from 'app/components/ui';
import BaseAuthBody from './BaseAuthBody'; import BaseAuthBody from './BaseAuthBody';
export type Factory = () => { export type Factory = () => {
@ -17,11 +18,7 @@ type RejectionLinkProps = ComponentProps<typeof RejectionLink>;
interface FactoryParams { interface FactoryParams {
title: MessageDescriptor; title: MessageDescriptor;
body: typeof BaseAuthBody; body: typeof BaseAuthBody;
footer: { footer: Omit<ComponentProps<typeof Button>, 'type'>;
color?: Color;
label: string | MessageDescriptor;
autoFocus?: boolean;
};
links?: RejectionLinkProps | Array<RejectionLinkProps>; links?: RejectionLinkProps | Array<RejectionLinkProps>;
} }

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './ForgotPasswordBody'; import Body from './ForgotPasswordBody';
const messages = defineMessages({ const messages = defineMessages({
title: 'Forgot password', title: 'Forgot password',
sendMail: 'Send mail',
alreadyHaveCode: 'Already have a code', alreadyHaveCode: 'Already have a code',
}); });
@ -14,7 +15,7 @@ export default factory({
footer: { footer: {
color: 'lightViolet', color: 'lightViolet',
autoFocus: true, autoFocus: true,
label: messages.sendMail, children: <Message key="sendMail" defaultMessage="Send mail" />,
}, },
links: { links: {
label: messages.alreadyHaveCode, label: messages.alreadyHaveCode,

View File

@ -1,11 +1,12 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './LoginBody'; import Body from './LoginBody';
const messages = defineMessages({ const messages = defineMessages({
createNewAccount: 'Create new account', createNewAccount: 'Create new account',
loginTitle: 'Sign in', loginTitle: 'Sign in',
next: 'Next',
}); });
export default factory({ export default factory({
@ -13,7 +14,7 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'green', color: 'green',
label: messages.next, children: <Message key="next" defaultMessage="Next" />,
}, },
links: { links: {
isAvailable: (context) => !context.user.isGuest, isAvailable: (context) => !context.user.isGuest,

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './MfaBody'; import Body from './MfaBody';
const messages = defineMessages({ const messages = defineMessages({
enterTotp: 'Enter code', enterTotp: 'Enter code',
signInButton: 'Sign in',
}); });
export default factory({ export default factory({
@ -12,6 +13,6 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'green', color: 'green',
label: messages.signInButton, children: <Message key="signInButton" defaultMessage="Sign in" />,
}, },
}); });

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './PasswordBody'; import Body from './PasswordBody';
const messages = defineMessages({ const messages = defineMessages({
passwordTitle: 'Enter password', passwordTitle: 'Enter password',
signInButton: 'Sign in',
forgotPassword: 'Forgot password', forgotPassword: 'Forgot password',
}); });
@ -13,7 +14,7 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'green', color: 'green',
label: messages.signInButton, children: <Message key="signInButton" defaultMessage="Sign in" />,
}, },
links: { links: {
label: messages.forgotPassword, label: messages.forgotPassword,

View File

@ -1,11 +1,12 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './PermissionsBody'; import Body from './PermissionsBody';
const messages = defineMessages({ const messages = defineMessages({
permissionsTitle: 'Application permissions', permissionsTitle: 'Application permissions',
decline: 'Decline', decline: 'Decline',
approve: 'Approve',
}); });
export default factory({ export default factory({
@ -14,7 +15,7 @@ export default factory({
footer: { footer: {
color: 'orange', color: 'orange',
autoFocus: true, autoFocus: true,
label: messages.approve, children: <Message key="approve" defaultMessage="Approve" />,
}, },
links: { links: {
label: messages.decline, label: messages.decline,

View File

@ -1,11 +1,12 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './RecoverPasswordBody'; import Body from './RecoverPasswordBody';
const messages = defineMessages({ const messages = defineMessages({
title: 'Restore password', title: 'Restore password',
contactSupport: 'Contact support', contactSupport: 'Contact support',
change: 'Change password',
}); });
export default factory({ export default factory({
@ -13,7 +14,7 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'lightViolet', color: 'lightViolet',
label: messages.change, children: <Message key="change" defaultMessage="Change password" />,
}, },
links: { links: {
label: messages.contactSupport, label: messages.contactSupport,

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './RegisterBody'; import Body from './RegisterBody';
const messages = defineMessages({ const messages = defineMessages({
registerTitle: 'Sign Up', registerTitle: 'Sign Up',
signUpButton: 'Register',
didNotReceivedEmail: 'Did not received Email?', didNotReceivedEmail: 'Did not received Email?',
alreadyHaveCode: 'Already have a code', alreadyHaveCode: 'Already have a code',
}); });
@ -14,7 +15,7 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'blue', color: 'blue',
label: messages.signUpButton, children: <Message key="signUpButton" defaultMessage="Register" />,
}, },
links: [ links: [
{ {

View File

@ -1,10 +1,11 @@
import { defineMessages } from 'react-intl'; import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import factory from '../factory'; import factory from '../factory';
import Body from './ResendActivationBody'; import Body from './ResendActivationBody';
const messages = defineMessages({ const messages = defineMessages({
title: 'Did not received an Email', title: 'Did not received an Email',
sendNewEmail: 'Send new Email',
alreadyHaveCode: 'Already have a code', alreadyHaveCode: 'Already have a code',
}); });
@ -13,7 +14,7 @@ export default factory({
body: Body, body: Body,
footer: { footer: {
color: 'blue', color: 'blue',
label: messages.sendNewEmail, children: <Message key="sendNewEmail" defaultMessage="Send new Email" />,
}, },
links: { links: {
label: messages.alreadyHaveCode, label: messages.alreadyHaveCode,