web/roomlist: fix unread count positioning

This commit is contained in:
Tulir Asokan 2024-12-30 22:27:13 +02:00
parent 572ef41b80
commit d82f5404ec
2 changed files with 7 additions and 2 deletions

View file

@ -55,11 +55,15 @@ div.space-bar {
> div.room-entry-unreads { > div.room-entry-unreads {
z-index: 2; z-index: 2;
height: 0; height: 0;
width: 0;
margin-left: auto;
position: relative; position: relative;
> div.unread-count { > div.unread-count {
position: absolute; position: absolute;
top: 0; /* This positioning doesn't feel very precise, but it looks correct enough */
margin-top: .75rem;
margin-right: .25rem;
} }
} }
} }

View file

@ -34,7 +34,8 @@ const UnreadCount = ({ counts, space }: UnreadCountProps) => {
if (!unreadCount && !counts.marked_unread) { if (!unreadCount && !counts.marked_unread) {
return null return null
} }
const countIsBig = !space && Boolean(counts.unread_notifications || counts.unread_highlights || counts.marked_unread) const countIsBig = !space
&& Boolean(counts.unread_notifications || counts.unread_highlights || counts.marked_unread)
let unreadCountDisplay = unreadCount.toString() let unreadCountDisplay = unreadCount.toString()
if (unreadCount > 999 && countIsBig) { if (unreadCount > 999 && countIsBig) {
unreadCountDisplay = "99+" unreadCountDisplay = "99+"