diff --git a/components/HearingsScheduled/HearingsScheduled.tsx b/components/HearingsScheduled/HearingsScheduled.tsx index bb51b18d6..88508ee81 100644 --- a/components/HearingsScheduled/HearingsScheduled.tsx +++ b/components/HearingsScheduled/HearingsScheduled.tsx @@ -9,6 +9,7 @@ export type EventData = { index: number type: "hearing" | "session" name: string + code?: string | null id: number location?: string fullDate: Date // TODO: Could be a timestamp diff --git a/components/LegislatorProfile/LegislatorProfilePage.tsx b/components/LegislatorProfile/LegislatorProfilePage.tsx index 24ea34433..e65576a90 100644 --- a/components/LegislatorProfile/LegislatorProfilePage.tsx +++ b/components/LegislatorProfile/LegislatorProfilePage.tsx @@ -376,6 +376,7 @@ export function LegislatorProfilePage({ - + latestDate) latestDate = eventDate + + const index = Math.floor(eventDate.diff(thisMonth, "months").months) + const date = formatDate(e.content.EventDate) + if (e.type === "hearing") { + eventList.push({ + index, + type: e.type, + name: e.content.Name ?? "Hearing", + code: e.content.HearingHost.CommitteeCode, + id: e.content.EventId, + location: e.content.Location?.LocationName ?? undefined, + fullDate: eventDate.toJSDate(), + year: date.year, + month: date.month, + date: date.date, + day: date.day, + time: date.time + }) + } + } + } + + const LegislatorCommitteCodes = committeeList.map(code => code.CommitteeCode) + + let legislatorEvents: any[] = [] + + if (events) { + eventList.forEach(event => { + if (LegislatorCommitteCodes.includes(event.code)) { + legislatorEvents.push(event) + } + }) + } + + console.log("legislatorEvents", legislatorEvents) + return - Upcoming Hearings }