add diffing for a lot of events

This commit is contained in:
Henry Hiles 2026-10-23 12:01:38 -04:00
commit 6e2d56ec75
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 591 additions and 168 deletions

View file

@ -20,6 +20,15 @@ extension DisplaynameColor on WidgetRef {
),
};
/// Like [displaynameColor], for when [userId]'s [level] is already known,
/// like a level they're being given.
Color displaynameColorAt(String userId, double level) => switch (watch(
SettingsController.provider.select((settings) => settings.value?.nameColor),
)) {
.user => userId.colorHash,
.powerLevel || null => powerLevelColor(level),
};
static Color powerLevelColor(double level) => HSLColor.fromAHSL(
1,
level.isInfinite ? 30 : (210 + level / 50 * 137.50776) % 360,

View file

@ -0,0 +1,13 @@
import "package:nexus/models/join_rule.dart";
extension JoinRuleName on JoinRule {
/// What the rule is called in the UI, e.g. "Invite only".
String get displayName => switch (this) {
.public => "Public",
.invite => "Invite only",
.knock => "Knock",
.restricted => "Restricted",
.knockRestricted => "Restricted or knock",
.private => "Private",
};
}