This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Add/improve badge counts in new room list #4734
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #4732
Based on #4711MergedSee pull/4732/head...pull/4734/head for the real diff
For element-hq/element-web#13635
This introduces a new component, NotificationBadge, which takes care of all the counting we don't need to do in different places. The same component file has some helper classes to monitor different states of notification to update the notification badge.
The notification badge simply expects to receive a notification state that updates itself. The caller (in our case, the room tile or sublist) doesn't need to worry about much else - just making sure the notification state has the information it needs. In the case of the room tile, it instantiates it and forgets about it. The sublist instantiates the state and then whenever it updates it dumps the list of rooms into the state for processing.
The styles are a bit weird for the reasons described in the CSS. This also sneaks in an IDLE state for rooms in the room list (rooms without badges aka fully read).