mirror of
https://github.com/urbit/shrub.git
synced 2024-11-29 06:45:42 +03:00
chat: fixes unread marker on blur
This commit is contained in:
parent
75f78c20f2
commit
9c577e53f3
@ -100,6 +100,9 @@ export default class ChatWindow extends Component<ChatWindowProps, ChatWindowSta
|
|||||||
|
|
||||||
handleWindowFocus() {
|
handleWindowFocus() {
|
||||||
this.setState({ idle: false });
|
this.setState({ idle: false });
|
||||||
|
if (this.virtualList?.window?.scrollTop === 0) {
|
||||||
|
this.dismissUnread();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initialFetch() {
|
initialFetch() {
|
||||||
@ -121,7 +124,7 @@ export default class ChatWindow extends Component<ChatWindowProps, ChatWindowSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: ChatWindowProps, prevState) {
|
componentDidUpdate(prevProps: ChatWindowProps, prevState) {
|
||||||
const { isChatMissing, history, envelopes, mailboxSize, stationPendingMessages } = this.props;
|
const { isChatMissing, history, envelopes, mailboxSize, stationPendingMessages, unreadCount } = this.props;
|
||||||
|
|
||||||
if (isChatMissing) {
|
if (isChatMissing) {
|
||||||
history.push("/~chat");
|
history.push("/~chat");
|
||||||
@ -134,6 +137,12 @@ export default class ChatWindow extends Component<ChatWindowProps, ChatWindowSta
|
|||||||
this.stayLockedIfActive();
|
this.stayLockedIfActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unreadCount > prevProps.unreadCount && this.state.idle) {
|
||||||
|
this.setState({
|
||||||
|
lastRead: unreadCount ? mailboxSize - unreadCount : Infinity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (stationPendingMessages.length !== prevProps.stationPendingMessages.length) {
|
if (stationPendingMessages.length !== prevProps.stationPendingMessages.length) {
|
||||||
this.virtualList?.calculateVisibleItems();
|
this.virtualList?.calculateVisibleItems();
|
||||||
this.virtualList?.scrollToData(mailboxSize);
|
this.virtualList?.scrollToData(mailboxSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user