Skip to content

LG-14641 | Update "letter on the way" screen#11346

Merged
n1zyy merged 11 commits intomainfrom
mattw/LG-14651_letter_on_the_way
Oct 25, 2024
Merged

LG-14641 | Update "letter on the way" screen#11346
n1zyy merged 11 commits intomainfrom
mattw/LG-14651_letter_on_the_way

Conversation

@n1zyy
Copy link
Contributor

@n1zyy n1zyy commented Oct 15, 2024

🎫 Ticket

Link to the relevant ticket:
LG-14641

🛠 Summary of changes

UI improvements, including translations.

changelog: User-Facing Improvements, GPO flow, UI tweaks
@n1zyy n1zyy requested a review from a team October 15, 2024 18:02
redirect_to_and_log(MarketingSite.base_url)
end
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Part of the story here was that we want to redirect to straight "www.login.gov" if the user clicks "Exit Login.gov", and log an event. The most pragmatic way of doing this I saw was to just add a new controller, rather than weirdly cramming it into the HelpCenterController.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense!

t('idv.buttons.continue_plain')
end
t('idv.cancel.actions.exit', app_name: APP_NAME)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Context: We settled on the button always having the same text, but keeping the destination dynamic.)

return_to_sp_cancel_path(step: :verify_address, location: :come_back_later)
else
account_path
marketing_site_redirect_url
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Taking the user to their account page when they clicked "Exit Login.gov" was very random.

(Arguably, so is taking them to the static site homepage, but it's less-inexplicable.)

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW we have a big epic on the roadmap that is all about removing these if sp then x else y type constructions--in reality, every IdV attempt should be associated with an SP.

<p class="margin-top-2">
<%= t('idv.messages.come_back_later_no_sp_html') %>
</p>
<% end %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And, context here: if there is no SP, we don't want to show the second bullet point telling them to contact nil, so we omit it. But a one-item bulleted list is silly, so we go for a paragraph tag instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good catch! I will update #11351 to do the same.

@presenter.button_text,
@presenter.button_destination,
class: 'usa-button usa-button--big usa-button--wide',
class: 'usa-button usa-button--big usa-button--wide margin-top-2',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not a designer, but the button was otherwise awkwardly close to the text.

<p class="padding-top-3 padding-bottom-3">
<%= t('idv.messages.come_back_later_html') %>
</p>
<% if @presenter.has_sp? %>
Copy link
Contributor

Choose a reason for hiding this comment

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

I was working on a companion to this story with @lmgeorge. We came up with a @presenter.show_contact_sp_instructions? method which made things a little more self-documenting.

We also did not add a list to the YAML file. We had a descriptor for each one.

When we see that PR up we should work on squaring those up since they are essentially the same thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

PR in question: #11351, and more specifically in the ERB template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've matched this naming.

I had initially assumed these were using the same presenter, but they are not. I think I'm OK duplicating the pattern / 1-liner method rather than trying to extract stuff like this:

  def sp_name
    sp&.friendly_name
  end

idv.messages.come_back_later_html: 'Letters take <strong>5 to 10 days</strong> to arrive. Sign back in to enter your verification code once you get your letter.'
idv.messages.come_back_later: Sign back in and enter the verification code when your letter arrives.
idv.messages.confirm: We secured your verified information
idv.messages.contact_sp_html: Contact&nbsp;%{sp_link} if you need to access their services before your letter arrives.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, so: the i18n linter yells at me because contact_sp_html is an _html string but doesn't contain any HTML. %{sp_link} is a hyperlink we interpolate. Taking the _html out causes raw HTML to be displayed.

I have put an otherwise-needless &nbsp; here to make things happy, but this is obviously a very gross approach. I am out tomorrow (Wednesday) if anyone wants to apply an obvious correction; otherwise, I'll pick this up Thursday morning.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can suffix the interpolated key as %{sp_link_html} for it to understand the HTML is in the interpolated value.

def contains_html?(value)
Array(value).flatten.compact.any? do |str|
html_tags?(str) || html_entities?(str) || likely_html_interpolation?(str)
end
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah-ha! Thanks for this pointer.

Since it still took me a little bit of trial-and-error, a pointer for the next person:

  • The translation key should still keep the _html suffix
  • Including an interpolation ending in _html causes the linter to not object to the translation not directly including HTML


RSpec.describe 'idv/by_mail/letter_enqueued/show.html.erb' do
let(:service_provider) { '🔒🌐💻' }
let(:service_provider) { create(:service_provider) }
Copy link
Contributor Author

@n1zyy n1zyy Oct 15, 2024

Choose a reason for hiding this comment

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

AFAICT we were always expecting an instance of a ServiceProvider in the presenter, not a (emoji-filled) string, so I'm not sure how this ever passed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that's not ideal. It looks like this service_provider gets passed into the Idv::Session constructor which then gets read by the presenter in a basic if sp type thing. So any truthy value would pass here

@@ -53,8 +53,8 @@

it 'renders a return to account button' do
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe update this it here since it's no longer a "return to account" button

@n1zyy n1zyy changed the title LG-14651 | Update "letter on the way" screen LG-14641 | Update "letter on the way" screen Oct 23, 2024
@n1zyy n1zyy merged commit 0e2e6c5 into main Oct 25, 2024
@n1zyy n1zyy deleted the mattw/LG-14651_letter_on_the_way branch October 25, 2024 16:45
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.

5 participants