Skip to content

Global Times #504

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

Merged
merged 2 commits into from
Feb 7, 2024
Merged

Global Times #504

merged 2 commits into from
Feb 7, 2024

Conversation

sirpengi
Copy link
Contributor

@sirpengi sirpengi commented Feb 5, 2024

Fixes: #354

Screenshot_20240205_162052

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sirpengi! Generally this looks good; just small comments below.

@@ -717,6 +738,23 @@ class _ZulipContentParser {
return ImageEmojiNode(src: src, alt: alt, debugHtmlNode: debugHtmlNode);
}

if (localName == 'time' && classes.isEmpty) {
final attr = element.attributes['datetime'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
final attr = element.attributes['datetime'];
final datetimeAttr = element.attributes['datetime'];

Comment on lines 747 to 752
final DateTime datetime;
try {
datetime = DateTime.parse(attr);
} on FormatException {
return unimplemented();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be cleaned up a bit using the tryParse method:

Suggested change
final DateTime datetime;
try {
datetime = DateTime.parse(attr);
} on FormatException {
return unimplemented();
}
final datetime = DateTime.tryParse(attr);
if (datetime == null) return unimplemented();

@@ -176,6 +176,32 @@ void main() {
'<span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">λ</span></span></span></span></p>',
const MathInlineNode(texSource: r'\lambda'));

group('global times', () {
testParseInline('smoke',
// "<time:2024-01-30T17:33:00Z">"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// "<time:2024-01-30T17:33:00Z">"
// "<time:2024-01-30T17:33:00Z>"

right?

@@ -687,6 +692,41 @@ class UserMention extends StatelessWidget {
// borderRadius: BorderRadius.all(Radius.circular(3))));
}

class GlobalTime extends StatelessWidget {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: put this after MessageImageEmoji, to match the if/else-if chain above (which matches the node-class definitions)

@@ -93,6 +93,18 @@ void main() {
tester.widget(find.text(r'\lambda'));
});

testWidgets('GlobalTime smoke', (tester) async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: put this after the MathInlineNode test below, to match the code under test in lib/widgets/content.dart

@sirpengi
Copy link
Contributor Author

sirpengi commented Feb 6, 2024

@gnprice ready for review again!

Sourced today from:
  https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=164%3A10509&mode=dev

Output was processed using inkscape to expand the strokes to
paths and clean up unnecessary clipping.

Also refer to discussion in CZO:
  https://chat.zulip.org/#narrow/stream/101-design/topic/clock.20icons/near/1728373
@gnprice gnprice merged commit e1bff3e into zulip:main Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle <time> elements ("global times")
2 participants