Some more minor fixes

This commit is contained in:
SleepWalker 2019-12-30 10:47:29 +02:00
parent f900321a12
commit 925a3a868e
12 changed files with 42 additions and 43 deletions

View File

@ -8,7 +8,7 @@ export default function AuthTitle({ title }: { title: MessageDescriptor }) {
{msg => (
<span>
{msg}
<Helmet title={msg} />
<Helmet title={msg as string} />
</span>
)}
</Message>

View File

@ -86,7 +86,7 @@ export default class ChangeEmail extends React.Component<Props, State> {
<Message {...messages.changeEmailTitle}>
{pageTitle => (
<h3 className={styles.violetTitle}>
<Helmet title={pageTitle} />
<Helmet title={pageTitle as string} />
{pageTitle}
</h3>
)}

View File

@ -8,7 +8,7 @@ import ChangePassword from 'app/components/profile/changePassword/ChangePassword
describe('<ChangePassword />', () => {
it('renders two <Input /> components', () => {
const component = shallow(<ChangePassword onSubmit={() => {}} />);
const component = shallow(<ChangePassword onSubmit={async () => {}} />);
expect(component.find('Input'), 'to satisfy', { length: 2 });
});

View File

@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import React from 'react';
import { FormattedMessage as Message } from 'react-intl';
import { Helmet } from 'react-helmet-async';
import {
@ -9,20 +8,18 @@ import {
Form,
FormModel,
} from 'app/components/ui/form';
import { BackButton } from 'app/components/profile/ProfileForm';
import styles from 'app/components/profile/profileForm.scss';
import { BackButton } from '../ProfileForm';
import styles from '../profileForm.scss';
import messages from './ChangePassword.intl.json';
export default class ChangePassword extends Component {
static displayName = 'ChangePassword';
interface Props {
form: FormModel;
onSubmit: (form: FormModel) => Promise<void>;
}
static propTypes = {
form: PropTypes.instanceOf(FormModel),
onSubmit: PropTypes.func.isRequired,
};
static get defaultProps() {
export default class ChangePassword extends React.Component<Props> {
static get defaultProps(): Partial<Props> {
return {
form: new FormModel(),
};
@ -41,7 +38,7 @@ export default class ChangePassword extends Component {
<Message {...messages.changePasswordTitle}>
{pageTitle => (
<h3 className={styles.title}>
<Helmet title={pageTitle} />
<Helmet title={pageTitle as string} />
{pageTitle}
</h3>
)}

View File

@ -1,26 +1,21 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import React from 'react';
import { FormattedMessage as Message } from 'react-intl';
import { Helmet } from 'react-helmet-async';
import { Input, Button, Form, FormModel } from 'app/components/ui/form';
import { BackButton } from 'app/components/profile/ProfileForm';
import styles from 'app/components/profile/profileForm.scss';
import styles from '../profileForm.scss';
import messages from './ChangeUsername.intl.json';
export default class ChangeUsername extends Component {
static displayName = 'ChangeUsername';
interface Props {
username: string;
form: FormModel;
onChange: (name: string) => void;
onSubmit: (form: FormModel) => Promise<void>;
}
static propTypes = {
username: PropTypes.string.isRequired,
form: PropTypes.instanceOf(FormModel),
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
};
static get defaultProps() {
export default class ChangeUsername extends React.Component<Props> {
static get defaultProps(): Partial<Props> {
return {
form: new FormModel(),
};
@ -39,7 +34,7 @@ export default class ChangeUsername extends Component {
<Message {...messages.changeUsernameTitle}>
{pageTitle => (
<h3 className={styles.title}>
<Helmet title={pageTitle} />
<Helmet title={pageTitle as string} />
{pageTitle}
</h3>
)}
@ -80,7 +75,7 @@ export default class ChangeUsername extends Component {
);
}
onUsernameChange = event => {
onUsernameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
this.props.onChange(event.target.value);
};

View File

@ -34,7 +34,7 @@ class MultiFactorAuth extends React.Component<{
<Message {...messages.mfaTitle}>
{pageTitle => (
<h3 className={styles.title}>
<Helmet title={pageTitle} />
<Helmet title={pageTitle as string} />
{pageTitle}
</h3>
)}

View File

@ -35,6 +35,7 @@
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"@types/react-helmet": "^5.0.14",
"@types/webpack-env": "^1.14.1",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.15.1"

View File

@ -1,10 +1,8 @@
import React from 'react';
import { FooterMenu } from 'app/components/footerMenu';
import { Link } from 'react-router-dom';
import { FormattedMessage as Message } from 'react-intl';
import { Helmet } from 'react-helmet-async';
import { FooterMenu } from 'app/components/footerMenu';
import styles from './404.scss';
import messages from './PageNotFound.intl.json';
@ -14,7 +12,7 @@ export default function PageNotFound() {
return (
<div className={styles.page}>
<Message {...messages.title}>
{pageTitle => <Helmet title={pageTitle} />}
{pageTitle => <Helmet title={pageTitle as string} />}
</Message>
<div className={styles.loading}>

View File

@ -42,7 +42,7 @@ export default class SuccessOauthPage extends React.Component<{
return (
<div className={styles.page}>
<Message {...messages.title}>
{pageTitle => <Helmet title={pageTitle} />}
{pageTitle => <Helmet title={pageTitle as string} />}
</Message>
<div className={styles.wrapper}>

View File

@ -98,7 +98,7 @@ export default class RulesPage extends Component<{
return (
<div>
<Message {...messages.title}>
{pageTitle => <Helmet title={pageTitle} />}
{pageTitle => <Helmet title={pageTitle as string} />}
</Message>
<div className={styles.rules}>

View File

@ -1,6 +1,7 @@
import React from 'react';
import { hot } from 'react-hot-loader/root';
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { History } from 'history';
import { Store } from 'app/reducers';
import AuthFlowRoute from 'app/containers/AuthFlowRoute';
import RootPage from 'app/pages/root/RootPage';
@ -14,7 +15,7 @@ const SuccessOauthPage = React.lazy(() =>
),
);
const App = ({ store, history }: { store: Store; history: any }) => (
const App = ({ store, history }: { store: Store; history: History<any> }) => (
<ContextProvider store={store} history={history}>
<React.Suspense fallback={<ComponentLoader />}>
<Switch>

View File

@ -2161,7 +2161,7 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
"@types/node@*", "@types/node@^12.0.0":
"@types/node@*":
version "12.12.22"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.22.tgz#b8d9eae3328b96910a373cf06ac8d3c5abe9c200"
integrity sha512-r5i93jqbPWGXYXxianGATOxTelkp6ih/U0WVnvaqAvTqM+0U6J3kw6Xk6uq/dWNRkEVw/0SLcO5ORXbVNz4FMQ==
@ -2194,6 +2194,13 @@
"@types/history" "*"
"@types/react" "*"
"@types/react-helmet@^5.0.14":
version "5.0.14"
resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-5.0.14.tgz#a07979ccb2cee088e74e735c84058fc8607d32e4"
integrity sha512-Q73FFg7+LjblfSQUNbnjrwy2T1avBP8yevEgNrkDjyz1rBbnXkuOQcEV7I5wvmAic9FLUk0CnkLieEDej84Zkw==
dependencies:
"@types/react" "*"
"@types/react-redux@^7.1.5":
version "7.1.5"
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.5.tgz#c7a528d538969250347aa53c52241051cf886bd3"