Skip to content

Commit da8c96d

Browse files
committed
fix mobile thumbnail
1 parent c22b138 commit da8c96d

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/shared/containers/timeline-wall/index.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import IconCheveronDownBlue from 'assets/images/timeline-wall/cheveron-down-blue
77
import { deleteEventById, approveEventById, rejectEventById } from 'services/timelineWall';
88
import cn from 'classnames';
99
import moment from 'moment';
10+
import { useMediaQuery } from 'react-responsive';
1011
import _ from 'lodash';
1112
import timelineActions from 'actions/timelineWall';
1213
import LoadingIndicator from 'components/LoadingIndicator';
@@ -40,6 +41,9 @@ function TimelineWallContainer(props) {
4041

4142
const role = 'Admin User';
4243
const authToken = _.get(auth, 'tokenV3');
44+
const isMobile = useMediaQuery({
45+
query: '(max-device-width: 768px)',
46+
});
4347

4448
useEffect(() => {
4549
if (authToken) {
@@ -79,7 +83,7 @@ function TimelineWallContainer(props) {
7983

8084
useEffect(() => {
8185
const currentYear = selectedFilterValue.year;
82-
const currentMonth = selectedFilterValue.month;
86+
const currentMonth = Math.max(selectedFilterValue.month, 0);
8387
const maxYear = 2032;
8488
let target;
8589
let date = moment(`${currentYear}-${currentMonth + 1}`).format('YYYY-MM');
@@ -96,7 +100,11 @@ function TimelineWallContainer(props) {
96100
if (target) {
97101
const yOffset = -10;
98102
const coordinate = target.getBoundingClientRect().top + window.pageYOffset + yOffset;
99-
window.scrollTo({ top: coordinate, behavior: 'smooth' });
103+
if (isMobile) {
104+
setTimeout(target.scrollTo(), 100);
105+
} else {
106+
window.scrollTo({ top: coordinate, behavior: 'smooth' });
107+
}
100108
} else {
101109
window.scrollTo({ top: 0, behavior: 'smooth' });
102110
}

src/shared/containers/timeline-wall/photo-items-mobile/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function PhotoItemsMobile({ photos, className }) {
3333
role="button"
3434
tabIndex={0}
3535
>
36-
{selectedPhotoObject && !selectedPhotoObject.videoThumnailUrl ? (<img src={selectedPhotoObject.url} alt="main" />) : null}
36+
{selectedPhotoObject && !selectedPhotoObject.videoThumnailUrl ? (<img src={selectedPhotoObject.previewUrl || selectedPhotoObject.url} alt="main" />) : null}
3737
{selectedPhotoObject && !!selectedPhotoObject.videoThumnailUrl ? (
3838
<React.Fragment>
3939
<img src={selectedPhotoObject.videoThumnailUrl} alt="main" />

src/shared/containers/timeline-wall/timeline-events/events/event-item/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function EventItem({
6767
/>
6868
{eventItem.mediaFiles.map(photo => (
6969
<PhotoVideoItem
70-
styleName="photo-item hide-mobile"
70+
styleName="photo-item"
7171
url={photo.previewUrl || photo.url}
7272
videoThumnailUrl={photo.videoThumnailUrl}
7373
isUrlPhoto={!photo.videoThumnailUrl}

0 commit comments

Comments
 (0)