Skip to content

Commit 06080a0

Browse files
authored
Merge pull request #1899 from mertbagt/hearing-transcriptions-base-page
Hearing Transcriptions base page
2 parents e2f43b8 + 5402c6c commit 06080a0

File tree

7 files changed

+610
-21
lines changed

7 files changed

+610
-21
lines changed

components/featureFlags.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export const FeatureFlags = z.object({
1313
/** Lobbying Table */
1414
lobbyingTable: z.boolean().default(false),
1515
/** LLM Bill Summary and Tags **/
16-
showLLMFeatures: z.boolean().default(false)
16+
showLLMFeatures: z.boolean().default(false),
17+
/** Hearings and Transcriptions **/
18+
hearingsAndTranscriptions: z.boolean().default(false)
1719
})
1820

1921
export type FeatureFlags = z.infer<typeof FeatureFlags>
@@ -32,23 +34,26 @@ const defaults: Record<Env, FeatureFlags> = {
3234
billTracker: true,
3335
followOrg: true,
3436
lobbyingTable: false,
35-
showLLMFeatures: true
37+
showLLMFeatures: true,
38+
hearingsAndTranscriptions: true
3639
},
3740
production: {
3841
testimonyDiffing: false,
3942
notifications: true,
4043
billTracker: false,
4144
followOrg: true,
4245
lobbyingTable: false,
43-
showLLMFeatures: true
46+
showLLMFeatures: true,
47+
hearingsAndTranscriptions: false
4448
},
4549
test: {
4650
testimonyDiffing: false,
4751
notifications: true,
4852
billTracker: false,
4953
followOrg: true,
5054
lobbyingTable: false,
51-
showLLMFeatures: true
55+
showLLMFeatures: true,
56+
hearingsAndTranscriptions: true
5257
}
5358
}
5459

components/hearing/HearingDetails.tsx

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
import { doc, getDoc } from "firebase/firestore"
2+
import { Trans, useTranslation } from "next-i18next"
3+
import { useCallback, useEffect, useRef, useState } from "react"
4+
import styled from "styled-components"
5+
import { Col, Container, Image, Row } from "../bootstrap"
6+
import { HearingSidebar } from "./HearingSidebar"
7+
import { Transcriptions } from "./Transcriptions"
8+
import { firestore } from "components/firebase"
9+
import * as links from "components/links"
10+
11+
export const CommitteeButton = styled.button`
12+
border-radius: 12px;
13+
font-size: 12px;
14+
`
15+
16+
const LegalContainer = styled(Container)`
17+
background-color: white;
18+
`
19+
20+
const VideoChild = styled.video`
21+
position: absolute;
22+
top: 0;
23+
left: 0;
24+
width: 100%;
25+
height: 100%;
26+
border: none;
27+
`
28+
29+
const VideoParent = styled.div`
30+
position: relative;
31+
width: 100%;
32+
padding-top: 56.25%; /* For 16:9 aspect ratio */
33+
overflow: hidden;
34+
`
35+
36+
export const HearingDetails = ({
37+
hearingId
38+
}: {
39+
hearingId: string | string[] | undefined
40+
}) => {
41+
const { t } = useTranslation(["common", "hearing"])
42+
43+
const videoRef = useRef<HTMLVideoElement>(null)
44+
function setCurTimeVideo(value: number) {
45+
videoRef.current ? (videoRef.current.currentTime = value) : null
46+
}
47+
48+
const eventId = `hearing-${hearingId}`
49+
50+
const [committeeCode, setCommitteeCode] = useState("")
51+
const [committeeName, setCommitteeName] = useState("")
52+
const [description, setDescription] = useState("")
53+
const [generalCourtNumber, setGeneralCourtNumber] = useState("")
54+
const [hearingDate, setHearingDate] = useState("")
55+
const [videoTranscriptionId, setVideoTranscriptionId] = useState("")
56+
const [videoURL, setVideoURL] = useState("")
57+
58+
const hearingData = useCallback(async () => {
59+
const hearing = await getDoc(doc(firestore, `events/${eventId}`))
60+
const docData = hearing.data()
61+
62+
setCommitteeCode(docData?.content.HearingHost.CommitteeCode)
63+
setCommitteeName(docData?.content.Name)
64+
setDescription(docData?.content.Description)
65+
setGeneralCourtNumber(docData?.content.HearingHost.GeneralCourtNumber)
66+
setHearingDate(docData?.content.EventDate)
67+
setVideoTranscriptionId(docData?.videoTranscriptionId)
68+
setVideoURL(docData?.videoURL)
69+
}, [eventId])
70+
71+
useEffect(() => {
72+
hearingData()
73+
}, [hearingData])
74+
75+
return (
76+
<Container className="mt-3 mb-3">
77+
<h1>
78+
{t("hearing")} {hearingId}
79+
</h1>
80+
81+
<h5 className={`mb-3`}>{description}</h5>
82+
83+
{committeeName ? (
84+
<links.External
85+
href={`https://malegislature.gov/Committees/Detail/${committeeCode}/${generalCourtNumber}`}
86+
>
87+
<CommitteeButton
88+
className={`btn btn-secondary d-flex text-nowrap mt-1 mx-1 p-1`}
89+
>
90+
&nbsp; {committeeName} &nbsp;
91+
</CommitteeButton>
92+
</links.External>
93+
) : (
94+
<></>
95+
)}
96+
97+
<div className={`row mt-4`}>
98+
<Col className={`col-md-8`}>
99+
<LegalContainer className={`pb-2 rounded`}>
100+
<Row
101+
className={`d-flex align-items-center justify-content-between`}
102+
fontSize={"12px"}
103+
xs="auto"
104+
>
105+
<Col>
106+
<div className={`fs-6 fw-bold mt-2`}>
107+
<Image
108+
src="/images/smart-summary.svg"
109+
alt={t("bill.smart_tag")}
110+
height={`34`}
111+
width={`24`}
112+
className={`me-2 pb-1`}
113+
/>
114+
{t("bill.smart_disclaimer2")}
115+
</div>
116+
</Col>
117+
118+
<Col>
119+
<Trans
120+
t={t}
121+
i18nKey="bill.smart_disclaimer3"
122+
components={[
123+
// eslint-disable-next-line react/jsx-key
124+
<links.Internal href="/about/how-maple-uses-ai" />
125+
]}
126+
/>
127+
</Col>
128+
</Row>
129+
</LegalContainer>
130+
131+
{videoURL ? (
132+
<VideoParent className={`my-3`}>
133+
<VideoChild ref={videoRef} src={videoURL} controls muted />
134+
</VideoParent>
135+
) : (
136+
<LegalContainer className={`fs-6 fw-bold my-3 py-2 rounded`}>
137+
{t("no_video_on_file")}
138+
</LegalContainer>
139+
)}
140+
141+
<Transcriptions
142+
setCurTimeVideo={setCurTimeVideo}
143+
videoTranscriptionId={videoTranscriptionId}
144+
/>
145+
</Col>
146+
147+
<div className={`col-md-4`}>
148+
<HearingSidebar
149+
committeeCode={committeeCode}
150+
generalCourtNumber={generalCourtNumber}
151+
hearingDate={hearingDate}
152+
/>
153+
</div>
154+
</div>
155+
</Container>
156+
)
157+
}

0 commit comments

Comments
 (0)