Skip to content

Commit 2b671a5

Browse files
authored
Merge pull request #6697 from nursoltan-s/timeline-wall-final-fix
fix mobile thumbnail
2 parents 8b9d559 + a4544b2 commit 2b671a5

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
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/pending-approvals/approval-item/index.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ function ApprovalItem({
9494
<ModalDeleteConfirmation
9595
id={event.id}
9696
eventItem={showModalDelete}
97-
onClose={(result) => {
98-
if (result === true) {
99-
removeEvent(showModalDelete);
100-
}
97+
onClose={() => {
10198
setShowModalDelete(false);
10299
}}
103100
handle={event.createdBy}

src/shared/containers/timeline-wall/pending-approvals/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@
3939
font-size: 18px;
4040
line-height: 22px;
4141
text-align: center;
42+
margin-bottom: 32px;
4243
}

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: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import './styles.scss';
1616
import { DEFAULT_AVATAR_URL } from '../../../../../utils/url';
1717

1818
function EventItem({
19-
className, isLeft, eventItem, removeEvent, deleteEvent, isAdmin, userAvatars,
19+
className, isLeft, eventItem, deleteEvent, isAdmin, userAvatars,
2020
}) {
2121
const [isExpanded, setIsExpanded] = useState(false);
2222
const [showModalPhoto, setShowModalPhoto] = useState(false);
@@ -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}
@@ -114,10 +114,8 @@ function EventItem({
114114
<ModalDeleteConfirmation
115115
id={eventItem.id}
116116
eventItem={showModalDelete}
117-
onClose={(result) => {
118-
if (result === true) {
119-
removeEvent(showModalDelete);
120-
}
117+
handle={eventItem.createdBy}
118+
onClose={() => {
121119
setShowModalDelete(false);
122120
}}
123121
deleteEvent={deleteEvent}
@@ -137,7 +135,6 @@ EventItem.defaultProps = {
137135
creator: {},
138136
media: [],
139137
},
140-
removeEvent: () => {},
141138
isAdmin: false,
142139
userAvatars: {},
143140
};
@@ -149,7 +146,6 @@ EventItem.propTypes = {
149146
className: PT.string,
150147
isLeft: PT.bool,
151148
eventItem: PT.any,
152-
removeEvent: PT.func,
153149
isAdmin: PT.bool,
154150
userAvatars: PT.shape(),
155151
deleteEvent: PT.func.isRequired,

src/shared/containers/timeline-wall/timeline-events/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
font-weight: 500;
2727
font-size: 18px;
2828
line-height: 22px;
29+
margin-bottom: 32px;
2930
}
3031

3132
.hide-mobile {

0 commit comments

Comments
 (0)