-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-22757 Fix for date toast placement in web mobile view #5090
Conversation
* Check if toast is present and push it down by 50px
@nevyangelova @Willyfrog Let me know what you guys think. I am going to add tests after you guys have a look at it. |
className += ' rhs'; | ||
} | ||
|
||
return ( | ||
<div | ||
className={className} | ||
style={this.props.stylesOverride} | ||
style={toastPresent ? {top: '50px'} : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0/5 maybe we can drive this by className.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not a fan of using classes if they are not reusable. It is hard to clean up with the amount of css we already have. I am gonna change to class though.
unreadToastProps = { | ||
...unreadToastProps, | ||
onDismiss: this.hideUnreadToast, | ||
onClick: this.scrollToLatestMessages, | ||
onClickMessage: Utils.localizeMessage('postlist.toast.scrollToBottom', 'Jump to recents'), | ||
show: true, | ||
showActions: !this.props.atLatestPost || (this.props.atLatestPost && !this.props.atBottom), | ||
showActions: !atLatestPost || (atLatestPost && !atBottom), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/5 can be simplified to !(atLatestPost && atBottom)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah, Nice. i cannot wrap my head around conditions usually. Will change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good though I like the solution 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think I’d have gone for #2 as it would allow for further usage if needed, not only for this view but for any other we might have. Having a way to know if the toast is present and probably some info with it, might be an easy way to share all the calculations already done for displaying on the toast.
With that said, this is an interesting approach, I didn’t know about react.clone, so that’s a new thing, but if it will always depends on the toast to be rendered, shouldn’t we pass the needed info to have the toast render it and remove cloning? Or are we planning to reuse the toast on other situations?
className += ' rhs'; | ||
} | ||
|
||
return ( | ||
<div | ||
className={className} | ||
style={this.props.stylesOverride} | ||
style={toastPresent ? {top: '50px'} : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don’t we use classname for this? We are already adding classes depending on what is around the floating timestamp, so another if wouldn’t hurt and it would probably be cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Classes already exist and there weren't part of the PR. As i said i am not a fan personally to use classes in out codebase anymore for things which are not reusable, or at least applied unconditionally. Things like these tend to make maintenance of css hard. There were some arguments in the past about performance of css vs inline styles in react but with the level of nesting we normally create the browsers will have a much harder time figuring out the specificity IMO.
In this case i am gonna change to class as it is popular behaviour and i am like 1/5 on this.
Ya, i think i am gonna change it to have a state in redux.
The problem removing the cloning and passing in the props is that we need |
@Willyfrog @nevyangelova this is up for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, slight concern about naming but nothing too serious
data: true, | ||
type: 'UPDATE_TOAST_STATUS' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slightly concerned about the naming here: what should someone think of "update_toast_status=true"? maybe we should rename into something more descriptive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am 0/5 on this but this is not something that people stumble up on when reading code IMO.
/update-branch |
Error trying to update the PR. |
Mattermost test server updated with git commit Access here: https://mattermost-webapp-pr-5090.test.mattermost.cloud |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @sudheerDev
Tested, looks good to merge.
- Verified date toast appears below unread/new message toast in mobile web view
- There is an issue with the history toast missing, and will be filed separately
Test server destroyed |
@sudheerDev
|
* MM-22757 Fix for date toast placement in web mobile view * Check if toast is present and push it down by 50px * Rename func * Change to dispatching an action on change of toast * * Use className utility * Fix for lint * Fix tests after master merge * Change default value in reducer
Please disregard all the label changes and a review re-request. |
Summary
Push the toast by 50px when toast is present
Issue:
FloatingTimestamp
component need to know if any toasts are present in the UI. toasts state is only available in ToastWrapper as of now.Solutions:
add.classList
ToastWrapper
.FloatingTimestamp
in ToastWrapperi went with 3 reasons being
FloatingTimestamp
Ticket Link
https://mattermost.atlassian.net/browse/MM-22757