mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
728477e238
* fix: setup new routes * fix: copy toggle * fix: link to correct project * fix: redirect oss to default * fix: update tests * fix: edit path * fix: remove invalid property * fix: add project to test data * fix: update paths to use features * fix: update test data * fix: update snapshots * fix: only show button to add toggle if you have access * fix: change heading * fix: use new route * fix: archive view * fix: update snapshots * fix: sorting headers * fix: list headers * fix: only show span if revive is present * fix: add border to list * fix: update snapshots * fix: remove console log
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
import { Component } from 'react';
|
|
import { withRouter } from 'react-router-dom';
|
|
import PropTypes from 'prop-types';
|
|
|
|
class ScrollToTop extends Component {
|
|
static propTypes = {
|
|
location: PropTypes.object.isRequired,
|
|
};
|
|
|
|
componentDidUpdate(prevProps) {
|
|
if (this.props.location !== prevProps.location) {
|
|
if (
|
|
this.props.location.pathname.includes('/metrics') ||
|
|
this.props.location.pathname.includes('/variants') ||
|
|
this.props.location.pathname.includes('/strategies') ||
|
|
this.props.location.pathname.includes('/logs') ||
|
|
this.props.location.pathname.includes('/admin/api') ||
|
|
this.props.location.pathname.includes('/admin/users') ||
|
|
this.props.location.pathname.includes('/admin/auth')
|
|
) {
|
|
return;
|
|
}
|
|
|
|
window.scrollTo(0, 0);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
export default withRouter(ScrollToTop);
|