diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index ab3bc8130..fbf6b9113 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -345,7 +345,7 @@ export function LegislatorPage(props: { id: string }) { - + diff --git a/components/legislator/TabComponents/LegislatorTabs.tsx b/components/legislator/TabComponents/LegislatorTabs.tsx index 34cc14260..332f41747 100644 --- a/components/legislator/TabComponents/LegislatorTabs.tsx +++ b/components/legislator/TabComponents/LegislatorTabs.tsx @@ -63,8 +63,12 @@ const TabNavItem = ({ } export function LegislatorTabs({ + fullname, + pageId, tabCategory }: { + fullname?: string + pageId?: string tabCategory?: TabCategories }) { const { t } = useTranslation("legislators") @@ -98,7 +102,7 @@ export function LegislatorTabs({ { title: t("tabs.testimony"), eventKey: "testimony", - content: + content: }, { title: t("tabs.votes"), diff --git a/components/legislator/TabComponents/Testimony.tsx b/components/legislator/TabComponents/Testimony.tsx index d69dde353..6f5c0e40b 100644 --- a/components/legislator/TabComponents/Testimony.tsx +++ b/components/legislator/TabComponents/Testimony.tsx @@ -1,3 +1,103 @@ -export function Testimony() { - return
- Testimony
+import { useMemo } from "react" +import { useTranslation } from "next-i18next" +import styled from "styled-components" + +import { useAuth } from "components/auth" +import { SmartDisclaimer } from "components/bill/SmartDisclaimer" +import { usePublishedTestimonyListing } from "components/db/testimony/usePublishedTestimonyListing" +import { NoResults } from "components/search/NoResults" +import { TestimonyItem } from "components/TestimonyCard/TestimonyItem" + +const DisclaimerBlock = styled.div` + align-items: flex-start; + background-color: #f0f4ff; + border: "1px #d1d6e7 solid"; + border-radius: 5px; + color: #1a3185; + display: flex; + font-size: 13px; + gap: 10px; + line-height: 1.6; + margin-top: 14px; + margin-bottom: 14px; + padding: 12px 16px; +` + +const TestimonyBlock = styled.div` + background-color: white; + border: "1px #ced4da solid"; + border-radius: 5px; + font-size: 11px; + margin-bottom: 14px; + padding: 0px 16px; +` + +function Disclaimer({ fullname }: { fullname?: string }) { + const { t } = useTranslation("legislators") + + return ( + + + + + + +
+ {fullname} {t("canSubmit")} +
+
+ ) +} + +export function Testimony({ + fullname, + pageId +}: { + fullname?: string + pageId?: string +}) { + const { t } = useTranslation("testimony") + const { user } = useAuth() + + const testimony = usePublishedTestimonyListing({ + uid: pageId + }) + + const allTestimonies = useMemo(() => { + const legislatorTestimonies = testimony.items.result ?? [] + + // Combine and sort by publishedAt (newest first), then take 4 most recent + return [...legislatorTestimonies] + .sort((a, b) => b.publishedAt.toMillis() - a.publishedAt.toMillis()) + .slice(0, 4) + }, [testimony.items.result]) + + return ( + <> + + {allTestimonies.length > 0 ? ( +
+ {allTestimonies.map(testimony => ( + + + + ))} +
+ ) : ( + {t("viewTestimony.noTestimonies")} + )} + + ) } diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json index 8b5c685d1..fecb79040 100644 --- a/public/locales/en/legislators.json +++ b/public/locales/en/legislators.json @@ -1,5 +1,6 @@ { "billsSponsored": "Bills Sponsored", + "canSubmit": "can submit testimony on any bill or ballot question, just like any constituent. Her stance and reasoning are shown exactly as submitted — MAPLE does not edit or editorialize.", "contact": "Contact", "cosponsored": "Cosponsored", "fundsRaised": "Funds Raised",