()
+
+ const { about }: Profile = profile
+
+ const onSubmit = handleSubmit(async update => {
+ await updateProfile({ profile, actions }, update)
+ location.assign(`/legislators/${court}/${memberCode}`)
+ setFormUpdated(false)
+ })
+
+ const { t } = useTranslation("legislators")
+ const [formUpdated, setFormUpdated] = useState(false)
+
+ useEffect(() => {
+ setFormUpdated(isDirty)
+ }, [isDirty, setFormUpdated])
+
+ return (
+
+
+
+ )
+}
+
+function ReadonlyBiography({ legislatorData }: { legislatorData: any[] }) {
+ const { t } = useTranslation("legislators")
+
+ return (
+
+ {t("biography")}
+
+ {legislatorData[0]?.about ? legislatorData[0].about : t("notClaimed")}
+
+
+ )
}
diff --git a/components/LegislatorProfile/TabComponents/TestimonyTab.tsx b/components/LegislatorProfile/TabComponents/TestimonyTab.tsx
index eb3bc6e04..74f6383fa 100644
--- a/components/LegislatorProfile/TabComponents/TestimonyTab.tsx
+++ b/components/LegislatorProfile/TabComponents/TestimonyTab.tsx
@@ -1,5 +1,98 @@
+import { useMemo } from "react"
+import { useTranslation } from "next-i18next"
+import styled from "styled-components"
+
import { TabBlock } from "../LegislatorComponents"
-export function TestimonyTab() {
- return - Testimony
+import { useAuth } from "components/auth"
+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-color: #b8c0c9;
+ border-radius: 5px;
+ border-style: solid;
+ border-width: 1px;
+ color: #1a3185;
+ display: flex;
+ font-size: 13px;
+ gap: 10px;
+ line-height: 1.6;
+ margin-top: 14px;
+ margin-bottom: 14px;
+ padding: 12px 16px;
+`
+
+function Disclaimer({ fullname }: { fullname?: string }) {
+ const { t } = useTranslation("legislators")
+
+ return (
+
+
+
+ {fullname} {t("canSubmit")}
+
+
+ )
+}
+
+export function TestimonyTab({
+ legislatorId,
+ name
+}: {
+ legislatorId: string
+ name: string
+}) {
+ const { t } = useTranslation("testimony")
+ const { user } = useAuth()
+
+ const testimony = usePublishedTestimonyListing({
+ uid: legislatorId
+ })
+
+ const testimonies = useMemo(() => {
+ const legislatorTestimonies = testimony.items.result ?? []
+
+ // 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 (
+ <>
+
+ {testimonies.length > 0 && legislatorId ? (
+
+ {testimonies.map(testimony => (
+
+
+
+ ))}
+
+ ) : (
+
+ {t("viewTestimony.noTestimonies")}
+
+ )}
+ >
+ )
}
diff --git a/components/LegislatorProfile/TabComponents/TestimonyTab_PendingProfileLink.tsx b/components/LegislatorProfile/TabComponents/TestimonyTab_PendingProfileLink.tsx
deleted file mode 100644
index 12b8174fd..000000000
--- a/components/LegislatorProfile/TabComponents/TestimonyTab_PendingProfileLink.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { useMemo } from "react"
-import { useTranslation } from "next-i18next"
-import styled from "styled-components"
-
-import { TabBlock } from "../LegislatorComponents"
-
-import { useAuth } from "components/auth"
-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;
-`
-
-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/components/db/profile/urlCleanup.ts b/components/db/profile/urlCleanup.ts
index 26d09b13a..f2fe17e5c 100644
--- a/components/db/profile/urlCleanup.ts
+++ b/components/db/profile/urlCleanup.ts
@@ -7,7 +7,7 @@ export function cleanSocialLinks(network: keyof SocialLinks, link: string) {
const index: number = path.indexOf(".com/") + 5
path = path.substring(index)
}
- if (network === "mastodon" && path.startsWith("@")) {
+ if (path && network === "mastodon" && path.startsWith("@")) {
path = path.substring(1)
}
}
diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json
index 886f6a1ba..4a9e69920 100644
--- a/public/locales/en/legislators.json
+++ b/public/locales/en/legislators.json
@@ -1,13 +1,17 @@
{
+ "addBio": "Add your biography",
"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.",
+ "biography": "Biography",
+ "canSubmit": "can submit testimony on any bill or ballot question, just like any constituent. Their stance and reasoning are shown exactly as submitted — MAPLE does not edit or editorialize.",
"contact": "Contact",
"cosponsored": "Cosponsored",
"districtDetails": "District details are not available yet.",
+ "editBio": "Edit your biography",
"fundsRaised": "Funds Raised",
"home": "Home",
"legislators": "Legislators",
"loading": "Loading district...",
+ "notClaimed": "This legislator has not claimed their MAPLE account",
"party": {
"democratic": "Democratic Party",
"party": "Party",
@@ -15,6 +19,7 @@
},
"stateRepresentative": "State Representative",
"stateSenator": "State Senator",
+ "submit": "Submit",
"tabs": {
"bills": "Bills",
"district": "District",