Skip to content
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

Corrected tooltip hover information #3270

Merged
merged 13 commits into from
Jul 3, 2024

Conversation

harmitgoswami
Copy link
Collaborator

Fix #2763

Made changes to previous pull request to correctly display the last day an action was taken upon a translation. Additionally, removed the Weekday within the information displayed in the tooltip. See #3263 for more context.

Updated Tooltip:

Screenshot 2024-07-02 at 1 06 28 PM
pontoon/base/views.py Outdated Show resolved Hide resolved
pontoon/base/views.py Outdated Show resolved Hide resolved
@@ -369,13 +369,13 @@ history-Translation--span-copied =
.title = Copied ({ $machinerySources })

history-translation--approved =
.title = Approved by { $user } on { DATETIME($reviewedDate, dateStyle:"long", timeStyle:"medium") }
.title = Approved by { $user } on { DATETIME($reviewedDate, month: "long", year: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric") }
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change allows me to print the date without the Weekday as well. Is there a more succinct way of doing this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This format looks OK. It's the tooltip shown when you hover the translation creation date that is showing the weekday:
#2763 (comment)

@@ -196,17 +196,23 @@ export function HistoryTranslationBase({

const review = {
id: 'history-translation--unreviewed',
vars: { user: '', reviewedDate: new Date(translation.dateIso) },
vars: { user: '', reviewedDate: new Date() },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we completely drop reviewedDate here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Potentially... is there a way for me to pass approvedDate or rejectedDate to the .ftl file if we do remove this variable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I missed that this was part of an FTL message.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use '' instead of new Date()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I seem to get a type error if I try to switch to ''. Should I still try to move forward with using '' instead of new Date()?

Screenshot 2024-07-03 at 1 53 47 PM
Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense. Let's keep new Date().

Comment on lines 418 to 419
"date": t.date.strftime("%b %d, %Y %H:%M"),
"date_iso": t.date.isoformat(),
Copy link
Collaborator

@mathjazz mathjazz Jul 3, 2024

Choose a reason for hiding this comment

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

We no longer use translation.date on frontend, so we can drop it. We can also drop .isoformat().

At that point we should rename date_iso to date (also on the frontend).

Suggested change
"date": t.date.strftime("%b %d, %Y %H:%M"),
"date_iso": t.date.isoformat(),
"date": t.date,
Comment on lines 238 to 243
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
Copy link
Collaborator

Choose a reason for hiding this comment

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

To be consistent with the format used for the review timestamp and more concise, let's use this:

Suggested change
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
dateStyle: 'long',
timeStyle: 'medium',
Copy link
Collaborator

@mathjazz mathjazz left a comment

Choose a reason for hiding this comment

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

Nice work! Only one comment left.

date={new Date(translation.dateIso)}
title={`${translation.date} UTC`}
date={new Date(translation.date)}
title=''
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like we can remove the title attribute?

@mathjazz mathjazz merged commit 86041d9 into mozilla:main Jul 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants