-
Notifications
You must be signed in to change notification settings - Fork 318
Show user status in UI #1702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Show user status in UI #1702
Changes from all commits
463b938
14093b2
646f9d9
846261a
e9f682e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,7 +314,11 @@ class _MentionAutocompleteItem extends StatelessWidget { | |
mainAxisSize: MainAxisSize.min, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
labelWidget, | ||
Row(children: [ | ||
Flexible(child: labelWidget), | ||
if (option case UserMentionAutocompleteResult(:var userId)) | ||
UserStatusEmoji(userId: userId, size: 18, | ||
padding: const EdgeInsetsDirectional.only(start: 5.0))]), | ||
if (sublabelWidget != null) sublabelWidget, | ||
])), | ||
Comment on lines
316
to
323
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this new logic is best included as part of Probably in fact the cleanest home for this is in the |
||
])); | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -317,6 +317,8 @@ class _SelectedUserChip extends StatelessWidget { | |||||||||||||||||||||
fontSize: 16, | ||||||||||||||||||||||
height: 16 / 16, | ||||||||||||||||||||||
color: designVariables.labelMenuButton)))), | ||||||||||||||||||||||
UserStatusEmoji(userId: userId, size: 16, | ||||||||||||||||||||||
padding: EdgeInsetsDirectional.only(end: 4)), | ||||||||||||||||||||||
]))); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
@@ -415,7 +417,12 @@ class _NewDmUserListItem extends StatelessWidget { | |||||||||||||||||||||
Avatar(userId: userId, size: 32, borderRadius: 3), | ||||||||||||||||||||||
SizedBox(width: 8), | ||||||||||||||||||||||
Expanded( | ||||||||||||||||||||||
child: Text(store.userDisplayName(userId), | ||||||||||||||||||||||
child: Text.rich( | ||||||||||||||||||||||
TextSpan( | ||||||||||||||||||||||
children: [ | ||||||||||||||||||||||
TextSpan(text: store.userDisplayName(userId)), | ||||||||||||||||||||||
UserStatusEmoji.asWidgetSpan(userId: userId, fontSize: 17, | ||||||||||||||||||||||
textScaler: MediaQuery.textScalerOf(context))]), | ||||||||||||||||||||||
Comment on lines
+421
to
+425
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: for list elements, give the last one a trailing comma and newline like the others, because it's not a distinguished "child" or "payload" argument; OTOH can compact this by putting the "children" argument on the first line:
Suggested change
|
||||||||||||||||||||||
style: TextStyle( | ||||||||||||||||||||||
fontSize: 17, | ||||||||||||||||||||||
height: 19 / 17, | ||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import 'page.dart'; | |
import 'remote_settings.dart'; | ||
import 'store.dart'; | ||
import 'text.dart'; | ||
import 'theme.dart'; | ||
|
||
class _TextStyles { | ||
static const primaryFieldText = TextStyle(fontSize: 20); | ||
|
@@ -47,6 +48,7 @@ class ProfilePage extends StatelessWidget { | |
if (user == null) { | ||
return const _ProfileErrorPage(); | ||
} | ||
final userStatus = store.getUserStatus(userId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: put this next to |
||
|
||
final nameStyle = _TextStyles.primaryFieldText | ||
.merge(weightVariableTextStyle(context, wght: 700)); | ||
|
@@ -73,17 +75,28 @@ class ProfilePage extends StatelessWidget { | |
), | ||
// TODO write a test where the user is muted; check this and avatar | ||
TextSpan(text: store.userDisplayName(userId, replaceIfMuted: false)), | ||
UserStatusEmoji.asWidgetSpan( | ||
userId: userId, | ||
fontSize: 20, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this says |
||
textScaler: MediaQuery.textScalerOf(context), | ||
neverAnimate: false, | ||
), | ||
]), | ||
textAlign: TextAlign.center, | ||
style: nameStyle), | ||
if (userStatus.text != null) | ||
Text(userStatus.text!, | ||
textAlign: TextAlign.center, | ||
style: TextStyle(fontSize: 18, height: 22 / 18, | ||
color: DesignVariables.of(context).userStatusText)), | ||
|
||
if (displayEmail != null) | ||
Comment on lines
+91
to
93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this blank line intended? The items just above here feel to me closely related to the items just below, and in particular just as closely related as other items that are grouped next to each other. |
||
Text(displayEmail, | ||
textAlign: TextAlign.center, | ||
style: _TextStyles.primaryFieldText), | ||
Text(roleToLabel(user.role, zulipLocalizations), | ||
textAlign: TextAlign.center, | ||
style: _TextStyles.primaryFieldText), | ||
// TODO(#197) render user status | ||
// TODO(#196) render active status | ||
// TODO(#292) render user local time | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,16 +148,31 @@ class RecentDmConversationsItem extends StatelessWidget { | |
const SizedBox(width: 8), | ||
Expanded(child: Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 4), | ||
child: Text( | ||
child: Text.rich( | ||
TextSpan( | ||
children: [ | ||
TextSpan(text: title), | ||
...(switch (narrow.otherRecipientIds) { | ||
// self-DM | ||
[] => [UserStatusEmoji.asWidgetSpan(userId: store.selfUserId, | ||
fontSize: 17, textScaler: MediaQuery.textScalerOf(context))], | ||
// 1:1-DM | ||
[final otherUserId] => | ||
Comment on lines
+152
to
+160
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's pull all this out of the return-expression and into a local variable, to reduce the amount of logic that's in the one expression. In fact, looking at where |
||
[UserStatusEmoji.asWidgetSpan(userId: otherUserId, | ||
fontSize: 17, textScaler: MediaQuery.textScalerOf(context))], | ||
// group-DM - show nothing | ||
[...] => [], | ||
}), | ||
] | ||
), | ||
style: TextStyle( | ||
fontSize: 17, | ||
height: (20 / 17), | ||
// TODO(design) check if this is the right variable | ||
color: designVariables.labelMenuButton, | ||
), | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
title))), | ||
overflow: TextOverflow.ellipsis))), | ||
const SizedBox(width: 12), | ||
unreadCount > 0 | ||
? Padding(padding: const EdgeInsetsDirectional.only(end: 16), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: similarly: