Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion components/bill/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@ export const Status = ({ bill }: BillProps) => {
const handleShowBillHistory = () => setShowBillHistory(true)
const handleCloseBillHistory = () => setShowBillHistory(false)
const history = last(bill.history)
const today = new Date().toISOString()

// revisit this when we revisit translations for the backend
const target1 = "Hearing scheduled for "
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is fine for at least the medium-term, but we'll need to revisit this when we revisit translations.

const target2 = "Hearing rescheduled to "

let hearingCheck = false
if (
history?.Action.startsWith(target1) ||
history?.Action.startsWith(target2)
) {
hearingCheck = true
}

let hearingDate = ""
if (history?.Date) {
hearingDate = history.Date
}
let dateCheck = false
if (hearingDate < today) {
dateCheck = true
}

if (!history) return null
return (
Expand All @@ -34,7 +56,7 @@ export const Status = ({ bill }: BillProps) => {
className="text-truncate ps-4"
onClick={handleShowBillHistory}
>
{history.Action}
{hearingCheck && dateCheck ? t("bill.hearing_held") : history.Action}
</StyledButton>
<Modal show={showBillHistory} onHide={handleCloseBillHistory} size="lg">
<Modal.Header closeButton onClick={handleCloseBillHistory}>
Expand Down
3 changes: 2 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
"disclosure_date": "Disclosure Date",
"download_pdf": "Download PDF",
"example_name": "Example Name",
"hearing_held": "Hearing Held",
"hearing_scheduled_for": "Hearing Scheduled for {{date, datetime(year: 'numeric'; month: 'long'; day: 'numeric'; hour: 'numeric'; minute: 'numeric')}}",
"hearing_video_and_transcript" : "Hearing Video + Transcript",
"hearing_video_and_transcript" : "Hearing Video + Transcript",
"history": "History",
"icon": {
"commerce": "Commerce",
Expand Down
Loading