mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
UnreadNotice: show even if are missing unread message
This commit is contained in:
parent
215b301be5
commit
7524dd268f
@ -131,8 +131,8 @@ class ChatWindow extends Component<
|
||||
dismissedInitialUnread() {
|
||||
const { unreadCount, graph } = this.props;
|
||||
|
||||
return this.state.unreadIndex.neq(bigInt.zero) &&
|
||||
this.state.unreadIndex.neq(graph.keys()?.[unreadCount]?.[0] ?? bigInt.zero);
|
||||
return this.state.unreadIndex.eq(bigInt.zero) ? unreadCount > graph.size :
|
||||
this.state.unreadIndex.neq(graph.keys()?.[unreadCount]?.[0] ?? bigInt.zero);
|
||||
}
|
||||
|
||||
handleWindowBlur() {
|
||||
|
@ -8,22 +8,11 @@ import Timestamp from '~/views/components/Timestamp';
|
||||
export const UnreadNotice = (props) => {
|
||||
const { unreadCount, unreadMsg, dismissUnread, onClick } = props;
|
||||
|
||||
if (!unreadMsg || unreadCount === 0) {
|
||||
if (unreadCount === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const stamp = moment.unix(unreadMsg.post['time-sent'] / 1000);
|
||||
|
||||
let datestamp = moment
|
||||
.unix(unreadMsg.post['time-sent'] / 1000)
|
||||
.format('YYYY.M.D');
|
||||
const timestamp = moment
|
||||
.unix(unreadMsg.post['time-sent'] / 1000)
|
||||
.format('HH:mm');
|
||||
|
||||
if (datestamp === moment().format('YYYY.M.D')) {
|
||||
datestamp = null;
|
||||
}
|
||||
const stamp = unreadMsg && moment.unix(unreadMsg.post['time-sent'] / 1000);
|
||||
|
||||
return (
|
||||
<Box
|
||||
@ -52,15 +41,20 @@ export const UnreadNotice = (props) => {
|
||||
whiteSpace='pre'
|
||||
overflow='hidden'
|
||||
display='flex'
|
||||
cursor='pointer'
|
||||
cursor={unreadMsg ? 'pointer' : null}
|
||||
onClick={onClick}
|
||||
>
|
||||
{unreadCount} new message{unreadCount > 1 ? 's' : ''} since{' '}
|
||||
<Timestamp stamp={stamp} color='black' date={true} fontSize={1} />
|
||||
{unreadCount} new message{unreadCount > 1 ? 's' : ''}
|
||||
{unreadMsg && (
|
||||
<>
|
||||
since{' '}
|
||||
<Timestamp stamp={stamp} color='black' date={true} fontSize={1} />
|
||||
</>
|
||||
)}
|
||||
</Text>
|
||||
<Icon
|
||||
icon='X'
|
||||
ml='4'
|
||||
ml={unreadMsg ? 4 : 1}
|
||||
color='black'
|
||||
cursor='pointer'
|
||||
textAlign='right'
|
||||
|
Loading…
Reference in New Issue
Block a user