PLT-1917 Add 'new messages' indicator when scrolled up (#2612)
* Add 'new messages' indicator when scrolled up * Don't show unread message alert for new chats * Move unread alert to state and cWRProps
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
29e1a85360
Коммит
0d85b998ca
@@ -41,7 +41,8 @@ export default class PostsView extends React.Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
displayNameType: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', 'false'),
|
displayNameType: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', 'false'),
|
||||||
isScrolling: false,
|
isScrolling: false,
|
||||||
topPostId: null
|
topPostId: null,
|
||||||
|
showUnreadMessageAlert: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
static get SCROLL_TYPE_FREE() {
|
static get SCROLL_TYPE_FREE() {
|
||||||
@@ -386,6 +387,13 @@ export default class PostsView extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (this.props.postList && this.props.postList.order.length) {
|
||||||
|
if (this.props.postList.order[0] !== nextProps.postList.order[0] && nextProps.scrollType !== PostsView.SCROLL_TYPE_BOTTOM && nextProps.scrollType !== PostsView.SCROLL_TYPE_NEW_MESSAGE) {
|
||||||
|
this.setState({showUnreadMessageAlert: true});
|
||||||
|
} else if (nextProps.scrollType === PostsView.SCROLL_TYPE_BOTTOM) {
|
||||||
|
this.setState({showUnreadMessageAlert: false});
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!this.props.isActive && nextProps.isActive) {
|
if (!this.props.isActive && nextProps.isActive) {
|
||||||
this.updateState();
|
this.updateState();
|
||||||
PreferenceStore.addChangeListener(this.updateState);
|
PreferenceStore.addChangeListener(this.updateState);
|
||||||
@@ -514,6 +522,18 @@ export default class PostsView extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className='post-list__new-messages-below'
|
||||||
|
onClick={this.scrollToBottomAnimated}
|
||||||
|
hidden={!this.state.showUnreadMessageAlert}
|
||||||
|
>
|
||||||
|
<i className='fa fa-arrow-circle-o-down'></i>
|
||||||
|
|
||||||
|
<FormattedMessage
|
||||||
|
id='posts_view.newMsg'
|
||||||
|
defaultMessage='New Messages'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,23 @@ body.ios {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-list__new-messages-below{
|
||||||
|
background-color: #9fa5ad;
|
||||||
|
border-radius: 1em;
|
||||||
|
bottom: 0;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
left: 50%;
|
||||||
|
padding: .25em .75em;
|
||||||
|
position: absolute;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
transition: bottom .5s cubic-bezier(0.86, 0, 0.07, 1);
|
||||||
|
&[hidden]{
|
||||||
|
bottom: -30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.file-overlay {
|
.file-overlay {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: em(20px);
|
font-size: em(20px);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user