fix: remove scrolling (#37098)
This commit is contained in:
committed by
mrugesh
parent
6103991d8b
commit
6ed3426128
9
client/package-lock.json
generated
9
client/package-lock.json
generated
@ -16956,15 +16956,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-scroll": {
|
|
||||||
"version": "1.7.14",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-scroll/-/react-scroll-1.7.14.tgz",
|
|
||||||
"integrity": "sha512-zQ2/8+TaEBctA9RSQspP5GWMffA6g7u+AB9gMWB42btZZTBcGEyomvxnm52UVVELjqXOpD9U1/tHhVTNXyntbQ==",
|
|
||||||
"requires": {
|
|
||||||
"lodash.throttle": "^4.1.1",
|
|
||||||
"prop-types": "^15.5.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"react-side-effect": {
|
"react-side-effect": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz",
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
"react-redux": "^5.0.7",
|
"react-redux": "^5.0.7",
|
||||||
"react-reflex": "^3.0.16",
|
"react-reflex": "^3.0.16",
|
||||||
"react-responsive": "^6.1.1",
|
"react-responsive": "^6.1.1",
|
||||||
"react-scroll": "^1.7.14",
|
|
||||||
"react-spinkit": "^3.0.0",
|
"react-spinkit": "^3.0.0",
|
||||||
"react-stripe-elements": "^2.0.3",
|
"react-stripe-elements": "^2.0.3",
|
||||||
"react-tooltip": "^3.10.0",
|
"react-tooltip": "^3.10.0",
|
||||||
|
@ -5,7 +5,6 @@ import { bindActionCreators } from 'redux';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import uniq from 'lodash/uniq';
|
import uniq from 'lodash/uniq';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { scroller } from 'react-scroll';
|
|
||||||
|
|
||||||
import SuperBlock from './components/SuperBlock';
|
import SuperBlock from './components/SuperBlock';
|
||||||
import Spacer from '../helpers/Spacer';
|
import Spacer from '../helpers/Spacer';
|
||||||
@ -57,21 +56,9 @@ function mapDispatchToProps(dispatch) {
|
|||||||
export class Map extends Component {
|
export class Map extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { idToScrollto: null };
|
|
||||||
this.initializeExpandedState();
|
this.initializeExpandedState();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
if (this.state.idToScrollto) {
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
scroller.scrollTo(this.state.idToScrollto, {
|
|
||||||
duration: 1500,
|
|
||||||
smooth: 'easeInOutQuint',
|
|
||||||
offset: -35
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// As this happens in the constructor, it's necessary to manipulate state
|
// As this happens in the constructor, it's necessary to manipulate state
|
||||||
// directly.
|
// directly.
|
||||||
initializeExpandedState() {
|
initializeExpandedState() {
|
||||||
@ -89,16 +76,12 @@ export class Map extends Component {
|
|||||||
// find the challenge that has the same superblock with hash
|
// find the challenge that has the same superblock with hash
|
||||||
if (hash) {
|
if (hash) {
|
||||||
node = nodes.find(node => dasherize(node.superBlock) === hash);
|
node = nodes.find(node => dasherize(node.superBlock) === hash);
|
||||||
// eslint-disable-next-line react/no-direct-mutation-state
|
|
||||||
if (node) this.state = { idToScrollto: dasherize(node.superBlock) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is no hash or the hash did not match any challenge superblock
|
// if there is no hash or the hash did not match any challenge superblock
|
||||||
// and there was a currentChallengeId
|
// and there was a currentChallengeId
|
||||||
if (!node && currentChallengeId) {
|
if (!node && currentChallengeId) {
|
||||||
node = nodes.find(node => node.id === currentChallengeId);
|
node = nodes.find(node => node.id === currentChallengeId);
|
||||||
// eslint-disable-next-line react/no-direct-mutation-state
|
|
||||||
if (node) this.state = { idToScrollto: dasherize(node.title) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node) node = nodes[0];
|
if (!node) node = nodes[0];
|
||||||
|
Reference in New Issue
Block a user