chore: Follow up power level UX
This commit is contained in:
parent
47934a3378
commit
fd70c292e9
3 changed files with 9 additions and 4 deletions
|
|
@ -3133,5 +3133,6 @@
|
|||
"removeModeratorRights": "Remove moderator rights",
|
||||
"removeAdminRights": "Remove admin rights",
|
||||
"powerLevel": "Power level",
|
||||
"setPowerLevelDescription": "Power levels define what a member is allowed to do in this room and usually range between 0 and 100."
|
||||
"setPowerLevelDescription": "Power levels define what a member is allowed to do in this room and usually range between 0 and 100.",
|
||||
"owner": "Owner"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ class ParticipantListItem extends StatelessWidget {
|
|||
Membership.leave => L10n.of(context).leftTheChat,
|
||||
};
|
||||
|
||||
final permissionBatch = user.powerLevel >= 100
|
||||
final permissionBatch = user.room.creatorUserIds.contains(user.id)
|
||||
? L10n.of(context).owner
|
||||
: user.powerLevel >= 100
|
||||
? L10n.of(context).admin
|
||||
: user.powerLevel >= 50
|
||||
? L10n.of(context).moderator
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ Future<void> showMemberActionsPopupMenu({
|
|||
Offset.zero & overlay.size,
|
||||
);
|
||||
|
||||
const defaultPowerLevels = {0, 50, 100, 9007199254740991};
|
||||
|
||||
final action = await showMenu<_MemberActions>(
|
||||
context: context,
|
||||
position: position,
|
||||
|
|
@ -124,7 +126,7 @@ Future<void> showMemberActionsPopupMenu({
|
|||
),
|
||||
],
|
||||
if (user.canChangeUserPowerLevel ||
|
||||
!{0, 50, 100}.contains(user.powerLevel))
|
||||
!defaultPowerLevels.contains(user.powerLevel))
|
||||
PopupMenuItem(
|
||||
value: _MemberActions.setPowerLevel,
|
||||
enabled: user.canChangeUserPowerLevel,
|
||||
|
|
@ -137,7 +139,7 @@ Future<void> showMemberActionsPopupMenu({
|
|||
? L10n.of(context).setPowerLevel
|
||||
: L10n.of(context).powerLevel,
|
||||
),
|
||||
if (!{0, 50, 100}.contains(user.powerLevel))
|
||||
if (!defaultPowerLevels.contains(user.powerLevel))
|
||||
Text(' (${user.powerLevel})'),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue