This also tries to make the autoscroll functionality a bit more consistent, where all items are always shown in the list, but items which have not yet occurred will be partially transparent until they happen. Due to that change, autoscroll behavior which previously always went all the way to the bottom of a list didn't make sense anymore, so now it scrolls to the current item.
32 lines
No EOL
939 B
JavaScript
32 lines
No EOL
939 B
JavaScript
import React from 'react';
|
|
import { withRouter } from 'react-router-dom';
|
|
import { connect } from 'react-redux';
|
|
import { withSiteId } from 'App/routes';
|
|
import { setSiteId } from 'Duck/site';
|
|
|
|
export default BaseComponent => {
|
|
@withRouter
|
|
@connect((state, props) => ({
|
|
urlSiteId: props.match.params.siteId,
|
|
siteId: state.getIn(['site', 'siteId']),
|
|
}), {
|
|
setSiteId,
|
|
})
|
|
class WrappedClass extends React.PureComponent {
|
|
push = (location) => {
|
|
const { history, siteId } = this.props;
|
|
if (typeof location === 'string') {
|
|
history.push(withSiteId(location, siteId));
|
|
} else if (typeof location === 'object') {
|
|
history.push({ ...location, pathname: withSiteId(location.pathname, siteId) });
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const { history, ...other } = this.props
|
|
|
|
return <BaseComponent {...other} history={{ ...history, push: this.push }} />
|
|
}
|
|
}
|
|
return WrappedClass
|
|
} |