Skip to content
Open
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
19 changes: 18 additions & 1 deletion components/bill/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ export const Status = ({ bill }: BillProps) => {
const handleShowBillHistory = () => setShowBillHistory(true)
const handleCloseBillHistory = () => setShowBillHistory(false)
const history = last(bill.history)
const today = new Date().toISOString()
const target = "Hearing scheduled for "

let hearingDate = ""
if (history?.Date) {
hearingDate = history.Date
}

let hearingCheck = false
if (history?.Action.startsWith(target)) {
hearingCheck = true
}

let dateCheck = false
if (hearingDate < today) {
dateCheck = true
}

if (!history) return null
return (
Expand All @@ -34,7 +51,7 @@ export const Status = ({ bill }: BillProps) => {
className="text-truncate ps-4"
onClick={handleShowBillHistory}
>
{history.Action}
{hearingCheck && dateCheck ? "Hearing Held" : history.Action}
</StyledButton>
<Modal show={showBillHistory} onHide={handleCloseBillHistory} size="lg">
<Modal.Header closeButton onClick={handleCloseBillHistory}>
Expand Down
Loading