Skip to content
Open
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
101 changes: 46 additions & 55 deletions components/bill/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { ModalProps } from "react-bootstrap"
import styled, { ThemeConsumer } from "styled-components"
import { useMediaQuery } from "usehooks-ts"
import { Button, Col, Container, Image, Modal, Row, Stack } from "../bootstrap"
import { useFlags } from "../featureFlags"
import { firestore } from "../firebase"
import * as links from "../links"
import {
Expand Down Expand Up @@ -121,8 +120,6 @@ export const Summary = ({
const isBallotMeasure =
bill?.currentCommittee?.id === currentBallotInitiativeCommittee

const { showLLMFeatures } = useFlags()

const { t } = useTranslation("common")
const isMobile = useMediaQuery("(max-width: 991px)")

Expand Down Expand Up @@ -210,65 +207,59 @@ export const Summary = ({
<></>
)}
</Row>
{showLLMFeatures ? (
{bill.summary !== undefined && bill.topics !== undefined ? (
<>
{bill.summary !== undefined && bill.topics !== undefined ? (
<>
<hr className={`m-0 border-bottom border-2`} />
<SmartDisclaimer />
</>
) : bill.summary !== undefined && isBallotMeasure ? (
<hr className={`m-0 border-bottom border-2`} />
<SmartDisclaimer />
</>
) : bill.summary !== undefined && isBallotMeasure ? (
<>
<hr className={`m-0 mb-3 border-bottom border-2`} />
</>
) : (
<></>
)}
{bill.summary !== undefined && isBallotMeasure ? (
<BallotSummaryRow className={`mx-1 mb-3`}>
{bill.summary.length > BALLOT_SUMMARY_CHAR_LIMIT ? (
<>
<hr className={`m-0 mb-3 border-bottom border-2`} />
{bill.summary.slice(0, BALLOT_SUMMARY_CHAR_LIMIT)}…{" "}
<StyledButton
variant="link"
onClick={() => setShowFullSummary(true)}
>
{t("bill.view_full_summary")}
</StyledButton>
<Modal
show={showFullSummary}
onHide={() => setShowFullSummary(false)}
size="lg"
>
<Modal.Header
closeButton
onClick={() => setShowFullSummary(false)}
>
<Modal.Title>{bill?.id}</Modal.Title>
</Modal.Header>
<Modal.Body className="bg-white">
<FormattedBillDetails>
{bill.summary}
</FormattedBillDetails>
</Modal.Body>
</Modal>
</>
) : (
<></>
)}
{bill.summary !== undefined && isBallotMeasure ? (
<BallotSummaryRow className={`mx-1 mb-3`}>
{bill.summary.length > BALLOT_SUMMARY_CHAR_LIMIT ? (
<>
{bill.summary.slice(0, BALLOT_SUMMARY_CHAR_LIMIT)}…{" "}
<StyledButton
variant="link"
onClick={() => setShowFullSummary(true)}
>
{t("bill.view_full_summary")}
</StyledButton>
<Modal
show={showFullSummary}
onHide={() => setShowFullSummary(false)}
size="lg"
>
<Modal.Header
closeButton
onClick={() => setShowFullSummary(false)}
>
<Modal.Title>{bill?.id}</Modal.Title>
</Modal.Header>
<Modal.Body className="bg-white">
<FormattedBillDetails>
{bill.summary}
</FormattedBillDetails>
</Modal.Body>
</Modal>
</>
) : (
bill.summary
)}
</BallotSummaryRow>
) : (
<Row className="mx-1 mb-3">{bill.summary}</Row>
bill.summary
)}
<Row className={`d-flex mx-0 my-1`} xs="auto">
{bill.topics?.map(t => (
<SmartTag key={t.topic} topic={t} />
))}
</Row>
</>
</BallotSummaryRow>
) : (
<></>
<Row className="mx-1 mb-3">{bill.summary}</Row>
)}
<Row className={`d-flex mx-0 my-1`} xs="auto">
{bill.topics?.map(t => (
<SmartTag key={t.topic} topic={t} />
))}
</Row>
</SummaryContainer>
)
}
Expand Down
5 changes: 0 additions & 5 deletions components/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export const FeatureFlags = z.object({
followOrg: z.boolean().default(false),
/** Lobbying Table */
lobbyingTable: z.boolean().default(false),
/** LLM Bill Summary and Tags **/
showLLMFeatures: z.boolean().default(false),
/** Hearings and Transcriptions **/
hearingsAndTranscriptions: z.boolean().default(false),
/** Phone Verification UI changes **/
Expand All @@ -40,7 +38,6 @@ const defaults: Record<Env, FeatureFlags> = {
billTracker: true,
followOrg: true,
lobbyingTable: false,
showLLMFeatures: true,
hearingsAndTranscriptions: true,
phoneVerificationUI: true,
ballotQuestions: true,
Expand All @@ -52,7 +49,6 @@ const defaults: Record<Env, FeatureFlags> = {
billTracker: false,
followOrg: true,
lobbyingTable: false,
showLLMFeatures: true,
hearingsAndTranscriptions: true,
phoneVerificationUI: false,
ballotQuestions: false,
Expand All @@ -64,7 +60,6 @@ const defaults: Record<Env, FeatureFlags> = {
billTracker: false,
followOrg: true,
lobbyingTable: false,
showLLMFeatures: true,
hearingsAndTranscriptions: true,
phoneVerificationUI: true,
ballotQuestions: false,
Expand Down