Show "99+" in left pane unread count, instead of high values

This commit is contained in:
Evan Hahn 2021-10-05 18:46:51 -05:00 committed by GitHub
parent bd380086a4
commit 994f9644c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,7 +138,7 @@ export const BaseConversationListItem: FunctionComponent<PropsType> = React.memo
/> />
{isUnread && ( {isUnread && (
<div className={`${BASE_CLASS_NAME}__unread-count`}> <div className={`${BASE_CLASS_NAME}__unread-count`}>
{unreadCount || ''} {formatUnreadCount(unreadCount)}
</div> </div>
)} )}
</div> </div>
@ -233,3 +233,13 @@ export const BaseConversationListItem: FunctionComponent<PropsType> = React.memo
); );
} }
); );
function formatUnreadCount(count: undefined | number): string {
if (!count) {
return '';
}
if (count >= 99) {
return '99+';
}
return String(count);
}