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

Add suggested time component with strings #8423

Conversation

nucleogenesis
Copy link
Member

@nucleogenesis nucleogenesis commented Sep 13, 2021

Summary

This is only to add strings and includes minimal functionality.

screenshot-localhost_8000-2021 09 13-14_09_17

Adding strings and component for "Suggested Time" frontend feature.

Does not do anything except provide three possible strings.

  1. A pluralized "N minutes" or "N minute" string (depending on if N is 1 or not).
  2. A tooltip message "Suggested time to complete" which is to be shown on hover pending feedback here from @jtamiace
  3. If the decision is to opt for showing the label up front, there is a pluralized "Suggested time to complete: N minutes" string as well in case we do not make the decision before string freeze.

References

Fixes #8111
#8395

Reviewer guidance

Are these going to work? Do we need different strings for this use case?

Do we need to have it go "X hours Y minutes"?


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@nucleogenesis nucleogenesis added TODO: needs review Waiting for review TAG: user strings Application text that gets translated labels Sep 13, 2021
context:
'A tooltip explaning what the clock icon and time indicates about the resource they are viewing',
},
shortTime: {
Copy link
Member

Choose a reason for hiding this comment

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

@nucleogenesis Is there a way to reuse the existing minute/minutes string from the TimeDuration component?

If I'm understanding correctly, you could even combine the suggestedTimeTooltip message with the existing minutes from TimeDuration component to achieve the purpose of sugestedTimeLabel, and effectively need to stub just one string here 😉

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

I think using the TimeDuration component is the most stringly economical way of doing this - I wonder if we could just avoid the 'full' label that has the prefix and the TimeDuration text in it?

'A tooltip explaning what the clock icon and time indicates about the resource they are viewing',
},
shortTime: {
message: '{time} {time, plural, one {minute} other {minutes}}',
Copy link
Member

Choose a reason for hiding this comment

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

These do need to be translated - you're not using any time related syntax here, this is just a simple plural message.

If we use this string and it is not translated, we will end up with minutes being displayed to end users.

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed that and figured that when I come back to it (post strings-getting-in rush) then I'll conditionalize showing any strings at all on whether or not we have > 0 passed in

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah - I already had it conditionalized.

@radinamatic - I think that TimeDuration will work the best but it isn't accurate - it rounds down so 2hrs 45min would show "2 hours". If @jtamiace and @rtibbles are okay with the way it rounds, then this component can be the "Suggested time to complete:" followed by the TimeDuration component.

Copy link
Member

Choose a reason for hiding this comment

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

Understood, thank you @nucleogenesis!
That type of time rounding does not seem like a big concern to me, but will defer to @jtamiace & @rtibbles.

Copy link
Member

Choose a reason for hiding this comment

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

I think if it's an issue we can probably further conditionalize TimeDuration to round up rather than down?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems okay for now since it still gives a ballpark about expected length, but I'd hope accuracy is something we can improve in the future.

Any issue I can foresee is around planning and scheduling around learning with limited time and the resource taking longer than they expected, but I can't imagine that causing too many issues because it's just an estimate and people will engage resources at their own discernment.

Copy link
Member

Choose a reason for hiding this comment

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

further conditionalize TimeDuration to round up rather than down

And I totally misread that, and thought that 1:45h was rounded to 2h... 🤦🏽‍♀️
Yes, rounding up would be more accurate in this case!

Copy link
Member

Choose a reason for hiding this comment

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

I'd hope accuracy is something we can improve in the future.

We can also conditionalize the TimeDuration component's threshold for when it starts displaying 'hours', so we could make it display whole minutes for up to 120 minutes, and only then start displaying hours. Once we get past 120 minutes, hopefully any time durations are very ballpark anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just pushed it up with only the "Suggested time to complete" string.

In follow up I can use TimeDuration to get things looking how we want - but at this point this should be a go for strings I think. Anybody feel free to force push anything you need to get this merged!

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the update - and apologies for brigading your tiny PR!

@rtibbles rtibbles merged commit a75b27f into learningequality:develop Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TAG: user strings Application text that gets translated TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants