-
Notifications
You must be signed in to change notification settings - Fork 309
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
Global Times #504
Conversation
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 @sirpengi! Generally this looks good; just small comments below.
lib/model/content.dart
Outdated
@@ -717,6 +738,23 @@ class _ZulipContentParser { | |||
return ImageEmojiNode(src: src, alt: alt, debugHtmlNode: debugHtmlNode); | |||
} | |||
|
|||
if (localName == 'time' && classes.isEmpty) { | |||
final attr = element.attributes['datetime']; |
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 attr = element.attributes['datetime']; | |
final datetimeAttr = element.attributes['datetime']; |
lib/model/content.dart
Outdated
final DateTime datetime; | ||
try { | ||
datetime = DateTime.parse(attr); | ||
} on FormatException { | ||
return unimplemented(); | ||
} |
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.
This can be cleaned up a bit using the tryParse
method:
final DateTime datetime; | |
try { | |
datetime = DateTime.parse(attr); | |
} on FormatException { | |
return unimplemented(); | |
} | |
final datetime = DateTime.tryParse(attr); | |
if (datetime == null) return unimplemented(); |
test/model/content_test.dart
Outdated
@@ -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">" |
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.
// "<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 { |
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: put this after MessageImageEmoji, to match the if/else-if chain above (which matches the node-class definitions)
test/widgets/content_test.dart
Outdated
@@ -93,6 +93,18 @@ void main() { | |||
tester.widget(find.text(r'\lambda')); | |||
}); | |||
|
|||
testWidgets('GlobalTime smoke', (tester) async { |
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: put this after the MathInlineNode test below, to match the code under test in lib/widgets/content.dart
b3933e8
to
a952098
Compare
@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
a952098
to
e1bff3e
Compare
Fixes: #354