mirror of https://github.com/Siphonay/mastodon
[Glitch] Upgrade to react-router v5 in onboarding code
Port 1b70d7ed7c
to glitch-soc
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
06e819537b
commit
6dc812dd51
|
@ -4,7 +4,7 @@ import React from 'react';
|
||||||
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link, withRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
@ -19,6 +19,7 @@ import Column from 'flavours/glitch/features/ui/components/column';
|
||||||
import { me } from 'flavours/glitch/initial_state';
|
import { me } from 'flavours/glitch/initial_state';
|
||||||
import { makeGetAccount } from 'flavours/glitch/selectors';
|
import { makeGetAccount } from 'flavours/glitch/selectors';
|
||||||
import { assetHost } from 'flavours/glitch/utils/config';
|
import { assetHost } from 'flavours/glitch/utils/config';
|
||||||
|
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||||
import illustration from 'mastodon/../images/elephant_ui_conversation.svg';
|
import illustration from 'mastodon/../images/elephant_ui_conversation.svg';
|
||||||
|
|
||||||
import ArrowSmallRight from './components/arrow_small_right';
|
import ArrowSmallRight from './components/arrow_small_right';
|
||||||
|
@ -39,15 +40,11 @@ const mapStateToProps = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Onboarding extends ImmutablePureComponent {
|
class Onboarding extends ImmutablePureComponent {
|
||||||
|
|
||||||
static contextTypes = {
|
|
||||||
router: PropTypes.object.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
account: ImmutablePropTypes.map,
|
account: ImmutablePropTypes.map,
|
||||||
multiColumn: PropTypes.bool,
|
multiColumn: PropTypes.bool,
|
||||||
|
...WithRouterPropTypes,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -57,11 +54,10 @@ class Onboarding extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleClose = () => {
|
handleClose = () => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, history } = this.props;
|
||||||
const { router } = this.context;
|
|
||||||
|
|
||||||
dispatch(closeOnboarding());
|
dispatch(closeOnboarding());
|
||||||
router.history.push('/home');
|
history.push('/home');
|
||||||
};
|
};
|
||||||
|
|
||||||
handleProfileClick = () => {
|
handleProfileClick = () => {
|
||||||
|
@ -73,10 +69,9 @@ class Onboarding extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleComposeClick = () => {
|
handleComposeClick = () => {
|
||||||
const { dispatch, intl } = this.props;
|
const { dispatch, intl, history } = this.props;
|
||||||
const { router } = this.context;
|
|
||||||
|
|
||||||
dispatch(focusCompose(router.history, intl.formatMessage(messages.template)));
|
dispatch(focusCompose(history, intl.formatMessage(messages.template)));
|
||||||
};
|
};
|
||||||
|
|
||||||
handleShareClick = () => {
|
handleShareClick = () => {
|
||||||
|
@ -151,4 +146,4 @@ class Onboarding extends ImmutablePureComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps)(injectIntl(Onboarding));
|
export default withRouter(connect(mapStateToProps)(injectIntl(Onboarding)));
|
||||||
|
|
Loading…
Reference in New Issue