[Glitch] Upgrade to react-router v5

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:
Renaud Chaput
2023-10-19 19:44:55 +02:00
committed by Claire
parent 245513d630
commit d6eacb79c6
51 changed files with 413 additions and 385 deletions

View File

@@ -4,26 +4,25 @@ import { createPortal } from 'react-dom';
import { FormattedMessage } from 'react-intl';
import { Icon } from 'flavours/glitch/components/icon';
import { withRouter } from 'react-router-dom';
import { Icon } from 'flavours/glitch/components/icon';
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
export default class ColumnBackButton extends PureComponent {
static contextTypes = {
router: PropTypes.object,
};
class ColumnBackButton extends PureComponent {
static propTypes = {
multiColumn: PropTypes.bool,
...WithRouterPropTypes,
};
handleClick = () => {
const { router } = this.context;
const { history } = this.props;
if (router.history.location?.state?.fromMastodon) {
router.history.goBack();
if (history.location?.state?.fromMastodon) {
history.goBack();
} else {
router.history.push('/');
history.push('/');
}
};
@@ -57,3 +56,5 @@ export default class ColumnBackButton extends PureComponent {
}
}
export default withRouter(ColumnBackButton);