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

SF-3028 Add final confirmation step when generating drafts #2787

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

josephmyers
Copy link
Collaborator

@josephmyers josephmyers commented Oct 9, 2024

image


This change is Reviewable

@Nateowami Nateowami changed the title SF-3028 Confirm step SF-3028 Add final confirmation step when generating drafts Oct 9, 2024
@Nateowami
Copy link
Collaborator

Here's a screenshot of about where we were at the end of the conversation, for reference.

@josephmyers
Copy link
Collaborator Author

Two things Bethany suggested that I think are worth capturing here:

  • Using ranges when training books have the exact same source/target
  • Collapsing the training card by default

@josephmyers
Copy link
Collaborator Author

Given how condensed the training card can be with the latest changes, I think we should postpone the expand/collapse card til we confirm we need it.

Base automatically changed from fix/SF-2997 to master October 14, 2024 17:41
@Nateowami
Copy link
Collaborator

Nateowami commented Oct 16, 2024

This is an improvement, but:

  • I think there should be 4 rows here, not one giant cell
  • List of books to translate is still not in the same style as the books to draft from. Preferably same font size, comma separated. That's what I recall discussing last time we met.
  • Book names should be localized using the I18nService
  • I also think the font weight of 100 is too light.

@josephmyers
Copy link
Collaborator Author

  • I think there should be 4 rows here, not one giant cell

I am surprised to hear you say this. This would be going back toward the more blatant table style Bethany criticized last week. Combining the identical rows provides much-needed spacing. This is what the table style looks like:
image

  • List of books to translate is still not in the same style as the books to draft from. Preferably same font size, comma separated. That's what I recall discussing last time we met.

I'm not understanding. Aren't the books to translate and the books to draft from the same thing?

  • Book names should be localized using the I18nService

Yes, thanks. I haven't done localization yet (see raw text in HTML), but I'll do this one now. Should I fix the other places in the component that are forcing English, too?

  • I also think the font weight of 100 is too light.

I disagree. The lighter weight breaks up the monotony of the text and allows us to focus on the book data without needing to increase its weight. This weight is particularly suited to explanatory text like this, which isn't intended to be the focus, while still being readable. Unless you think it's not readable? I'm open to other suggestions, but simply using the standard font weight looked bad.

I do notice that 100-300 are all the same. Maybe we could define a level in between what we have now and the standard?

@josephmyers
Copy link
Collaborator Author

Talked with Nathaniel. It appears that the font sizes between the top and bottom are slightly different. I'll look into this. And we do in fact want the bottom books comma separated on one line.

@josephmyers
Copy link
Collaborator Author

josephmyers commented Nov 5, 2024

At the recent UX meeting, we decided to combine the identical training book ranges to a single cell, comma separated, with word/span wrapping that doesn't separate the individual ranges.

Edit: with full book names

@Nateowami
Copy link
Collaborator

After meeting with Nigel, this is looking good. Several things:

  • Remove margin-bottom from .explanation
  • Localize everything, including book names
  • Instead of list.join(', '), add this method to the I18nService and use it instead (not all languages do commas the same as English):
  enumerateList(list: string[]): string {
    return new (Intl as any).ListFormat(this.localeCode, { style: 'long', type: 'conjunction' }).format(list) as string;
  }

I think we're both happy with it once these changes are included.

@josephmyers josephmyers force-pushed the feature/SF-3028 branch 2 times, most recently from ed18e85 to 91b2744 Compare November 20, 2024 22:08
<div class="confirm-books cell-padding-block">
@for (range of element.ranges; track range) {
@if (range !== element.ranges[element.ranges.length - 1]) {
<span class="confirm-book">{{ range }}, </span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be updated to use i18n.enumerateList

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. We do lose out on the word-wrapping control we had previously, however

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.93%. Comparing base (590ed05) to head (9dd723f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2787      +/-   ##
==========================================
+ Coverage   80.91%   80.93%   +0.02%     
==========================================
  Files         533      533              
  Lines       31224    31253      +29     
  Branches     5080     5068      -12     
==========================================
+ Hits        25266    25296      +30     
- Misses       5198     5207       +9     
+ Partials      760      750      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josephmyers josephmyers marked this pull request as ready for review December 2, 2024 04:54
@josephmyers
Copy link
Collaborator Author

@Nateowami, it sounds like you're owning the review on this? Or maybe @nigel-wells?

Copy link
Collaborator

@Nateowami Nateowami left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 5 files at r1, 1 of 4 files at r2.
Reviewable status: 2 of 6 files reviewed, 1 unresolved discussion (waiting on @josephmyers)


src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.html line 204 at r3 (raw file):

              <td mat-cell *matCellDef="let element" class="bookName">
                <div class="confirm-books cell-padding-block">
                  {{ this.i18n.enumerateList(element.ranges) }}

this. is not needed, here or below.

Copy link
Collaborator Author

@josephmyers josephmyers left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 6 files reviewed, all discussions resolved (waiting on @Nateowami)


src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.html line 204 at r3 (raw file):

Previously, Nateowami wrote…

this. is not needed, here or below.

Done

@nigel-wells
Copy link
Collaborator

Happy to take a look if needed - @Nateowami has assigned himself though so I've not taken a deep look other than what we spoke about yesterday.

Switched to a card design. The gray box was too much color, decreased contrast, and just didn't look great.

Inserted the titles from Step 1, with the source name added to the second.
Also displaying the display name of the language codes for the training table header (assuming it's retrievable).
And force synced the book font size
I think my previous iteration is more readable, but I'm content if others are fine with it.
This does mean we won't have as much control about word wrapping.
@josephmyers josephmyers marked this pull request as draft December 27, 2024 08:19
…the Summary.

I took the opportunity of adding the final step to consider the component at a high level. There were many, many mindless state variables added in over the various tasks each individual had worked on, given that a different person worked on each step. I consolidated all those into a few, smarter variables, using object-oriented design.

Notably, all information (including current state) about our translate and training books are wrapped up into two variables. Everything centers around interacting with them, and the other properties in the component are different reflections of these two models. The result is a cleaner and less bug-prone component.

Another major benefit of this refactor is that, from this component's perspective, 3+ sources would be quite simple to add in. Simply initialize the new projects into the dictionary-style model made for the training books, and everything else will work. Better yet, refactor the sources input to simply be a list. This model containts the data for both the sources and target, and in some cases the target entry needs to be skipped. You could easily add support for multiple training targets, as well.
This was necessary to be able to mock out the utility method. It will make unit testing much, much easier.
It also abstracts the alternate logic to itself, such that it only publishes the used/relevant sources. And the draft utility method is no longer needed.

This slightly changes the warning messages on the draft home page. There's less of a distinction between the normal and alternate source selections, for the warning messages. The source name, however, is still clearly listed, and that's the important part.
- Not adding a book to training targets if that book is absent from all sources. The user should be able to figure this out, but preventing the add will help them. The message for unusable source books is still present. If the book is only missing for the first training source but present for the second, the user will get the "unusable" message and have the book available for the target and second source.

- When selecting a translated book, find the first source containing the book and select that book. This is an improvement over my original design, which would only check the first source ever.

- Slightly better support for no training sources
This matches the original intent, as evidenced by the first unit test.

Also, fixed all the tests for this class.
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.

3 participants