diff --git a/src/visits/ShortUrlVisits.js b/src/visits/ShortUrlVisits.js
index 20b5f504..d18dbd66 100644
--- a/src/visits/ShortUrlVisits.js
+++ b/src/visits/ShortUrlVisits.js
@@ -31,12 +31,15 @@ const ShortUrlVisits = (
getShortUrlDetail: PropTypes.func,
shortUrlDetail: shortUrlDetailType,
cancelGetShortUrlVisits: PropTypes.func,
+ matchMedia: PropTypes.func,
};
state = {
startDate: undefined,
endDate: undefined,
showTable: false,
+ tableIsSticky: false,
+ isMobileDevice: false,
};
loadVisits = (loadDetail = false) => {
@@ -54,13 +57,22 @@ const ShortUrlVisits = (
}
};
+ setIsMobileDevice = () => {
+ const { matchMedia = window.matchMedia } = this.props;
+
+ this.setState({ isMobileDevice: matchMedia('(max-width: 991px)').matches });
+ };
+
componentDidMount() {
this.timeWhenMounted = new Date().getTime();
this.loadVisits(true);
+ this.setIsMobileDevice();
+ window.addEventListener('resize', this.setIsMobileDevice);
}
componentWillUnmount() {
this.props.cancelGetShortUrlVisits();
+ window.removeEventListener('resize', this.setIsMobileDevice);
}
render() {
@@ -155,7 +167,11 @@ const ShortUrlVisits = (
{visits.length > 0 && (
-