-
Notifications
You must be signed in to change notification settings - Fork 306
msglist: Implement new edited/moved label design. #900
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
Conversation
Wasn't able to reopen #765 after accidentally closing it: Here's the new PR for the new design. |
1bc2f50
to
fe45371
Compare
85e0fb9
to
3ce5a96
Compare
3ce5a96
to
0fcc79a
Compare
Rebased and simplified the implementation a bit. |
FWIW for next time: I think the solution there is to push the commits you want back to the PR's branch, and then re-open the PR. (In particular the error message there says "There are no new commits on the … branch", i.e. the branch is empty compared to main. You can fix that by pushing to fix what's in the branch.) |
Though in this case, since the implementation is radically different from #765, a fresh PR is probably cleanest anyway. |
I do recall running into the same issue a few years back. Couldn't find the link right now. My attempted fix this time was amending the latest commit, and adding an empty commit on top of it. It's interesting that it didn't work. Will look into this next time (without mistakenly pushing to upstream!) |
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.
Thanks! Small comments below.
lib/widgets/message_list.dart
Outdated
@@ -86,7 +84,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> { | |||
required this.dateSeparator, | |||
required this.dateSeparatorText, | |||
required this.dmRecipientHeaderBg, | |||
required this.editedMovedMarkerCollapsed, | |||
required this.editStateLabel, |
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.
It looks like there's a Figma design variable for this, labelEdited
, so let's use that and put it in DesignVariables
, sorted alphabetically in the default section (not marked // Not exactly from the Figma design […]
or // Not named variables in Figma […]
).
lib/widgets/message_list.dart
Outdated
if ((message.reactions?.total ?? 0) > 0) | ||
ReactionChipsList(messageId: message.id, reactions: message.reactions!) | ||
ReactionChipsList(messageId: message.id, reactions: message.reactions!), | ||
if (editStateText != null) | ||
Text(editStateText, textAlign: TextAlign.end, | ||
style: TextStyle( | ||
color: messageListTheme.editStateLabel, | ||
fontFamily: 'Source Sans 3', | ||
fontSize: 12, | ||
height: (12 / 12))), |
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.
I guess the Figma isn't clear whether the reaction chips or the marker should come first, vertically. How about putting the marker first? In the case where there are dozens of reaction chips that wrap onto many lines, I think it would be neater and clearer if the EDITED or MOVED marker were above them instead of below them.
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.
Yeah that sounds good to me.
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.
Just to be sure, started a disccusion on CZO.
lib/widgets/message_list.dart
Outdated
Text(editStateText, textAlign: TextAlign.end, | ||
style: TextStyle( | ||
color: messageListTheme.editStateLabel, | ||
fontFamily: 'Source Sans 3', |
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.
I think we'll get 'Source Sans 3' automatically here, like in most other places, because this is rendered on a Material
(via Scaffold
, I think), and Material
applies TextTheme.bodyMedium
to its children via AnimatedDefaultTextStyle
, and we've set TextTheme.bodyMedium
to include 'Source Sans 3' (see zulipTypography
in lib/widgets/text.dart).
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.
Looks like we're also redundantly passing 'Source Sans 3' where we render the sender name in MessageWithPossibleSender
. Removing that (perhaps with a link to my explanation here, or quoting/paraphrasing it) would be a helpful cleanup in a separate NFC commit.
lib/widgets/message_list.dart
Outdated
color: messageListTheme.editStateLabel, | ||
fontFamily: 'Source Sans 3', | ||
fontSize: 12, | ||
height: (12 / 12))), |
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.
height: (12 / 12))), | |
height: (12 / 12), | |
letterSpacing: proportionalLetterSpacing(context, 0.05, baseFontSize: 12), |
I notice the Figma has 0.6px letter spacing, but if we use proportionalLetterSpacing
, it'll grow and shrink with the system font-size setting, and that seems like a nice refinement.
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.
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.
Oh interesting, so yeah, it looks like the 5% is expressed in the Figma too :) thanks for noticing that.
assets/l10n/app_en.arb
Outdated
}, | ||
"messageIsEditedLabel": "EDITED", | ||
"@messageIsEditedLabel": { | ||
"description": "Label for an edited message." |
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.
"description": "Label for an edited message." | |
"description": "Label for an edited message. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)" |
(similarly below)
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.
One thing I was wondering about when implementing this, is that whether we should programmatically upper case the letters and translate the label normally, or just do it the current way.
We do have a precedent: "loginMethodDivider": "OR". But I can also see the appeal to using i18n.toUpperCase
for something purely for styling purposes (similar to the text-transform: uppercase;
approach as one could do in web), because in this case we aren't using uppercase letters to convey emphasis/exaggeration in the writing.
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.
Started a discussion here. My guess is that it might be preferred to just use uppercase letters, but I'm curious if there are better ways.
We supplied the font 'Source Sans 3' to `TextTheme.bodyMedium` in `lib/widgets/text.dart`. When rendered, `Material` applies this font via `AnimatedDefaultTextStyle` by default, so there is no need to override `fontFamily` explicitly. See: zulip#900 (comment) Signed-off-by: Zixuan James Li <[email protected]>
f976938
to
9a0f7da
Compare
9a0f7da
to
b292724
Compare
Implemented the suggested changes. Thanks for the review @chrisbobbe! Started some CZO discussions on things that I have questions about. |
Thanks! This LGTM except the CZO discussion seems like it's settling on having the marker come after the reactions list instead of before. Marking for Greg's review once he's back from vacation. |
b292724
to
bcac0a2
Compare
Pushed to move the marker after the reactions list. |
bcac0a2
to
f7ab0ba
Compare
b560fc0
to
1f5ea3d
Compare
Updated the PR to share the final row between reaction chips and the edit state label mentioned here. If necessary, we could add an RTL test case later for the new commit if we like this approach. |
We supplied the font 'Source Sans 3' to `TextTheme.bodyMedium` in `lib/widgets/text.dart`. When rendered, `Material` applies this font via `AnimatedDefaultTextStyle` by default, so there is no need to override `fontFamily` explicitly. See: zulip#900 (comment) Signed-off-by: Zixuan James Li <[email protected]>
1f5ea3d
to
45f91aa
Compare
We supplied the font 'Source Sans 3' to `TextTheme.bodyMedium` in `lib/widgets/text.dart`. When rendered, `Material` applies this font via `AnimatedDefaultTextStyle` by default, so there is no need to override `fontFamily` explicitly. See: zulip#900 (comment) Signed-off-by: Zixuan James Li <[email protected]>
9c52563
to
783b5a2
Compare
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.
Thanks @PIG208, and thanks @chrisbobbe for the previous reviews!
Let's skip for now the complexity of trying to squash the edited/moved marker onto the same line as the end of the message. I think this version doesn't yet quite work — see below — and I'm also a little concerned about making the layout complicated, if for example the user is reading a long thread that got moved and so all the messages have markers. If people really find the extra vertical space annoying, we can revisit that.
Otherwise this all looks good, with just one nit below.
lib/widgets/message_list.dart
Outdated
trailingPlaceholder: editStateLabel), | ||
]), | ||
if (editStateLabel != null) | ||
PositionedDirectional(bottom: 0, end: 0, child: editStateLabel), |
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.
What happens if there are no reactions, but the message's own text ends with a full line? I think in this version that will end up having an overlap of the "EDITED" marker and the message text.
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.
Hmm, yeah, that could totally happen. It does look like that furthering this implementation to fix that as well can make it more complicated, unless we get a different solution.
lib/widgets/message_list.dart
Outdated
final editStateLabel = editStateText == null ? null : Text(editStateText, | ||
textAlign: TextAlign.end, |
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:
final editStateLabel = editStateText == null ? null : Text(editStateText, | |
textAlign: TextAlign.end, | |
final editStateLabel = editStateText == null ? null | |
: Text(editStateText, | |
textAlign: TextAlign.end, |
That way the Text
constructor name, and editStateText
which holds the actual text content, stay more visible and next to the other arguments to Text
.
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.
Starting textAlign
in a new line for the now inlined editStateLabel
because we don't need to render another copy now.
783b5a2
to
cb72ff1
Compare
Dropped the commit 783b5a2, and pushed an update. Thanks! |
We supplied the font 'Source Sans 3' to `TextTheme.bodyMedium` in `lib/widgets/text.dart`. When rendered, `Material` applies this font via `AnimatedDefaultTextStyle` by default, so there is no need to override `fontFamily` explicitly. See: zulip#900 (comment) Signed-off-by: Zixuan James Li <[email protected]>
This replaces the gutter edit state marker design. Since it leads to message displacement, the test "edit state updates do not affect layout" is no longer applicable. We also inline part of what was previously in edit_state_marker.dart, because the new design simplifies the implementation, and remove the now unused icons. The design variables are taken from the Figma design: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3038-56393&t=WMT80mwuFaruNbVf-1 Signed-off-by: Zixuan James Li <[email protected]>
cb72ff1
to
6ca5524
Compare
Thanks! Looks good; merging. |
This replaces the gutter edit state marker design. Since it leads to message displacement, a previous test case is no longer applicable.
We also inline part of what was previously in edit_state_marker.dart, because the new design simplifies the implementation.
Figma design: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3038-56393&t=WMT80mwuFaruNbVf-1
Fixes: #171