- );
- }
-
- onCopyClick: MouseEventHandler = (event) => {
- event.preventDefault();
-
- const { code } = this.props;
-
- if (code) {
- copy(code);
+ );
}
- };
+
+ onCopyClick: MouseEventHandler = (event) => {
+ event.preventDefault();
+
+ const { code } = this.props;
+
+ if (code) {
+ copy(code);
+ }
+ };
}
export default connect(({ auth }: RootState) => {
- if (!auth || !auth.client || !auth.oauth) {
- throw new Error('Can not connect Finish component. No auth data in state');
- }
+ if (!auth || !auth.client || !auth.oauth) {
+ throw new Error('Can not connect Finish component. No auth data in state');
+ }
- return {
- appName: auth.client.name,
- code: auth.oauth.code,
- displayCode: auth.oauth.displayCode,
- state: auth.oauth.state,
- success: auth.oauth.success,
- };
+ return {
+ appName: auth.client.name,
+ code: auth.oauth.code,
+ displayCode: auth.oauth.displayCode,
+ state: auth.oauth.state,
+ success: auth.oauth.success,
+ };
})(Finish);
diff --git a/packages/app/components/auth/finish/finish.scss b/packages/app/components/auth/finish/finish.scss
index 36e8719..52d1a24 100644
--- a/packages/app/components/auth/finish/finish.scss
+++ b/packages/app/components/auth/finish/finish.scss
@@ -2,75 +2,75 @@
@import '~app/components/ui/fonts.scss';
.finishPage {
- font-family: $font-family-title;
- position: relative;
- max-width: 515px;
- padding-top: 40px;
- margin: 0 auto;
- text-align: center;
+ font-family: $font-family-title;
+ position: relative;
+ max-width: 515px;
+ padding-top: 40px;
+ margin: 0 auto;
+ text-align: center;
}
.iconBackground {
- position: absolute;
- top: -15px;
- transform: translateX(-50%);
- font-size: 200px;
- color: #e0d9cf;
- z-index: -1;
+ position: absolute;
+ top: -15px;
+ transform: translateX(-50%);
+ font-size: 200px;
+ color: #e0d9cf;
+ z-index: -1;
}
.successBackground {
- composes: checkmark from '~app/components/ui/icons.scss';
- @extend .iconBackground;
+ composes: checkmark from '~app/components/ui/icons.scss';
+ @extend .iconBackground;
}
.failBackground {
- composes: close from '~app/components/ui/icons.scss';
- @extend .iconBackground;
+ composes: close from '~app/components/ui/icons.scss';
+ @extend .iconBackground;
}
.title {
- font-size: 22px;
- margin-bottom: 10px;
+ font-size: 22px;
+ margin-bottom: 10px;
}
.greenTitle {
- composes: title;
+ composes: title;
- color: $green;
+ color: $green;
- .appName {
- color: darker($green);
- }
+ .appName {
+ color: darker($green);
+ }
}
.redTitle {
- composes: title;
+ composes: title;
- color: $red;
+ color: $red;
- .appName {
- color: darker($red);
- }
+ .appName {
+ color: darker($red);
+ }
}
.description {
- font-size: 18px;
- margin-bottom: 10px;
+ font-size: 18px;
+ margin-bottom: 10px;
}
.codeContainer {
- margin-bottom: 5px;
- margin-top: 35px;
+ margin-bottom: 5px;
+ margin-top: 35px;
}
.code {
- $border: 5px solid darker($green);
+ $border: 5px solid darker($green);
- display: inline-block;
- border-right: $border;
- border-left: $border;
- padding: 5px 10px;
- word-break: break-all;
- text-align: center;
+ display: inline-block;
+ border-right: $border;
+ border-left: $border;
+ padding: 5px 10px;
+ word-break: break-all;
+ text-align: center;
}
diff --git a/packages/app/components/auth/forgotPassword/ForgotPassword.intl.json b/packages/app/components/auth/forgotPassword/ForgotPassword.intl.json
index 571a5bb..04eca46 100644
--- a/packages/app/components/auth/forgotPassword/ForgotPassword.intl.json
+++ b/packages/app/components/auth/forgotPassword/ForgotPassword.intl.json
@@ -1,7 +1,7 @@
{
- "title": "Forgot password",
- "sendMail": "Send mail",
- "specifyEmail": "Specify the registration E‑mail address or last used username for your account and we will send an E‑mail with instructions for further password recovery.",
- "pleasePressButton": "Please press the button bellow to get an E‑mail with password recovery code.",
- "alreadyHaveCode": "Already have a code"
+ "title": "Forgot password",
+ "sendMail": "Send mail",
+ "specifyEmail": "Specify the registration E‑mail address or last used username for your account and we will send an E‑mail with instructions for further password recovery.",
+ "pleasePressButton": "Please press the button bellow to get an E‑mail with password recovery code.",
+ "alreadyHaveCode": "Already have a code"
}
diff --git a/packages/app/components/auth/forgotPassword/ForgotPassword.ts b/packages/app/components/auth/forgotPassword/ForgotPassword.ts
index 73725a5..79641fb 100644
--- a/packages/app/components/auth/forgotPassword/ForgotPassword.ts
+++ b/packages/app/components/auth/forgotPassword/ForgotPassword.ts
@@ -3,14 +3,14 @@ import messages from './ForgotPassword.intl.json';
import Body from './ForgotPasswordBody';
export default factory({
- title: messages.title,
- body: Body,
- footer: {
- color: 'lightViolet',
- autoFocus: true,
- label: messages.sendMail,
- },
- links: {
- label: messages.alreadyHaveCode,
- },
+ title: messages.title,
+ body: Body,
+ footer: {
+ color: 'lightViolet',
+ autoFocus: true,
+ label: messages.sendMail,
+ },
+ links: {
+ label: messages.alreadyHaveCode,
+ },
});
diff --git a/packages/app/components/auth/forgotPassword/ForgotPasswordBody.tsx b/packages/app/components/auth/forgotPassword/ForgotPasswordBody.tsx
index f2448cc..2dfc790 100644
--- a/packages/app/components/auth/forgotPassword/ForgotPasswordBody.tsx
+++ b/packages/app/components/auth/forgotPassword/ForgotPasswordBody.tsx
@@ -11,87 +11,83 @@ import styles from './forgotPassword.scss';
import messages from './ForgotPassword.intl.json';
export default class ForgotPasswordBody extends BaseAuthBody {
- static displayName = 'ForgotPasswordBody';
- static panelId = 'forgotPassword';
- static hasGoBack = true;
+ static displayName = 'ForgotPasswordBody';
+ static panelId = 'forgotPassword';
+ static hasGoBack = true;
- state = {
- isLoginEdit: false,
- };
+ state = {
+ isLoginEdit: false,
+ };
- autoFocusField = 'login';
+ autoFocusField = 'login';
- render() {
- const { isLoginEdit } = this.state;
+ render() {
+ const { isLoginEdit } = this.state;
- const login = this.getLogin();
- const isLoginEditShown = isLoginEdit || !login;
+ const login = this.getLogin();
+ const isLoginEditShown = isLoginEdit || !login;
- return (
-
- {this.renderErrors()}
+ return (
+
+ {this.renderErrors()}
-
+
- {isLoginEditShown ? (
-
- ) : (
-
-
- {login}
-
+ {isLoginEditShown ? (
+
+ ) : (
+
+ )}
+
+
-
-
-
-
- )}
-
-
-
- );
- }
-
- serialize() {
- const data = super.serialize();
-
- if (!data.login) {
- data.login = this.getLogin();
+ );
}
- return data;
- }
+ serialize() {
+ const data = super.serialize();
- getLogin() {
- const login = getLogin(this.context);
- const { user } = this.context;
+ if (!data.login) {
+ data.login = this.getLogin();
+ }
- return login || user.username || user.email || '';
- }
+ return data;
+ }
- onClickEdit = async () => {
- this.setState({
- isLoginEdit: true,
- });
+ getLogin() {
+ const login = getLogin(this.context);
+ const { user } = this.context;
- await this.context.requestRedraw();
+ return login || user.username || user.email || '';
+ }
- this.form.focus('login');
- };
+ onClickEdit = async () => {
+ this.setState({
+ isLoginEdit: true,
+ });
+
+ await this.context.requestRedraw();
+
+ this.form.focus('login');
+ };
}
diff --git a/packages/app/components/auth/forgotPassword/forgotPassword.scss b/packages/app/components/auth/forgotPassword/forgotPassword.scss
index 889c3d4..de7757a 100644
--- a/packages/app/components/auth/forgotPassword/forgotPassword.scss
+++ b/packages/app/components/auth/forgotPassword/forgotPassword.scss
@@ -1,31 +1,31 @@
@import '~app/components/ui/colors.scss';
.descriptionText {
- font-size: 15px;
- line-height: 1.4;
- padding-bottom: 8px;
- color: #aaa;
+ font-size: 15px;
+ line-height: 1.4;
+ padding-bottom: 8px;
+ color: #aaa;
}
.login {
- composes: email from '~app/components/auth/password/password.scss';
+ composes: email from '~app/components/auth/password/password.scss';
}
.editLogin {
- composes: pencil from '~app/components/ui/icons.scss';
+ composes: pencil from '~app/components/ui/icons.scss';
- position: relative;
- bottom: 1px;
- padding-left: 3px;
+ position: relative;
+ bottom: 1px;
+ padding-left: 3px;
- color: #666666;
- font-size: 10px;
+ color: #666666;
+ font-size: 10px;
- transition: color 0.3s;
+ transition: color 0.3s;
- cursor: pointer;
+ cursor: pointer;
- &:hover {
- color: #ccc;
- }
+ &:hover {
+ color: #ccc;
+ }
}
diff --git a/packages/app/components/auth/helpLinks.scss b/packages/app/components/auth/helpLinks.scss
index c2d2293..9769a7e 100644
--- a/packages/app/components/auth/helpLinks.scss
+++ b/packages/app/components/auth/helpLinks.scss
@@ -1,9 +1,9 @@
.helpLinks {
- margin: 8px 0;
- position: relative;
- height: 20px;
+ margin: 8px 0;
+ position: relative;
+ height: 20px;
- color: #444;
- text-align: center;
- font-size: 16px;
+ color: #444;
+ text-align: center;
+ font-size: 16px;
}
diff --git a/packages/app/components/auth/login/Login.intl.json b/packages/app/components/auth/login/Login.intl.json
index a3f6d6e..93f82eb 100644
--- a/packages/app/components/auth/login/Login.intl.json
+++ b/packages/app/components/auth/login/Login.intl.json
@@ -1,6 +1,6 @@
{
- "createNewAccount": "Create new account",
- "loginTitle": "Sign in",
- "emailOrUsername": "E‑mail or username",
- "next": "Next"
+ "createNewAccount": "Create new account",
+ "loginTitle": "Sign in",
+ "emailOrUsername": "E‑mail or username",
+ "next": "Next"
}
diff --git a/packages/app/components/auth/login/Login.ts b/packages/app/components/auth/login/Login.ts
index cb28913..86a9575 100644
--- a/packages/app/components/auth/login/Login.ts
+++ b/packages/app/components/auth/login/Login.ts
@@ -3,14 +3,14 @@ import Body from './LoginBody';
import messages from './Login.intl.json';
export default factory({
- title: messages.loginTitle,
- body: Body,
- footer: {
- color: 'green',
- label: messages.next,
- },
- links: {
- isAvailable: (context) => !context.user.isGuest,
- label: messages.createNewAccount,
- },
+ title: messages.loginTitle,
+ body: Body,
+ footer: {
+ color: 'green',
+ label: messages.next,
+ },
+ links: {
+ isAvailable: (context) => !context.user.isGuest,
+ label: messages.createNewAccount,
+ },
});
diff --git a/packages/app/components/auth/login/LoginBody.tsx b/packages/app/components/auth/login/LoginBody.tsx
index a139801..421efe5 100644
--- a/packages/app/components/auth/login/LoginBody.tsx
+++ b/packages/app/components/auth/login/LoginBody.tsx
@@ -7,26 +7,21 @@ import { User } from 'app/components/user/reducer';
import messages from './Login.intl.json';
export default class LoginBody extends BaseAuthBody {
- static displayName = 'LoginBody';
- static panelId = 'login';
- static hasGoBack = (state: { user: User }) => {
- return !state.user.isGuest;
- };
+ static displayName = 'LoginBody';
+ static panelId = 'login';
+ static hasGoBack = (state: { user: User }) => {
+ return !state.user.isGuest;
+ };
- autoFocusField = 'login';
+ autoFocusField = 'login';
- render() {
- return (
-
+ );
+ }
}
diff --git a/packages/app/components/auth/mfa/Mfa.intl.json b/packages/app/components/auth/mfa/Mfa.intl.json
index de053eb..b19e7e8 100644
--- a/packages/app/components/auth/mfa/Mfa.intl.json
+++ b/packages/app/components/auth/mfa/Mfa.intl.json
@@ -1,4 +1,4 @@
{
- "enterTotp": "Enter code",
- "description": "In order to sign in this account, you need to enter a one-time password from mobile application"
+ "enterTotp": "Enter code",
+ "description": "In order to sign in this account, you need to enter a one-time password from mobile application"
}
diff --git a/packages/app/components/auth/mfa/Mfa.tsx b/packages/app/components/auth/mfa/Mfa.tsx
index 79d58bf..ffda313 100644
--- a/packages/app/components/auth/mfa/Mfa.tsx
+++ b/packages/app/components/auth/mfa/Mfa.tsx
@@ -4,10 +4,10 @@ import messages from './Mfa.intl.json';
import passwordMessages from '../password/Password.intl.json';
export default factory({
- title: messages.enterTotp,
- body: Body,
- footer: {
- color: 'green',
- label: passwordMessages.signInButton,
- },
+ title: messages.enterTotp,
+ body: Body,
+ footer: {
+ color: 'green',
+ label: passwordMessages.signInButton,
+ },
});
diff --git a/packages/app/components/auth/mfa/MfaBody.tsx b/packages/app/components/auth/mfa/MfaBody.tsx
index 16eb9fc..02ea0f3 100644
--- a/packages/app/components/auth/mfa/MfaBody.tsx
+++ b/packages/app/components/auth/mfa/MfaBody.tsx
@@ -8,30 +8,30 @@ import styles from './mfa.scss';
import messages from './Mfa.intl.json';
export default class MfaBody extends BaseAuthBody {
- static panelId = 'mfa';
- static hasGoBack = true;
+ static panelId = 'mfa';
+ static hasGoBack = true;
- autoFocusField = 'totp';
+ autoFocusField = 'totp';
- render() {
- return (
-
- {this.renderErrors()}
+ render() {
+ return (
+
+ {this.renderErrors()}
-
+
-
-
-
+
+
+
-
-
- );
- }
+
+
+ );
+ }
}
diff --git a/packages/app/components/auth/mfa/mfa.scss b/packages/app/components/auth/mfa/mfa.scss
index 70aff73..8edb590 100644
--- a/packages/app/components/auth/mfa/mfa.scss
+++ b/packages/app/components/auth/mfa/mfa.scss
@@ -1,6 +1,6 @@
.descriptionText {
- font-size: 15px;
- line-height: 1.4;
- padding-bottom: 8px;
- color: #aaa;
+ font-size: 15px;
+ line-height: 1.4;
+ padding-bottom: 8px;
+ color: #aaa;
}
diff --git a/packages/app/components/auth/password/Password.intl.json b/packages/app/components/auth/password/Password.intl.json
index 6b3eb35..c2e9388 100644
--- a/packages/app/components/auth/password/Password.intl.json
+++ b/packages/app/components/auth/password/Password.intl.json
@@ -1,7 +1,7 @@
{
- "passwordTitle": "Enter password",
- "signInButton": "Sign in",
- "forgotPassword": "Forgot password",
- "accountPassword": "Account password",
- "rememberMe": "Remember me on this device"
+ "passwordTitle": "Enter password",
+ "signInButton": "Sign in",
+ "forgotPassword": "Forgot password",
+ "accountPassword": "Account password",
+ "rememberMe": "Remember me on this device"
}
diff --git a/packages/app/components/auth/password/Password.ts b/packages/app/components/auth/password/Password.ts
index d0ab75d..ffa58c1 100644
--- a/packages/app/components/auth/password/Password.ts
+++ b/packages/app/components/auth/password/Password.ts
@@ -3,13 +3,13 @@ import Body from './PasswordBody';
import messages from './Password.intl.json';
export default factory({
- title: messages.passwordTitle,
- body: Body,
- footer: {
- color: 'green',
- label: messages.signInButton,
- },
- links: {
- label: messages.forgotPassword,
- },
+ title: messages.passwordTitle,
+ body: Body,
+ footer: {
+ color: 'green',
+ label: messages.signInButton,
+ },
+ links: {
+ label: messages.forgotPassword,
+ },
});
diff --git a/packages/app/components/auth/password/PasswordBody.tsx b/packages/app/components/auth/password/PasswordBody.tsx
index a13e379..b67b3a3 100644
--- a/packages/app/components/auth/password/PasswordBody.tsx
+++ b/packages/app/components/auth/password/PasswordBody.tsx
@@ -8,46 +8,38 @@ import styles from './password.scss';
import messages from './Password.intl.json';
export default class PasswordBody extends BaseAuthBody {
- static displayName = 'PasswordBody';
- static panelId = 'password';
- static hasGoBack = true;
+ static displayName = 'PasswordBody';
+ static panelId = 'password';
+ static hasGoBack = true;
- autoFocusField = 'password';
+ autoFocusField = 'password';
- render() {
- const { user } = this.context;
+ render() {
+ const { user } = this.context;
- return (
-
- {this.renderErrors()}
+ return (
+
+ {this.renderErrors()}
-
-
- {user.avatar ? (
-
- ) : (
-
- )}
-
-
{user.email || user.username}
-
+
+
+ {user.avatar ?
:
}
+
+
{user.email || user.username}
+
-
+
-
-
-
-
- );
- }
+
+
+
+
+ );
+ }
}
diff --git a/packages/app/components/auth/password/password.scss b/packages/app/components/auth/password/password.scss
index d3c084c..7f7c03d 100644
--- a/packages/app/components/auth/password/password.scss
+++ b/packages/app/components/auth/password/password.scss
@@ -1,22 +1,22 @@
@import '~app/components/ui/fonts.scss';
.avatar {
- width: 90px;
- height: 90px;
- font-size: 90px;
- line-height: 1;
- margin: 0 auto;
+ width: 90px;
+ height: 90px;
+ font-size: 90px;
+ line-height: 1;
+ margin: 0 auto;
- img {
- width: 100%;
- }
+ img {
+ width: 100%;
+ }
}
.email {
- font-family: $font-family-title;
- font-size: 18px;
- color: #fff;
+ font-family: $font-family-title;
+ font-size: 18px;
+ color: #fff;
- margin-bottom: 15px;
- margin-top: 10px;
+ margin-bottom: 15px;
+ margin-top: 10px;
}
diff --git a/packages/app/components/auth/permissions/Permissions.intl.json b/packages/app/components/auth/permissions/Permissions.intl.json
index 6143d48..8af4b87 100644
--- a/packages/app/components/auth/permissions/Permissions.intl.json
+++ b/packages/app/components/auth/permissions/Permissions.intl.json
@@ -1,12 +1,12 @@
{
- "permissionsTitle": "Application permissions",
- "youAuthorizedAs": "You authorized as:",
- "theAppNeedsAccess1": "This application needs access",
- "theAppNeedsAccess2": "to your data",
- "decline": "Decline",
- "approve": "Approve",
- "scope_minecraft_server_session": "Authorization data for minecraft server",
- "scope_offline_access": "Access to your profile data, when you offline",
- "scope_account_info": "Access to your profile data (except E‑mail)",
- "scope_account_email": "Access to your E‑mail address"
+ "permissionsTitle": "Application permissions",
+ "youAuthorizedAs": "You authorized as:",
+ "theAppNeedsAccess1": "This application needs access",
+ "theAppNeedsAccess2": "to your data",
+ "decline": "Decline",
+ "approve": "Approve",
+ "scope_minecraft_server_session": "Authorization data for minecraft server",
+ "scope_offline_access": "Access to your profile data, when you offline",
+ "scope_account_info": "Access to your profile data (except E‑mail)",
+ "scope_account_email": "Access to your E‑mail address"
}
diff --git a/packages/app/components/auth/permissions/Permissions.ts b/packages/app/components/auth/permissions/Permissions.ts
index 053bc23..c630a5a 100644
--- a/packages/app/components/auth/permissions/Permissions.ts
+++ b/packages/app/components/auth/permissions/Permissions.ts
@@ -3,14 +3,14 @@ import messages from './Permissions.intl.json';
import Body from './PermissionsBody';
export default factory({
- title: messages.permissionsTitle,
- body: Body,
- footer: {
- color: 'orange',
- autoFocus: true,
- label: messages.approve,
- },
- links: {
- label: messages.decline,
- },
+ title: messages.permissionsTitle,
+ body: Body,
+ footer: {
+ color: 'orange',
+ autoFocus: true,
+ label: messages.approve,
+ },
+ links: {
+ label: messages.decline,
+ },
});
diff --git a/packages/app/components/auth/permissions/PermissionsBody.tsx b/packages/app/components/auth/permissions/PermissionsBody.tsx
index 7c4cd06..90992c6 100644
--- a/packages/app/components/auth/permissions/PermissionsBody.tsx
+++ b/packages/app/components/auth/permissions/PermissionsBody.tsx
@@ -8,58 +8,52 @@ import styles from './permissions.scss';
import messages from './Permissions.intl.json';
export default class PermissionsBody extends BaseAuthBody {
- static displayName = 'PermissionsBody';
- static panelId = 'permissions';
+ static displayName = 'PermissionsBody';
+ static panelId = 'permissions';
- render() {
- const { user } = this.context;
- const { scopes } = this.context.auth;
+ render() {
+ const { user } = this.context;
+ const { scopes } = this.context.auth;
- return (
-
- {this.renderErrors()}
+ return (
+
+ {this.renderErrors()}
-
-
-
- {user.avatar ? (
-
- ) : (
-
- )}
+
+
+
+ {user.avatar ?
:
}
+
+
+
+
+
{user.username}
+
+
+
+
+
+
+
+
+
+ {scopes.map((scope) => {
+ const key = `scope_${scope}`;
+ const message = messages[key];
+
+ return (
+ -
+ {message ? (
+
+ ) : (
+ scope.replace(/^\w|_/g, (match) => match.replace('_', ' ').toUpperCase())
+ )}
+
+ );
+ })}
+
+
-
-
-
-
{user.username}
-
-
-
-
-
-
-
-
-
- {scopes.map((scope) => {
- const key = `scope_${scope}`;
- const message = messages[key];
-
- return (
- -
- {message ? (
-
- ) : (
- scope.replace(/^\w|_/g, (match) =>
- match.replace('_', ' ').toUpperCase(),
- )
- )}
-
- );
- })}
-
-
-
- );
- }
+ );
+ }
}
diff --git a/packages/app/components/auth/permissions/permissions.scss b/packages/app/components/auth/permissions/permissions.scss
index 5c24898..c3400d6 100644
--- a/packages/app/components/auth/permissions/permissions.scss
+++ b/packages/app/components/auth/permissions/permissions.scss
@@ -2,76 +2,76 @@
@import '~app/components/ui/fonts.scss';
.authInfo {
- // Отступы сверху и снизу разные т.к. мы ужимаем высоту линии строки с логином на 2 пикселя и из-за этого теряем отступ снизу
- padding: 5px 20px 7px;
- text-align: left;
+ // Отступы сверху и снизу разные т.к. мы ужимаем высоту линии строки с логином на 2 пикселя и из-за этого теряем отступ снизу
+ padding: 5px 20px 7px;
+ text-align: left;
}
.authInfoAvatar {
- $size: 30px;
+ $size: 30px;
- float: left;
- height: $size;
- width: $size;
- font-size: $size;
- line-height: 1;
- margin-right: 10px;
- margin-top: 2px;
- color: #aaa;
+ float: left;
+ height: $size;
+ width: $size;
+ font-size: $size;
+ line-height: 1;
+ margin-right: 10px;
+ margin-top: 2px;
+ color: #aaa;
- img {
- width: 100%;
- }
+ img {
+ width: 100%;
+ }
}
.authInfoTitle {
- font-size: 14px;
- color: #666;
+ font-size: 14px;
+ color: #666;
}
.authInfoEmail {
- font-family: $font-family-title;
- font-size: 20px;
- line-height: 16px;
- color: #fff;
+ font-family: $font-family-title;
+ font-size: 20px;
+ line-height: 16px;
+ color: #fff;
}
.permissionsContainer {
- padding: 15px 12px;
- text-align: left;
+ padding: 15px 12px;
+ text-align: left;
}
.permissionsTitle {
- font-family: $font-family-title;
- font-size: 18px;
- color: #dd8650;
- padding-bottom: 6px;
+ font-family: $font-family-title;
+ font-size: 18px;
+ color: #dd8650;
+ padding-bottom: 6px;
}
.permissionsList {
- list-style: none;
- margin-top: 10px;
+ list-style: none;
+ margin-top: 10px;
- li {
- color: #a9a9a9;
- font-size: 14px;
- line-height: 1.4;
- padding-bottom: 4px;
- padding-left: 17px;
- position: relative;
+ li {
+ color: #a9a9a9;
+ font-size: 14px;
+ line-height: 1.4;
+ padding-bottom: 4px;
+ padding-left: 17px;
+ position: relative;
- &:last-of-type {
- padding-bottom: 0;
+ &:last-of-type {
+ padding-bottom: 0;
+ }
+
+ &:before {
+ content: '• ';
+ color: lighter($light_violet);
+ font-size: 39px; // ~ 9px
+ line-height: 9px;
+ position: absolute;
+ top: 6px;
+ left: -4px;
+ }
}
-
- &:before {
- content: '• ';
- color: lighter($light_violet);
- font-size: 39px; // ~ 9px
- line-height: 9px;
- position: absolute;
- top: 6px;
- left: -4px;
- }
- }
}
diff --git a/packages/app/components/auth/recoverPassword/RecoverPassword.intl.json b/packages/app/components/auth/recoverPassword/RecoverPassword.intl.json
index b769994..ce776a5 100644
--- a/packages/app/components/auth/recoverPassword/RecoverPassword.intl.json
+++ b/packages/app/components/auth/recoverPassword/RecoverPassword.intl.json
@@ -1,12 +1,12 @@
{
- "title": "Restore password",
- "contactSupport": "Contact support",
- "messageWasSent": "The recovery code was sent to your account E‑mail.",
- "messageWasSentTo": "The recovery code was sent to your E‑mail {email}.",
- "enterCodeBelow": "Please enter the code received into the field below:",
- "enterNewPasswordBelow": "Enter and repeat new password below:",
- "change": "Change password",
- "newPassword": "Enter new password",
- "newRePassword": "Repeat new password",
- "enterTheCode": "Enter confirmation code"
+ "title": "Restore password",
+ "contactSupport": "Contact support",
+ "messageWasSent": "The recovery code was sent to your account E‑mail.",
+ "messageWasSentTo": "The recovery code was sent to your E‑mail {email}.",
+ "enterCodeBelow": "Please enter the code received into the field below:",
+ "enterNewPasswordBelow": "Enter and repeat new password below:",
+ "change": "Change password",
+ "newPassword": "Enter new password",
+ "newRePassword": "Repeat new password",
+ "enterTheCode": "Enter confirmation code"
}
diff --git a/packages/app/components/auth/recoverPassword/RecoverPassword.ts b/packages/app/components/auth/recoverPassword/RecoverPassword.ts
index 6a8137f..fb54884 100644
--- a/packages/app/components/auth/recoverPassword/RecoverPassword.ts
+++ b/packages/app/components/auth/recoverPassword/RecoverPassword.ts
@@ -3,13 +3,13 @@ import messages from './RecoverPassword.intl.json';
import Body from './RecoverPasswordBody';
export default factory({
- title: messages.title,
- body: Body,
- footer: {
- color: 'lightViolet',
- label: messages.change,
- },
- links: {
- label: messages.contactSupport,
- },
+ title: messages.title,
+ body: Body,
+ footer: {
+ color: 'lightViolet',
+ label: messages.change,
+ },
+ links: {
+ label: messages.contactSupport,
+ },
});
diff --git a/packages/app/components/auth/recoverPassword/RecoverPasswordBody.tsx b/packages/app/components/auth/recoverPassword/RecoverPasswordBody.tsx
index 2a252a8..e75a338 100644
--- a/packages/app/components/auth/recoverPassword/RecoverPasswordBody.tsx
+++ b/packages/app/components/auth/recoverPassword/RecoverPasswordBody.tsx
@@ -11,70 +11,67 @@ import messages from './RecoverPassword.intl.json';
// TODO: activation code field may be decoupled into common component and reused here and in activation panel
export default class RecoverPasswordBody extends BaseAuthBody {
- static displayName = 'RecoverPasswordBody';
- static panelId = 'recoverPassword';
- static hasGoBack = true;
+ static displayName = 'RecoverPasswordBody';
+ static panelId = 'recoverPassword';
+ static hasGoBack = true;
- autoFocusField =
- this.props.match.params && this.props.match.params.key
- ? 'newPassword'
- : 'key';
+ autoFocusField = this.props.match.params && this.props.match.params.key ? 'newPassword' : 'key';
- render() {
- const { user } = this.context;
- const { key } = this.props.match.params;
+ render() {
+ const { user } = this.context;
+ const { key } = this.props.match.params;
- return (
-
- {this.renderErrors()}
+ return (
+
- );
- }
+
+
+ );
+ }
}
diff --git a/packages/app/components/auth/recoverPassword/recoverPassword.scss b/packages/app/components/auth/recoverPassword/recoverPassword.scss
index 7da264e..ddc9bed 100644
--- a/packages/app/components/auth/recoverPassword/recoverPassword.scss
+++ b/packages/app/components/auth/recoverPassword/recoverPassword.scss
@@ -1,8 +1,8 @@
@import '~app/components/ui/colors.scss';
.descriptionText {
- font-size: 15px;
- line-height: 1.4;
- margin-bottom: 8px;
- color: #aaa;
+ font-size: 15px;
+ line-height: 1.4;
+ margin-bottom: 8px;
+ color: #aaa;
}
diff --git a/packages/app/components/auth/reducer.test.ts b/packages/app/components/auth/reducer.test.ts
index 1b5ba5d..e7b9fec 100644
--- a/packages/app/components/auth/reducer.test.ts
+++ b/packages/app/components/auth/reducer.test.ts
@@ -3,40 +3,36 @@ import auth from './reducer';
import { setLogin, setAccountSwitcher } from './actions';
describe('components/auth/reducer', () => {
- describe('auth:setCredentials', () => {
- it('should set login', () => {
- const expectedLogin = 'foo';
+ describe('auth:setCredentials', () => {
+ it('should set login', () => {
+ const expectedLogin = 'foo';
- expect(
- auth(undefined, setLogin(expectedLogin)).credentials,
- 'to satisfy',
- {
- login: expectedLogin,
- },
- );
- });
- });
-
- describe('auth:setAccountSwitcher', () => {
- it('should be enabled by default', () =>
- expect(auth(undefined, {} as any), 'to satisfy', {
- isSwitcherEnabled: true,
- }));
-
- it('should enable switcher', () => {
- const expectedValue = true;
-
- expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
- isSwitcherEnabled: expectedValue,
- });
+ expect(auth(undefined, setLogin(expectedLogin)).credentials, 'to satisfy', {
+ login: expectedLogin,
+ });
+ });
});
- it('should disable switcher', () => {
- const expectedValue = false;
+ describe('auth:setAccountSwitcher', () => {
+ it('should be enabled by default', () =>
+ expect(auth(undefined, {} as any), 'to satisfy', {
+ isSwitcherEnabled: true,
+ }));
- expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
- isSwitcherEnabled: expectedValue,
- });
+ it('should enable switcher', () => {
+ const expectedValue = true;
+
+ expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
+ isSwitcherEnabled: expectedValue,
+ });
+ });
+
+ it('should disable switcher', () => {
+ const expectedValue = false;
+
+ expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
+ isSwitcherEnabled: expectedValue,
+ });
+ });
});
- });
});
diff --git a/packages/app/components/auth/reducer.ts b/packages/app/components/auth/reducer.ts
index 8be2f20..b173059 100644
--- a/packages/app/components/auth/reducer.ts
+++ b/packages/app/components/auth/reducer.ts
@@ -3,173 +3,156 @@ import { RootState } from 'app/reducers';
import { Scope } from '../../services/api/oauth';
import {
- ErrorAction,
- CredentialsAction,
- AccountSwitcherAction,
- LoadingAction,
- ClientAction,
- OAuthAction,
- ScopesAction,
+ ErrorAction,
+ CredentialsAction,
+ AccountSwitcherAction,
+ LoadingAction,
+ ClientAction,
+ OAuthAction,
+ ScopesAction,
} from './actions';
export interface Credentials {
- login?: string | null; // By some reasons there is can be null value. Need to investigate.
- password?: string;
- rememberMe?: boolean;
- returnUrl?: string;
- isRelogin?: boolean;
- isTotpRequired?: boolean;
+ login?: string | null; // By some reasons there is can be null value. Need to investigate.
+ password?: string;
+ rememberMe?: boolean;
+ returnUrl?: string;
+ isRelogin?: boolean;
+ isTotpRequired?: boolean;
}
type Error = Record<
- string,
- | string
- | {
- type: string;
- payload: Record
;
- }
+ string,
+ | string
+ | {
+ type: string;
+ payload: Record;
+ }
> | null;
export interface Client {
- id: string;
- name: string;
- description: string;
+ id: string;
+ name: string;
+ description: string;
}
export interface OAuthState {
- clientId: string;
- redirectUrl: string;
- responseType: string;
- description?: string;
- scope: string;
- prompt: string;
- loginHint: string;
- state: string;
- success?: boolean;
- code?: string;
- displayCode?: boolean;
- acceptRequired?: boolean;
+ clientId: string;
+ redirectUrl: string;
+ responseType: string;
+ description?: string;
+ scope: string;
+ prompt: string;
+ loginHint: string;
+ state: string;
+ success?: boolean;
+ code?: string;
+ displayCode?: boolean;
+ acceptRequired?: boolean;
}
type Scopes = Array;
export interface State {
- credentials: Credentials;
- error: Error;
- isLoading: boolean;
- isSwitcherEnabled: boolean;
- client: Client | null;
- oauth: OAuthState | null;
- scopes: Scopes;
+ credentials: Credentials;
+ error: Error;
+ isLoading: boolean;
+ isSwitcherEnabled: boolean;
+ client: Client | null;
+ oauth: OAuthState | null;
+ scopes: Scopes;
}
-const error: Reducer = (
- state = null,
- { type, payload },
-) => {
- if (type === 'auth:error') {
- return payload;
- }
-
- return state;
-};
-
-const credentials: Reducer = (
- state = {},
- { type, payload },
-) => {
- if (type === 'auth:setCredentials') {
- if (payload) {
- return {
- ...payload,
- };
+const error: Reducer = (state = null, { type, payload }) => {
+ if (type === 'auth:error') {
+ return payload;
}
- return {};
- }
-
- return state;
+ return state;
};
-const isSwitcherEnabled: Reducer<
- State['isSwitcherEnabled'],
- AccountSwitcherAction
-> = (state = true, { type, payload }) => {
- if (type === 'auth:setAccountSwitcher') {
- return payload;
- }
+const credentials: Reducer = (state = {}, { type, payload }) => {
+ if (type === 'auth:setCredentials') {
+ if (payload) {
+ return {
+ ...payload,
+ };
+ }
- return state;
+ return {};
+ }
+
+ return state;
};
-const isLoading: Reducer = (
- state = false,
- { type, payload },
+const isSwitcherEnabled: Reducer = (
+ state = true,
+ { type, payload },
) => {
- if (type === 'set_loading_state') {
- return payload;
- }
+ if (type === 'auth:setAccountSwitcher') {
+ return payload;
+ }
- return state;
+ return state;
};
-const client: Reducer = (
- state = null,
- { type, payload },
-) => {
- if (type === 'set_client') {
- return payload;
- }
+const isLoading: Reducer = (state = false, { type, payload }) => {
+ if (type === 'set_loading_state') {
+ return payload;
+ }
- return state;
+ return state;
+};
+
+const client: Reducer = (state = null, { type, payload }) => {
+ if (type === 'set_client') {
+ return payload;
+ }
+
+ return state;
};
const oauth: Reducer = (state = null, action) => {
- switch (action.type) {
- case 'set_oauth':
- return action.payload;
- case 'set_oauth_result':
- return {
- ...(state as OAuthState),
- ...action.payload,
- };
- case 'require_permissions_accept':
- return {
- ...(state as OAuthState),
- acceptRequired: true,
- };
- default:
- return state;
- }
+ switch (action.type) {
+ case 'set_oauth':
+ return action.payload;
+ case 'set_oauth_result':
+ return {
+ ...(state as OAuthState),
+ ...action.payload,
+ };
+ case 'require_permissions_accept':
+ return {
+ ...(state as OAuthState),
+ acceptRequired: true,
+ };
+ default:
+ return state;
+ }
};
-const scopes: Reducer = (
- state = [],
- { type, payload },
-) => {
- if (type === 'set_scopes') {
- return payload;
- }
+const scopes: Reducer = (state = [], { type, payload }) => {
+ if (type === 'set_scopes') {
+ return payload;
+ }
- return state;
+ return state;
};
export default combineReducers({
- credentials,
- error,
- isLoading,
- isSwitcherEnabled,
- client,
- oauth,
- scopes,
+ credentials,
+ error,
+ isLoading,
+ isSwitcherEnabled,
+ client,
+ oauth,
+ scopes,
});
-export function getLogin(
- state: RootState | Pick,
-): string | null {
- return state.auth.credentials.login || null;
+export function getLogin(state: RootState | Pick): string | null {
+ return state.auth.credentials.login || null;
}
export function getCredentials(state: RootState): Credentials {
- return state.auth.credentials;
+ return state.auth.credentials;
}
diff --git a/packages/app/components/auth/register/Register.intl.json b/packages/app/components/auth/register/Register.intl.json
index 7a83ef3..39e167b 100644
--- a/packages/app/components/auth/register/Register.intl.json
+++ b/packages/app/components/auth/register/Register.intl.json
@@ -1,10 +1,10 @@
{
- "registerTitle": "Sign Up",
- "yourNickname": "Your nickname",
- "yourEmail": "Your E‑mail",
- "accountPassword": "Account password",
- "repeatPassword": "Repeat password",
- "signUpButton": "Register",
- "acceptRules": "I agree with {link}",
- "termsOfService": "terms of service"
+ "registerTitle": "Sign Up",
+ "yourNickname": "Your nickname",
+ "yourEmail": "Your E‑mail",
+ "accountPassword": "Account password",
+ "repeatPassword": "Repeat password",
+ "signUpButton": "Register",
+ "acceptRules": "I agree with {link}",
+ "termsOfService": "terms of service"
}
diff --git a/packages/app/components/auth/register/Register.ts b/packages/app/components/auth/register/Register.ts
index ac50d6b..6536bd1 100644
--- a/packages/app/components/auth/register/Register.ts
+++ b/packages/app/components/auth/register/Register.ts
@@ -5,19 +5,19 @@ import messages from './Register.intl.json';
import Body from './RegisterBody';
export default factory({
- title: messages.registerTitle,
- body: Body,
- footer: {
- color: 'blue',
- label: messages.signUpButton,
- },
- links: [
- {
- label: activationMessages.didNotReceivedEmail,
- payload: { requestEmail: true },
+ title: messages.registerTitle,
+ body: Body,
+ footer: {
+ color: 'blue',
+ label: messages.signUpButton,
},
- {
- label: forgotPasswordMessages.alreadyHaveCode,
- },
- ],
+ links: [
+ {
+ label: activationMessages.didNotReceivedEmail,
+ payload: { requestEmail: true },
+ },
+ {
+ label: forgotPasswordMessages.alreadyHaveCode,
+ },
+ ],
});
diff --git a/packages/app/components/auth/register/RegisterBody.tsx b/packages/app/components/auth/register/RegisterBody.tsx
index 9578975..80aad09 100644
--- a/packages/app/components/auth/register/RegisterBody.tsx
+++ b/packages/app/components/auth/register/RegisterBody.tsx
@@ -11,73 +11,73 @@ import messages from './Register.intl.json';
// TODO: password and username can be validate for length and sameness
export default class RegisterBody extends BaseAuthBody {
- static panelId = 'register';
+ static panelId = 'register';
- autoFocusField = 'username';
+ autoFocusField = 'username';
- render() {
- return (
-
- {this.renderErrors()}
+ render() {
+ return (
+
- );
- }
+
+
+
+
+ ),
+ }}
+ />
+ }
+ />
+
+
+ );
+ }
}
diff --git a/packages/app/components/auth/resendActivation/ResendActivation.intl.json b/packages/app/components/auth/resendActivation/ResendActivation.intl.json
index 99803c0..b2d7652 100644
--- a/packages/app/components/auth/resendActivation/ResendActivation.intl.json
+++ b/packages/app/components/auth/resendActivation/ResendActivation.intl.json
@@ -1,5 +1,5 @@
{
- "title": "Did not received an E‑mail",
- "specifyYourEmail": "Please, enter an E‑mail you've registered with and we will send you new activation code",
- "sendNewEmail": "Send new E‑mail"
+ "title": "Did not received an E‑mail",
+ "specifyYourEmail": "Please, enter an E‑mail you've registered with and we will send you new activation code",
+ "sendNewEmail": "Send new E‑mail"
}
diff --git a/packages/app/components/auth/resendActivation/ResendActivation.ts b/packages/app/components/auth/resendActivation/ResendActivation.ts
index b33b817..d56a772 100644
--- a/packages/app/components/auth/resendActivation/ResendActivation.ts
+++ b/packages/app/components/auth/resendActivation/ResendActivation.ts
@@ -4,13 +4,13 @@ import messages from './ResendActivation.intl.json';
import Body from './ResendActivationBody';
export default factory({
- title: messages.title,
- body: Body,
- footer: {
- color: 'blue',
- label: messages.sendNewEmail,
- },
- links: {
- label: forgotPasswordMessages.alreadyHaveCode,
- },
+ title: messages.title,
+ body: Body,
+ footer: {
+ color: 'blue',
+ label: messages.sendNewEmail,
+ },
+ links: {
+ label: forgotPasswordMessages.alreadyHaveCode,
+ },
});
diff --git a/packages/app/components/auth/resendActivation/ResendActivationBody.tsx b/packages/app/components/auth/resendActivation/ResendActivationBody.tsx
index 773e6d3..9fd24cd 100644
--- a/packages/app/components/auth/resendActivation/ResendActivationBody.tsx
+++ b/packages/app/components/auth/resendActivation/ResendActivationBody.tsx
@@ -8,33 +8,33 @@ import styles from './resendActivation.scss';
import messages from './ResendActivation.intl.json';
export default class ResendActivation extends BaseAuthBody {
- static displayName = 'ResendActivation';
- static panelId = 'resendActivation';
- static hasGoBack = true;
+ static displayName = 'ResendActivation';
+ static panelId = 'resendActivation';
+ static hasGoBack = true;
- autoFocusField = 'email';
+ autoFocusField = 'email';
- render() {
- return (
-
- {this.renderErrors()}
+ render() {
+ return (
+
+ {this.renderErrors()}
-
-
-
+
+
+
-
+
-
-
- );
- }
+
+
+ );
+ }
}
diff --git a/packages/app/components/auth/resendActivation/resendActivation.scss b/packages/app/components/auth/resendActivation/resendActivation.scss
index 69b43c3..f1ba029 100644
--- a/packages/app/components/auth/resendActivation/resendActivation.scss
+++ b/packages/app/components/auth/resendActivation/resendActivation.scss
@@ -1,8 +1,8 @@
@import '~app/components/ui/fonts.scss';
.description {
- font-family: $font-family-title;
- margin: 5px 0 19px;
- line-height: 1.4;
- font-size: 16px;
+ font-family: $font-family-title;
+ margin: 5px 0 19px;
+ line-height: 1.4;
+ font-size: 16px;
}
diff --git a/packages/app/components/contact/ContactForm.test.tsx b/packages/app/components/contact/ContactForm.test.tsx
index 99327b5..6fe4ebe 100644
--- a/packages/app/components/contact/ContactForm.test.tsx
+++ b/packages/app/components/contact/ContactForm.test.tsx
@@ -9,162 +9,143 @@ import { TestContextProvider } from 'app/shell';
import { ContactForm } from './ContactForm';
beforeEach(() => {
- sinon.stub(feedback, 'send').returns(Promise.resolve() as any);
+ sinon.stub(feedback, 'send').returns(Promise.resolve() as any);
});
afterEach(() => {
- (feedback.send as any).restore();
+ (feedback.send as any).restore();
});
describe('ContactForm', () => {
- it('should contain Form', () => {
- const user = {} as User;
+ it('should contain Form', () => {
+ const user = {} as User;
- render(
-
-
- ,
- );
+ render(
+
+
+ ,
+ );
- expect(screen.getAllByRole('textbox').length, 'to be greater than', 1);
+ expect(screen.getAllByRole('textbox').length, 'to be greater than', 1);
- expect(
- screen.getByRole('button', { name: /Send/ }),
- 'to have property',
- 'type',
- 'submit',
- );
+ expect(screen.getByRole('button', { name: /Send/ }), 'to have property', 'type', 'submit');
- [
- {
- label: 'subject',
- name: 'subject',
- },
- {
- label: 'E‑mail',
- name: 'email',
- },
- {
- label: 'message',
- name: 'message',
- },
- ].forEach((el) => {
- expect(
- screen.getByLabelText(el.label, { exact: false }),
- 'to have property',
- 'name',
- el.name,
- );
- });
- });
-
- describe('when rendered with user', () => {
- const user = {
- email: 'foo@bar.com',
- } as User;
-
- it('should render email field with user email', () => {
- render(
-
-
- ,
- );
-
- expect(screen.getByDisplayValue(user.email), 'to be a', HTMLInputElement);
- });
- });
-
- it('should submit and then hide form and display success message', async () => {
- const user = {
- email: 'foo@bar.com',
- } as User;
-
- render(
-
-
- ,
- );
-
- fireEvent.change(screen.getByLabelText(/subject/i), {
- target: {
- value: 'subject',
- },
+ [
+ {
+ label: 'subject',
+ name: 'subject',
+ },
+ {
+ label: 'E‑mail',
+ name: 'email',
+ },
+ {
+ label: 'message',
+ name: 'message',
+ },
+ ].forEach((el) => {
+ expect(screen.getByLabelText(el.label, { exact: false }), 'to have property', 'name', el.name);
+ });
});
- fireEvent.change(screen.getByLabelText(/message/i), {
- target: {
- value: 'the message',
- },
+ describe('when rendered with user', () => {
+ const user = {
+ email: 'foo@bar.com',
+ } as User;
+
+ it('should render email field with user email', () => {
+ render(
+
+
+ ,
+ );
+
+ expect(screen.getByDisplayValue(user.email), 'to be a', HTMLInputElement);
+ });
});
- const button = screen.getByRole('button', { name: 'Send' });
+ it('should submit and then hide form and display success message', async () => {
+ const user = {
+ email: 'foo@bar.com',
+ } as User;
- expect(button, 'to have property', 'disabled', false);
+ render(
+
+
+ ,
+ );
- fireEvent.click(button);
+ fireEvent.change(screen.getByLabelText(/subject/i), {
+ target: {
+ value: 'subject',
+ },
+ });
- expect(button, 'to have property', 'disabled', true);
- expect(feedback.send, 'to have a call exhaustively satisfying', [
- {
- subject: 'subject',
- email: user.email,
- category: '',
- message: 'the message',
- },
- ]);
+ fireEvent.change(screen.getByLabelText(/message/i), {
+ target: {
+ value: 'the message',
+ },
+ });
- await waitFor(() => {
- expect(
- screen.getByText('Your message was received', { exact: false }),
- 'to be a',
- HTMLElement,
- );
+ const button = screen.getByRole('button', { name: 'Send' });
+
+ expect(button, 'to have property', 'disabled', false);
+
+ fireEvent.click(button);
+
+ expect(button, 'to have property', 'disabled', true);
+ expect(feedback.send, 'to have a call exhaustively satisfying', [
+ {
+ subject: 'subject',
+ email: user.email,
+ category: '',
+ message: 'the message',
+ },
+ ]);
+
+ await waitFor(() => {
+ expect(screen.getByText('Your message was received', { exact: false }), 'to be a', HTMLElement);
+ });
+
+ expect(screen.getByText(user.email), 'to be a', HTMLElement);
+
+ expect(screen.queryByRole('button', { name: /Send/ }), 'to be null');
});
- expect(screen.getByText(user.email), 'to be a', HTMLElement);
+ it('should show validation messages', async () => {
+ const user = {
+ email: 'foo@bar.com',
+ } as User;
- expect(screen.queryByRole('button', { name: /Send/ }), 'to be null');
- });
+ (feedback.send as any).callsFake(() =>
+ Promise.reject({
+ success: false,
+ errors: { email: 'error.email_invalid' },
+ }),
+ );
- it('should show validation messages', async () => {
- const user = {
- email: 'foo@bar.com',
- } as User;
+ render(
+
+
+ ,
+ );
- (feedback.send as any).callsFake(() =>
- Promise.reject({
- success: false,
- errors: { email: 'error.email_invalid' },
- }),
- );
+ fireEvent.change(screen.getByLabelText(/subject/i), {
+ target: {
+ value: 'subject',
+ },
+ });
- render(
-
-
- ,
- );
+ fireEvent.change(screen.getByLabelText(/message/i), {
+ target: {
+ value: 'the message',
+ },
+ });
- fireEvent.change(screen.getByLabelText(/subject/i), {
- target: {
- value: 'subject',
- },
+ fireEvent.click(screen.getByRole('button', { name: 'Send' }));
+
+ await waitFor(() => {
+ expect(screen.getByRole('alert'), 'to have property', 'innerHTML', 'E‑mail is invalid');
+ });
});
-
- fireEvent.change(screen.getByLabelText(/message/i), {
- target: {
- value: 'the message',
- },
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Send' }));
-
- await waitFor(() => {
- expect(
- screen.getByRole('alert'),
- 'to have property',
- 'innerHTML',
- 'E‑mail is invalid',
- );
- });
- });
});
diff --git a/packages/app/components/contact/ContactForm.tsx b/packages/app/components/contact/ContactForm.tsx
index 461f7ed..2bbe241 100644
--- a/packages/app/components/contact/ContactForm.tsx
+++ b/packages/app/components/contact/ContactForm.tsx
@@ -2,14 +2,7 @@ import React from 'react';
import { connect } from 'react-redux';
import clsx from 'clsx';
import { FormattedMessage as Message } from 'react-intl';
-import {
- Input,
- TextArea,
- Button,
- Form,
- FormModel,
- Dropdown,
-} from 'app/components/ui/form';
+import { Input, TextArea, Button, Form, FormModel, Dropdown } from 'app/components/ui/form';
import feedback from 'app/services/api/feedback';
import icons from 'app/components/ui/icons.scss';
import popupStyles from 'app/components/ui/popup/popup.scss';
@@ -21,190 +14,170 @@ import styles from './contactForm.scss';
import messages from './contactForm.intl.json';
const CONTACT_CATEGORIES = {
- // TODO: сюда позже проставить реальные id категорий с backend
- 0: ,
- 1: ,
- 2: ,
- 3: ,
- 4: ,
+ // TODO: сюда позже проставить реальные id категорий с backend
+ 0: ,
+ 1: ,
+ 2: ,
+ 3: ,
+ 4: ,
};
export class ContactForm extends React.Component<
- {
- onClose: () => void;
- user: User;
- },
- {
- isLoading: boolean;
- isSuccessfullySent: boolean;
- lastEmail: string | null;
- }
+ {
+ onClose: () => void;
+ user: User;
+ },
+ {
+ isLoading: boolean;
+ isSuccessfullySent: boolean;
+ lastEmail: string | null;
+ }
> {
- static defaultProps = {
- onClose() {},
- };
+ static defaultProps = {
+ onClose() {},
+ };
- state = {
- isLoading: false,
- isSuccessfullySent: false,
- lastEmail: null,
- };
+ state = {
+ isLoading: false,
+ isSuccessfullySent: false,
+ lastEmail: null,
+ };
- form = new FormModel();
+ form = new FormModel();
- render() {
- const { isSuccessfullySent } = this.state || {};
- const { onClose } = this.props;
+ render() {
+ const { isSuccessfullySent } = this.state || {};
+ const { onClose } = this.props;
- return (
-
-
-
-
-
-
-
-
+ return (
+
+
+
+
+
+
+
+
- {isSuccessfullySent ? this.renderSuccess() : this.renderForm()}
-
-
- );
- }
-
- renderForm() {
- const { form } = this;
- const { user } = this.props;
- const { isLoading } = this.state;
-
- return (
-
-
-
-
-
-
- );
- }
-
- renderSuccess() {
- const { lastEmail: email } = this.state;
- const { onClose } = this.props;
-
- return (
-
- );
- }
-
- onSubmit = (): Promise
=> {
- if (this.state.isLoading) {
- return Promise.resolve();
+ );
}
- this.setState({ isLoading: true });
+ renderForm() {
+ const { form } = this;
+ const { user } = this.props;
+ const { isLoading } = this.state;
- return feedback
- .send(this.form.serialize())
- .then(() =>
- this.setState({
- isSuccessfullySent: true,
- lastEmail: this.form.value('email'),
- }),
- )
- .catch((resp) => {
- if (resp.errors) {
- this.form.setErrors(resp.errors);
+ return (
+
+ );
+ }
+
+ renderSuccess() {
+ const { lastEmail: email } = this.state;
+ const { onClose } = this.props;
+
+ return (
+
+ );
+ }
+
+ onSubmit = (): Promise => {
+ if (this.state.isLoading) {
+ return Promise.resolve();
}
- logger.warn('Error sending feedback', resp);
- })
- .finally(() => this.setState({ isLoading: false }));
- };
+ this.setState({ isLoading: true });
+
+ return feedback
+ .send(this.form.serialize())
+ .then(() =>
+ this.setState({
+ isSuccessfullySent: true,
+ lastEmail: this.form.value('email'),
+ }),
+ )
+ .catch((resp) => {
+ if (resp.errors) {
+ this.form.setErrors(resp.errors);
+
+ return;
+ }
+
+ logger.warn('Error sending feedback', resp);
+ })
+ .finally(() => this.setState({ isLoading: false }));
+ };
}
export default connect((state: RootState) => ({
- user: state.user,
+ user: state.user,
}))(ContactForm);
diff --git a/packages/app/components/contact/ContactLink.tsx b/packages/app/components/contact/ContactLink.tsx
index 651afe5..aeddb08 100644
--- a/packages/app/components/contact/ContactLink.tsx
+++ b/packages/app/components/contact/ContactLink.tsx
@@ -4,24 +4,24 @@ import { create as createPopup } from 'app/components/ui/popup/actions';
import ContactForm from './ContactForm';
type Props = React.AnchorHTMLAttributes & {
- createContactPopup: () => void;
+ createContactPopup: () => void;
};
function ContactLink({ createContactPopup, ...props }: Props) {
- return (
- {
- event.preventDefault();
+ return (
+ {
+ event.preventDefault();
- createContactPopup();
- }}
- {...props}
- />
- );
+ createContactPopup();
+ }}
+ {...props}
+ />
+ );
}
export default connect(null, {
- createContactPopup: () => createPopup({ Popup: ContactForm }),
+ createContactPopup: () => createPopup({ Popup: ContactForm }),
})(ContactLink);
diff --git a/packages/app/components/contact/contactForm.intl.json b/packages/app/components/contact/contactForm.intl.json
index 3dacabc..415e84b 100644
--- a/packages/app/components/contact/contactForm.intl.json
+++ b/packages/app/components/contact/contactForm.intl.json
@@ -1,19 +1,19 @@
{
- "title": "Feedback form",
- "subject": "Subject",
- "email": "E‑mail",
- "message": "Message",
- "send": "Send",
- "philosophicalThought": "Properly formulated question — half of the answer",
- "disclaimer": "Please formulate your feedback providing as much useful information, as possible to help us understand your problem and solve it",
- "whichQuestion": "What are you interested in?",
+ "title": "Feedback form",
+ "subject": "Subject",
+ "email": "E‑mail",
+ "message": "Message",
+ "send": "Send",
+ "philosophicalThought": "Properly formulated question — half of the answer",
+ "disclaimer": "Please formulate your feedback providing as much useful information, as possible to help us understand your problem and solve it",
+ "whichQuestion": "What are you interested in?",
- "cannotAccessMyAccount": "Can not access my account",
- "foundBugOnSite": "I found a bug on the site",
- "improvementsSuggestion": "I have a suggestion for improving the functional",
- "integrationQuestion": "Service integration question",
- "other": "Other",
+ "cannotAccessMyAccount": "Can not access my account",
+ "foundBugOnSite": "I found a bug on the site",
+ "improvementsSuggestion": "I have a suggestion for improving the functional",
+ "integrationQuestion": "Service integration question",
+ "other": "Other",
- "youMessageReceived": "Your message was received. We will respond to you shortly. The answer will come to your E‑mail:",
- "close": "Close"
+ "youMessageReceived": "Your message was received. We will respond to you shortly. The answer will come to your E‑mail:",
+ "close": "Close"
}
diff --git a/packages/app/components/contact/contactForm.scss b/packages/app/components/contact/contactForm.scss
index 26ad1f1..be89711 100644
--- a/packages/app/components/contact/contactForm.scss
+++ b/packages/app/components/contact/contactForm.scss
@@ -5,81 +5,81 @@
/* Form state */
.contactForm {
- composes: popupWrapper from '~app/components/ui/popup/popup.scss';
+ composes: popupWrapper from '~app/components/ui/popup/popup.scss';
- @include popupBounding(500px);
+ @include popupBounding(500px);
}
.philosophicalThought {
- font-family: $font-family-title;
- font-size: 19px;
- color: $green;
- text-align: center;
- margin-bottom: 5px;
+ font-family: $font-family-title;
+ font-size: 19px;
+ color: $green;
+ text-align: center;
+ margin-bottom: 5px;
}
.formDisclaimer {
- font-size: 12px;
- line-height: 14px;
- text-align: center;
- max-width: 400px;
- margin: 0 auto 10px;
+ font-size: 12px;
+ line-height: 14px;
+ text-align: center;
+ max-width: 400px;
+ margin: 0 auto 10px;
}
.pairInputRow {
- display: flex;
- margin-bottom: 10px;
+ display: flex;
+ margin-bottom: 10px;
}
.pairInput {
- width: 50%;
+ width: 50%;
- &:first-of-type {
- margin-right: $popupPadding;
- }
+ &:first-of-type {
+ margin-right: $popupPadding;
+ }
}
.formMargin {
- margin-bottom: 20px;
+ margin-bottom: 20px;
}
/* Success State */
.successState {
- composes: popupWrapper from '~app/components/ui/popup/popup.scss';
+ composes: popupWrapper from '~app/components/ui/popup/popup.scss';
- @include popupBounding(320px);
+ @include popupBounding(320px);
}
.successBody {
- composes: body from '~app/components/ui/popup/popup.scss';
+ composes: body from '~app/components/ui/popup/popup.scss';
- text-align: center;
+ text-align: center;
}
.successDescription {
- @extend .formDisclaimer;
+ @extend .formDisclaimer;
- margin-bottom: 15px;
+ margin-bottom: 15px;
}
.successIcon {
- composes: checkmark from '~app/components/ui/icons.scss';
+ composes: checkmark from '~app/components/ui/icons.scss';
- font-size: 90px;
- color: #aaa;
- margin-bottom: 20px;
- line-height: 71px;
+ font-size: 90px;
+ color: #aaa;
+ margin-bottom: 20px;
+ line-height: 71px;
}
.sentToEmail {
- font-family: $font-family-title;
- color: #444;
- font-size: 18px;
+ font-family: $font-family-title;
+ color: #444;
+ font-size: 18px;
}
/* Common */
.footer {
- margin-top: 0;
+ margin-top: 0;
}
diff --git a/packages/app/components/dev/apps/ApplicationsIndex.intl.json b/packages/app/components/dev/apps/ApplicationsIndex.intl.json
index 0aa4e50..683ca2c 100644
--- a/packages/app/components/dev/apps/ApplicationsIndex.intl.json
+++ b/packages/app/components/dev/apps/ApplicationsIndex.intl.json
@@ -1,26 +1,26 @@
{
- "accountsForDevelopers": "Ely.by Accounts for developers",
- "accountsAllowsYouYoUseOauth2": "Ely.by Accounts service provides users with a quick and easy-to-use way to login to your site, launcher or Minecraft server via OAuth2 authorization protocol. You can find more information about integration with Ely.by Accounts in {ourDocumentation}.",
- "ourDocumentation": "our documentation",
- "ifYouHaveAnyTroubles": "If you are experiencing difficulties, you can always use {feedback}. We'll surely help you.",
- "feedback": "feedback",
- "weDontKnowAnythingAboutYou": "We don't know anything about you yet.",
- "youMustAuthToBegin": "You have to authorize to start.",
- "authorization": "Authorization",
- "youDontHaveAnyApplication": "You don't have any app registered yet.",
- "shallWeStart": "Shall we start?",
- "addNew": "Add new",
- "yourApplications": "Your applications:",
- "countUsers": "{count, plural, =0 {No users} one {# user} other {# users}}",
- "ifYouSuspectingThatSecretHasBeenCompromised": "If you are suspecting that your Client Secret has been compromised, then you may want to reset it value. It'll cause recall of the all \"access\" and \"refresh\" tokens that have been issued. You can also recall all issued tokens without changing Client Secret.",
- "revokeAllTokens": "Revoke all tokens",
- "resetClientSecret": "Reset Client Secret",
- "delete": "Delete",
- "editDescription": "{icon} Edit description",
- "allRefreshTokensWillBecomeInvalid": "All \"refresh\" tokens will become invalid and after next authorization the user will get permissions prompt.",
- "appAndAllTokenWillBeDeleted": "Application and all associated tokens will be deleted.",
- "takeCareAccessTokensInvalidation": "Take care because \"access\" tokens won't be invalidated immediately.",
- "cancel": "Cancel",
- "continue": "Continue",
- "performing": "Performing…"
+ "accountsForDevelopers": "Ely.by Accounts for developers",
+ "accountsAllowsYouYoUseOauth2": "Ely.by Accounts service provides users with a quick and easy-to-use way to login to your site, launcher or Minecraft server via OAuth2 authorization protocol. You can find more information about integration with Ely.by Accounts in {ourDocumentation}.",
+ "ourDocumentation": "our documentation",
+ "ifYouHaveAnyTroubles": "If you are experiencing difficulties, you can always use {feedback}. We'll surely help you.",
+ "feedback": "feedback",
+ "weDontKnowAnythingAboutYou": "We don't know anything about you yet.",
+ "youMustAuthToBegin": "You have to authorize to start.",
+ "authorization": "Authorization",
+ "youDontHaveAnyApplication": "You don't have any app registered yet.",
+ "shallWeStart": "Shall we start?",
+ "addNew": "Add new",
+ "yourApplications": "Your applications:",
+ "countUsers": "{count, plural, =0 {No users} one {# user} other {# users}}",
+ "ifYouSuspectingThatSecretHasBeenCompromised": "If you are suspecting that your Client Secret has been compromised, then you may want to reset it value. It'll cause recall of the all \"access\" and \"refresh\" tokens that have been issued. You can also recall all issued tokens without changing Client Secret.",
+ "revokeAllTokens": "Revoke all tokens",
+ "resetClientSecret": "Reset Client Secret",
+ "delete": "Delete",
+ "editDescription": "{icon} Edit description",
+ "allRefreshTokensWillBecomeInvalid": "All \"refresh\" tokens will become invalid and after next authorization the user will get permissions prompt.",
+ "appAndAllTokenWillBeDeleted": "Application and all associated tokens will be deleted.",
+ "takeCareAccessTokensInvalidation": "Take care because \"access\" tokens won't be invalidated immediately.",
+ "cancel": "Cancel",
+ "continue": "Continue",
+ "performing": "Performing…"
}
diff --git a/packages/app/components/dev/apps/ApplicationsIndex.tsx b/packages/app/components/dev/apps/ApplicationsIndex.tsx
index d0b304a..2c84c6f 100644
--- a/packages/app/components/dev/apps/ApplicationsIndex.tsx
+++ b/packages/app/components/dev/apps/ApplicationsIndex.tsx
@@ -15,144 +15,133 @@ import toolsIcon from './icons/tools.svg';
import ApplicationsList from './list';
type Props = {
- clientId: string | null;
- resetClientId: () => void; // notify parent to remove clientId from current location.href
- displayForGuest: boolean;
- applications: Array;
- isLoading: boolean;
- deleteApp: (clientId: string) => Promise;
- resetApp: (clientId: string, resetClientSecret: boolean) => Promise;
+ clientId: string | null;
+ resetClientId: () => void; // notify parent to remove clientId from current location.href
+ displayForGuest: boolean;
+ applications: Array;
+ isLoading: boolean;
+ deleteApp: (clientId: string) => Promise;
+ resetApp: (clientId: string, resetClientSecret: boolean) => Promise;
};
export default class ApplicationsIndex extends React.Component {
- render() {
- return (
-
-
-
- {(pageTitle: string) => (
-
-
- {pageTitle}
-
- )}
-
-
-
-
-
-
- ),
- }}
- />
-
-
-
-
-
- ),
- }}
- />
-
-
+ render() {
+ return (
+
+
+
+ {(pageTitle: string) => (
+
+
+ {pageTitle}
+
+ )}
+
+
+
+
+
+
+ ),
+ }}
+ />
+
+
+
+
+
+ ),
+ }}
+ />
+
+
- {this.getContent()}
-
- );
- }
-
- getContent() {
- const {
- displayForGuest,
- applications,
- isLoading,
- resetApp,
- deleteApp,
- clientId,
- resetClientId,
- } = this.props;
-
- if (applications.length > 0) {
- return (
-
- );
+ {this.getContent()}
+
+ );
}
- if (displayForGuest) {
- return ;
- }
+ getContent() {
+ const { displayForGuest, applications, isLoading, resetApp, deleteApp, clientId, resetClientId } = this.props;
- return ;
- }
+ if (applications.length > 0) {
+ return (
+
+ );
+ }
+
+ if (displayForGuest) {
+ return ;
+ }
+
+ return ;
+ }
}
function Loader({ noApps }: { noApps: boolean }) {
- return (
-
-
+ return (
+
+
-
-
- );
+ );
}
function Guest() {
- return (
-
-
-
+ return (
+
+
+
-
-
- );
+
+
+ );
}
diff --git a/packages/app/components/dev/apps/actions.ts b/packages/app/components/dev/apps/actions.ts
index 205950c..3bbc257 100644
--- a/packages/app/components/dev/apps/actions.ts
+++ b/packages/app/components/dev/apps/actions.ts
@@ -7,94 +7,85 @@ import { ThunkAction } from 'app/reducers';
import { Apps } from './reducer';
interface SetAvailableAction extends ReduxAction {
- type: 'apps:setAvailable';
- payload: Array
;
+ type: 'apps:setAvailable';
+ payload: Array;
}
export function setAppsList(apps: Array): SetAvailableAction {
- return {
- type: 'apps:setAvailable',
- payload: apps,
- };
+ return {
+ type: 'apps:setAvailable',
+ payload: apps,
+ };
}
-export function getApp(
- state: { apps: Apps },
- clientId: string,
-): OauthAppResponse | null {
- return state.apps.available.find((app) => app.clientId === clientId) || null;
+export function getApp(state: { apps: Apps }, clientId: string): OauthAppResponse | null {
+ return state.apps.available.find((app) => app.clientId === clientId) || null;
}
export function fetchApp(clientId: string): ThunkAction> {
- return async (dispatch) => {
- const app = await oauth.getApp(clientId);
+ return async (dispatch) => {
+ const app = await oauth.getApp(clientId);
- dispatch(addApp(app));
- };
+ dispatch(addApp(app));
+ };
}
interface AddAppAction extends ReduxAction {
- type: 'apps:addApp';
- payload: OauthAppResponse;
+ type: 'apps:addApp';
+ payload: OauthAppResponse;
}
function addApp(app: OauthAppResponse): AddAppAction {
- return {
- type: 'apps:addApp',
- payload: app,
- };
+ return {
+ type: 'apps:addApp',
+ payload: app,
+ };
}
export function fetchAvailableApps() {
- return async (
- dispatch: Dispatch,
- getState: () => { user: User },
- ): Promise => {
- const { id } = getState().user;
+ return async (dispatch: Dispatch, getState: () => { user: User }): Promise => {
+ const { id } = getState().user;
- if (!id) {
- dispatch(setAppsList([]));
+ if (!id) {
+ dispatch(setAppsList([]));
- return;
- }
+ return;
+ }
- const apps = await oauth.getAppsByUser(id);
+ const apps = await oauth.getAppsByUser(id);
- dispatch(setAppsList(apps));
- };
+ dispatch(setAppsList(apps));
+ };
}
export function deleteApp(clientId: string) {
- return async (dispatch: Dispatch): Promise => {
- await oauth.delete(clientId);
+ return async (dispatch: Dispatch): Promise => {
+ await oauth.delete(clientId);
- dispatch(createDeleteAppAction(clientId));
- };
+ dispatch(createDeleteAppAction(clientId));
+ };
}
interface DeleteAppAction extends ReduxAction {
- type: 'apps:deleteApp';
- payload: string;
+ type: 'apps:deleteApp';
+ payload: string;
}
function createDeleteAppAction(clientId: string): DeleteAppAction {
- return {
- type: 'apps:deleteApp',
- payload: clientId,
- };
+ return {
+ type: 'apps:deleteApp',
+ payload: clientId,
+ };
}
-export function resetApp(
- clientId: string,
- resetSecret: boolean,
-): ThunkAction> {
- return async (dispatch) => {
- const { data: app } = await oauth.reset(clientId, resetSecret);
+export function resetApp(clientId: string, resetSecret: boolean): ThunkAction> {
+ return async (dispatch) => {
+ const { data: app } = await oauth.reset(clientId, resetSecret);
- if (resetSecret) {
- dispatch(addApp(app));
- }
- };
+ if (resetSecret) {
+ dispatch(addApp(app));
+ }
+ };
}
export type Action = SetAvailableAction | DeleteAppAction | AddAppAction;
diff --git a/packages/app/components/dev/apps/applicationForm/ApplicationForm.intl.json b/packages/app/components/dev/apps/applicationForm/ApplicationForm.intl.json
index 9789a98..776201a 100644
--- a/packages/app/components/dev/apps/applicationForm/ApplicationForm.intl.json
+++ b/packages/app/components/dev/apps/applicationForm/ApplicationForm.intl.json
@@ -1,20 +1,20 @@
{
- "creatingApplication": "Creating an application",
- "website": "Web site",
- "minecraftServer": "Minecraft server",
- "toDisplayRegistrationFormChooseType": "To display registration form for a new application choose necessary type.",
- "applicationName": "Application name:",
- "appDescriptionWillBeAlsoVisibleOnOauthPage": "Application's description will be displayed at the authorization page too. It isn't a required field. In authorization process the value may be overridden.",
- "description": "Description:",
- "websiteLinkWillBeUsedAsAdditionalId": "Site's link is optional, but it can be used as an additional identifier of the application.",
- "websiteLink": "Website link:",
- "redirectUriLimitsAllowableBaseAddress": "Redirection URI (redirectUri) determines a base address, that user will be allowed to be redirected to after authorization. In order to improve security it's better to use the whole path instead of just a domain name. For example: https://example.com/oauth/ely.",
- "redirectUri": "Redirect URI:",
- "createApplication": "Create application",
- "serverName": "Server name:",
- "ipAddressIsOptionButPreferable": "IP address is optional, but is very preferable. It might become handy in case of we suddenly decide to play on your server with the entire band (=",
- "serverIp": "Server IP:",
- "youCanAlsoSpecifyServerSite": "You also can specify either server's site URL or its community in a social network.",
- "updatingApplication": "Updating an application",
- "updateApplication": "Update application"
+ "creatingApplication": "Creating an application",
+ "website": "Web site",
+ "minecraftServer": "Minecraft server",
+ "toDisplayRegistrationFormChooseType": "To display registration form for a new application choose necessary type.",
+ "applicationName": "Application name:",
+ "appDescriptionWillBeAlsoVisibleOnOauthPage": "Application's description will be displayed at the authorization page too. It isn't a required field. In authorization process the value may be overridden.",
+ "description": "Description:",
+ "websiteLinkWillBeUsedAsAdditionalId": "Site's link is optional, but it can be used as an additional identifier of the application.",
+ "websiteLink": "Website link:",
+ "redirectUriLimitsAllowableBaseAddress": "Redirection URI (redirectUri) determines a base address, that user will be allowed to be redirected to after authorization. In order to improve security it's better to use the whole path instead of just a domain name. For example: https://example.com/oauth/ely.",
+ "redirectUri": "Redirect URI:",
+ "createApplication": "Create application",
+ "serverName": "Server name:",
+ "ipAddressIsOptionButPreferable": "IP address is optional, but is very preferable. It might become handy in case of we suddenly decide to play on your server with the entire band (=",
+ "serverIp": "Server IP:",
+ "youCanAlsoSpecifyServerSite": "You also can specify either server's site URL or its community in a social network.",
+ "updatingApplication": "Updating an application",
+ "updateApplication": "Update application"
}
diff --git a/packages/app/components/dev/apps/applicationForm/ApplicationForm.tsx b/packages/app/components/dev/apps/applicationForm/ApplicationForm.tsx
index 4b0938c..a594bec 100644
--- a/packages/app/components/dev/apps/applicationForm/ApplicationForm.tsx
+++ b/packages/app/components/dev/apps/applicationForm/ApplicationForm.tsx
@@ -7,10 +7,7 @@ import { ApplicationType } from 'app/components/dev/apps';
import { Form, FormModel, Button } from 'app/components/ui/form';
import { BackButton } from 'app/components/profile/ProfileForm';
import { COLOR_GREEN } from 'app/components/ui';
-import {
- TYPE_APPLICATION,
- TYPE_MINECRAFT_SERVER,
-} from 'app/components/dev/apps';
+import { TYPE_APPLICATION, TYPE_MINECRAFT_SERVER } from 'app/components/dev/apps';
import styles from 'app/components/profile/profileForm.scss';
import logger from 'app/services/logger';
import messages from './ApplicationForm.intl.json';
@@ -20,125 +17,116 @@ import WebsiteType from './WebsiteType';
import MinecraftServerType from './MinecraftServerType';
type TypeToForm = Record<
- ApplicationType,
- {
- label: MessageDescriptor;
- component: React.ComponentType;
- }
+ ApplicationType,
+ {
+ label: MessageDescriptor;
+ component: React.ComponentType;
+ }
>;
const typeToForm: TypeToForm = {
- [TYPE_APPLICATION]: {
- label: messages.website,
- component: WebsiteType,
- },
- [TYPE_MINECRAFT_SERVER]: {
- label: messages.minecraftServer,
- component: MinecraftServerType,
- },
+ [TYPE_APPLICATION]: {
+ label: messages.website,
+ component: WebsiteType,
+ },
+ [TYPE_MINECRAFT_SERVER]: {
+ label: messages.minecraftServer,
+ component: MinecraftServerType,
+ },
};
type TypeToLabel = Record;
-const typeToLabel: TypeToLabel = ((Object.keys(typeToForm) as unknown) as Array<
- ApplicationType
->).reduce((result, key) => {
- result[key] = typeToForm[key].label;
+const typeToLabel: TypeToLabel = ((Object.keys(typeToForm) as unknown) as Array).reduce(
+ (result, key) => {
+ result[key] = typeToForm[key].label;
- return result;
-}, {} as TypeToLabel);
+ return result;
+ },
+ {} as TypeToLabel,
+);
export default class ApplicationForm extends React.Component<{
- app: OauthAppResponse;
- form: FormModel;
- displayTypeSwitcher?: boolean;
- type: ApplicationType | null;
- setType: (type: ApplicationType) => void;
- onSubmit: (form: FormModel) => Promise;
+ app: OauthAppResponse;
+ form: FormModel;
+ displayTypeSwitcher?: boolean;
+ type: ApplicationType | null;
+ setType: (type: ApplicationType) => void;
+ onSubmit: (form: FormModel) => Promise;
}> {
- static defaultProps = {
- setType: () => {},
- };
+ static defaultProps = {
+ setType: () => {},
+ };
- render() {
- const { type, setType, form, displayTypeSwitcher, app } = this.props;
- const { component: FormComponent } = (type && typeToForm[type]) || {};
- const isUpdate = app.clientId !== '';
+ render() {
+ const { type, setType, form, displayTypeSwitcher, app } = this.props;
+ const { component: FormComponent } = (type && typeToForm[type]) || {};
+ const isUpdate = app.clientId !== '';
- return (
-