Skip to content

Conversation

jicruz96
Copy link
Collaborator

@jicruz96 jicruz96 commented Jul 28, 2025

Summary

Checklist

  • On the frontend, I've made my strings translate-able.
  • If I've added shared components, I've added a storybook story.
  • I've made pages responsive and look good on mobile.

Screenshots

Note: You should notice no changes!

🖱️ Click to see screenshots Screenshot 2025-07-28 at 3 10 30 AM Screenshot 2025-07-28 at 3 10 09 AM Screenshot 2025-07-28 at 3 09 54 AM Screenshot 2025-07-28 at 3 09 09 AM Screenshot 2025-07-28 at 3 08 39 AM Screenshot 2025-07-28 at 3 11 55 AM

Known issues

how to display bills with no primary sponsor?

right spot for a translation util? (but it's nbd)

  • Intuitively, the new translation utils would've gone in the existing components/translations.tsx file, but this file is actually a server-side rendering utility, so instead I've created a new file components/i18n.ts. Ideally, components/translations.tsx is renamed/moved elsewhere to better indicate its responsibility in SSR.

right spot for translations not super clear (but it's nbd)

  • Whether or not the new translations should go under the existing common.json or a new json file is kind of an arbitrary decision. common.json has some bill stuff, but then other bill stuff have their own file (e.g. billSearch.json). Overall, not super important either way. I just went with dumping them in common.json.

Steps to test/reproduce

  1. Go to bill search and sort by next hearing date.
  2. Confirm that the following text looks as expected:
    • In bill search page:
      • "hearing scheduled for" in the billHit card.
      • "Sponsor: " info in billHit card.
        • make sure to check a few cases: no cosponsors, 1 cosponsor, several cosponsors...
      • "Committee: " info in billHit card.
    • In a bill detail page (any one with a hearing date)
      • "Bill Tracker" title in the bill detail page
      • all text in "Sponsors" card ("Sponsors", "Lead Sponsor", "See N Cosponsors") link.
        • "{{billId}} Cosponsors" in the cosponsors modal once you click "See N Cosponsors"
      • "Committee" title in committee maple card section.
      • "hearing scheduled for" in hearing date container next to Sponsors and Committees
      • table headers in status table once you click the bill status container ("Status & History", "Status", "Branch")

Copy link

vercel bot commented Jul 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
maple-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2025 5:20am

@jicruz96 jicruz96 changed the title extract text to translation ready files -- Bill Detail Page [DRAFT] extract text to translation ready files -- Bill Detail Page Jul 28, 2025
@jicruz96 jicruz96 changed the title [DRAFT] extract text to translation ready files -- Bill Detail Page extract text to translation ready files -- Bill Detail Page Jul 28, 2025
@jicruz96
Copy link
Collaborator Author

jicruz96 commented Jul 28, 2025

🪲 yo look out for this bug

During self-review, I became aware of one pre-existing bug that I did not fix but also made worse. Bills with only one sponsor don't look right in the bill hit.

Existing Bug

Notice the buggy appearance of the sponsors:

Screenshot 2025-07-28 at 3 15 38 AM

After

Now it says undefined instead which is arguably worse.

Screenshot 2025-07-28 at 3 07 38 AM

I can give it a try at fixing tomorrow. Does anyone how we should interpret sponsor lists if .primarySponsor is null ?

After Pt. 2

aight I fixed it now actually but I don't love it. what do y'all think?
Screenshot 2025-07-28 at 3 33 36 AM

isplay when there is only one co-sponsor
@jicruz96 jicruz96 marked this pull request as ready for review July 28, 2025 07:35
Copy link
Collaborator

@Mephistic Mephistic left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on! A few comments:

how to display bills with no primary sponsor?

Let's check in with Matt Victor - I'm not actually sure what it means for a bill to have no primary sponsor, so it might be a data error. Your fallback seems reasonable if we don't have a better answer for why this would happen.

right spot for a translation util? (but it's nbd) Intuitively, the new translation utils would've gone in the existing components/translations.tsx file, but this file is actually a server-side rendering utility, so instead I've created a new file components/i18n.ts. Ideally, components/translations.tsx is renamed/moved elsewhere to better indicate its responsibility in SSR.

Seems sensible to me.

right spot for translations not super clear (but it's nbd) Whether or not the new translations should go under the existing common.json or a new json file is kind of an arbitrary decision. common.json has some bill stuff, but then other bill stuff have their own file (e.g. billSearch.json). Overall, not super important either way. I just went with dumping them in common.json.

As a general rule: Anything that's part of omnipresent or shared UI elements (e.g. the header/footer) belongs in common.json. Anything that lives on a specific page (e.g. the text on the "Submit Testimony" page) should go in a ***.json related to that page.

That said, we're not as strict about that as maybe we should be (partly because this process has involved updating a bunch of old code where it's not always easy to tell all the places where certain components are getting used).

@jicruz96
Copy link
Collaborator Author

jicruz96 commented Aug 6, 2025

@Mephistic ok I've removed components/i18n.ts. The wrapper was indeed unnecessary. Newest commits fully use i18next built-ins to handle date localization. Those changes obviated all of the open comment threads.

Let's check in with Matt Victor - I'm not actually sure what it means for a bill to have no primary sponsor, so it might be a data error. Your fallback seems reasonable if we don't have a better answer for why this would happen.

Talking to @mvictor55 today, he implied that there ought to always be a primary sponsor, falling back to the executive when there isn't a legisltive one, but that making sure we get this detail right in the data scrape is not a worthwhile endeavor right now. so since that is the case and since the codebase itself declares primarySponsor as a nullable value, and evidently there are times where it is null, I say we keep the fallback.

@jicruz96 jicruz96 requested a review from Mephistic August 6, 2025 04:41
Copy link
Collaborator

@Mephistic Mephistic left a comment

Choose a reason for hiding this comment

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

LGTM

@Mephistic Mephistic merged commit 8a51f70 into codeforboston:main Aug 15, 2025
7 of 8 checks passed
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.

Extract text to translation-ready files -- Bill Detail Page
2 participants