diff --git a/components/legislator/LegislatorComponents.tsx b/components/LegislatorProfile/LegislatorComponents.tsx similarity index 96% rename from components/legislator/LegislatorComponents.tsx rename to components/LegislatorProfile/LegislatorComponents.tsx index e420630f4..1f25f37ab 100644 --- a/components/legislator/LegislatorComponents.tsx +++ b/components/LegislatorProfile/LegislatorComponents.tsx @@ -19,6 +19,14 @@ export const formatPhoneNumber = (value: string) => { ` } +export const TabBlock = styled.div` + background-color: white; + border: 1px #b8c0c9 solid; + border-radius: 5px; + margin-bottom: 10px; + padding: 16px; +` + /** Party Labels **/ const DemocraticBubble = styled.div.attrs(props => ({ diff --git a/components/LegislatorProfile/LegislatorProfilePage.tsx b/components/LegislatorProfile/LegislatorProfilePage.tsx index 34a0d4ed8..2f8d127e2 100644 --- a/components/LegislatorProfile/LegislatorProfilePage.tsx +++ b/components/LegislatorProfile/LegislatorProfilePage.tsx @@ -1,8 +1,37 @@ +import { faChevronRight } from "@fortawesome/free-solid-svg-icons" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import ErrorPage from "next/error" +import { useTranslation } from "next-i18next" import styled from "styled-components" + +import * as links from "../links" + +import { + Bluesky, + DistrictLabel, + formatPhoneNumber, + LinkedIn, + PartyLabel, + Twitter +} from "./LegislatorComponents" +import { LegislatorSidebar } from "./LegislatorSidebar" +import { LegislatorTabs } from "./LegislatorTabs" + +import { useAuth } from "components/auth" import { Col, Container, Row, Spinner } from "components/bootstrap" import { useDistrict, useMember } from "components/db" -import { DistrictTab } from "./DistrictTab" +import { Internal } from "components/links" +import { FollowUserButton } from "components/shared/FollowButton" +import { CircleImage } from "components/shared/LabeledIcon" + +type ProfilePlaceholder = { + social?: { + blueSky?: string + linkedIn?: string + twitter?: string + } + website?: string +} const tabs = [ "Priorities", @@ -14,19 +43,78 @@ const tabs = [ "Votes" ] -const TabButton = styled.button` - background: transparent; - border: 0; - border-bottom: 5px solid transparent; - color: #68707a; - font-size: 1.35rem; +const ButtonContainer = styled(Col).attrs(props => ({ + className: `col-12 justify-content-md-end ${props.className}`, + md: `3`, + sm: `4` +}))` + width: max-content; +` + +const DirectoryPath = styled.div.attrs(props => ({ + className: `align-items-center d-flex flex-nowrap ${props.className}` +}))` + font-size: 12px; +` + +const HeaderBlock = styled.div.attrs(props => ({ + className: `d-flex flex-wrap justify-content-between ${props.className}` +}))` + background-color: white; + border: 1px #b8c0c9 solid; + border-radius: 5px; + margin-top: 8px; + padding: 16px; +` + +const HeaderName = styled.div` + font-size: 26px; font-weight: 700; - padding: 1.35rem 1.9rem 1.15rem; + color: #0b0a3e; +` - &.active { - border-bottom-color: #18358f; - color: #18358f; - } +const RoleLine = styled.div.attrs(props => ({ + className: `mb-2 ${props.className}` +}))` + color: #6c757d; + font-size: 14px; +` + +const PhoneNum = styled.span` + color: #6c757d; +` + +const SocialLine = styled.div.attrs(props => ({ + className: `d-flex flex-wrap mb-2 ${props.className}` +}))` + font-size: 12px; + text-decoration: none; +` + +const StatBlock = styled(Col).attrs(props => ({ + className: `d-flex col-4 flex-grow-1 ${props.className}`, + md: `2` +}))` + background-color: white; + border: 1px #b8c0c9 solid; + border-radius: 5px; + margin-top: 4px; + padding: 16px; +` + +const StatLine = styled(Row).attrs(props => ({ + className: `text-nowrap ${props.className}` +}))` + font-size: 12px; +` + +const StatNum = styled.div.attrs(props => ({ + className: `mx-auto ${props.className}` +}))` + color: #1a3185; + font-size: 22px; + font-weight: 700; + width: max-content; ` export function LegislatorProfilePage({ @@ -42,6 +130,24 @@ export function LegislatorProfilePage({ member?.Branch, member?.District ) + const { t } = useTranslation("legislators") + // const { user } = useAuth() **uncomment when Following Button in enabled** + + /* replace with profile info for legislators with Maple accounts */ + let profile: ProfilePlaceholder = { + // social: { + // blueSky: "blueskyTest", + // linkedIn: "linkedinTest", + // twitter: "twitterTest" + // }, + // website: "test.com" + social: { + blueSky: "", + linkedIn: "", + twitter: "" + }, + website: "" + } if (memberLoading) { return ( @@ -56,36 +162,204 @@ export function LegislatorProfilePage({ } return ( - - + + + + {t("home")} + + + + {/* update with link to legistators search page when that is created */} +
{t("legislators")}
+ {/* */} + + +
{member.Name}
+
+ + + + {""} + + -

{member.Name}

-

- {member.Branch} - {member.District} -

+ + + {member.Name} + + + + + {member.Branch == "Senate" ? ( + {t("stateSenator")} + ) : ( + {t("stateRepresentative")} + )} + {/* · Town */} + + +
+ + {/* Incumbent Label */} + +
+ + +
+ + {member.EmailAddress} + +
+ + {profile.website ? ( +
+ · + + {profile.website} + +
+ ) : ( +
+ · + + {`malegislature.gov/Legislators/Profile/${member.MemberCode}`} + +
+ )} + + {member.PhoneNumber ? ( +
+ · + {formatPhoneNumber(member.PhoneNumber)} +
+ ) : ( + <> + )} + +
+ {profile?.social?.twitter || + profile?.social?.linkedIn || + profile?.social?.blueSky ? ( + · + ) : ( + <> + )} + + {profile?.social?.twitter ? ( + + + + ) : ( + <> + )} + {profile?.social?.linkedIn ? ( + + + + ) : ( + <> + )} + {profile?.social?.blueSky ? ( + + + + ) : ( + <> + )} +
+
-
-
- {tabs.map(label => ( - + {/* uncomment when legislator Maple accounts are linked to this page + + {user && legislatorAccountId ? ( +
+ +
+ ) : ( + <> + )} */} + - {label} -
- ))} -
-
- + {t("contact")} + + + + +
+ + + ? + {t("termsServed")} + + + + + {member.SponsoredBills.length} + {t("billsSponsored")} + + + + + {member.CoSponsoredBills.length} + {t("cosponsored")} + + + + + ? + {t("fundsRaised")} + +
+ + + + + + + + + ) } diff --git a/components/LegislatorProfile/LegislatorSidebar.tsx b/components/LegislatorProfile/LegislatorSidebar.tsx new file mode 100644 index 000000000..96cf42c9d --- /dev/null +++ b/components/LegislatorProfile/LegislatorSidebar.tsx @@ -0,0 +1,13 @@ +import { Biography } from "./SidebarComponents/Biography" +import { OtherTestimony } from "./SidebarComponents/OtherTestimony" +import { UpcomingHearings } from "./SidebarComponents/UpcomingHearings" + +export function LegislatorSidebar() { + return ( + <> + + + + + ) +} diff --git a/components/legislator/TabComponents/LegislatorTabs.tsx b/components/LegislatorProfile/LegislatorTabs.tsx similarity index 72% rename from components/legislator/TabComponents/LegislatorTabs.tsx rename to components/LegislatorProfile/LegislatorTabs.tsx index 332f41747..40c264453 100644 --- a/components/legislator/TabComponents/LegislatorTabs.tsx +++ b/components/LegislatorProfile/LegislatorTabs.tsx @@ -3,16 +3,17 @@ import { TabPane } from "react-bootstrap" import TabContainer from "react-bootstrap/TabContainer" import styled from "styled-components" -import { Container, Nav } from "../../bootstrap" +import { Container, Nav } from "../bootstrap" -import { Bills } from "./Bills" -import { District } from "./District" -import { Elections } from "./Elections" -import { Finance } from "./Finance" -import { Priorities } from "./Priorities" -import { Testimony } from "./Testimony" -import { Votes } from "./Votes" +import { BillsTab } from "./TabComponents/BillsTab" +import { DistrictTab } from "./TabComponents/DistrictTab" +import { ElectionsTab } from "./TabComponents/ElectionsTab" +import { FinanceTab } from "./TabComponents/FinanceTab" +import { PrioritiesTab } from "./TabComponents/PrioritiesTab" +import { TestimonyTab } from "./TabComponents/TestimonyTab" +import { VotesTab } from "./TabComponents/VotesTab" +import { District } from "components/db" import { StyledTabContent, TabNavWrapper, @@ -63,12 +64,12 @@ const TabNavItem = ({ } export function LegislatorTabs({ - fullname, - pageId, + district, + districtLoading, tabCategory }: { - fullname?: string - pageId?: string + district?: District | undefined + districtLoading?: boolean tabCategory?: TabCategories }) { const { t } = useTranslation("legislators") @@ -77,42 +78,42 @@ export function LegislatorTabs({ { title: t("tabs.priorities"), eventKey: "priorities", - content: + content: }, { title: t("tabs.bills"), eventKey: "bills", - content: + content: }, { title: t("tabs.elections"), eventKey: "elections", - content: + content: }, { title: t("tabs.finance"), eventKey: "finance", - content: + content: }, { title: t("tabs.district"), eventKey: "district", - content: + content: }, { title: t("tabs.testimony"), eventKey: "testimony", - content: + content: }, { title: t("tabs.votes"), eventKey: "votes", - content: + content: } ] return ( - + {tabs.map((t, i) => ( diff --git a/components/LegislatorProfile/SidebarComponents/Biography.tsx b/components/LegislatorProfile/SidebarComponents/Biography.tsx new file mode 100644 index 000000000..e190ac443 --- /dev/null +++ b/components/LegislatorProfile/SidebarComponents/Biography.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function Biography() { + return - Biography +} diff --git a/components/LegislatorProfile/SidebarComponents/OtherTestimony.tsx b/components/LegislatorProfile/SidebarComponents/OtherTestimony.tsx new file mode 100644 index 000000000..4cf43f2b2 --- /dev/null +++ b/components/LegislatorProfile/SidebarComponents/OtherTestimony.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function OtherTestimony() { + return - Other Testimony +} diff --git a/components/LegislatorProfile/SidebarComponents/UpcomingHearings.tsx b/components/LegislatorProfile/SidebarComponents/UpcomingHearings.tsx new file mode 100644 index 000000000..c3da92690 --- /dev/null +++ b/components/LegislatorProfile/SidebarComponents/UpcomingHearings.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function UpcomingHearings() { + return - Upcoming Hearings +} diff --git a/components/LegislatorProfile/TabComponents/BillsTab.tsx b/components/LegislatorProfile/TabComponents/BillsTab.tsx new file mode 100644 index 000000000..bde7d1cb7 --- /dev/null +++ b/components/LegislatorProfile/TabComponents/BillsTab.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function BillsTab() { + return - Bills +} diff --git a/components/LegislatorProfile/DistrictTab.test.tsx b/components/LegislatorProfile/TabComponents/DistrictTab.test.tsx similarity index 100% rename from components/LegislatorProfile/DistrictTab.test.tsx rename to components/LegislatorProfile/TabComponents/DistrictTab.test.tsx diff --git a/components/LegislatorProfile/DistrictTab.tsx b/components/LegislatorProfile/TabComponents/DistrictTab.tsx similarity index 87% rename from components/LegislatorProfile/DistrictTab.tsx rename to components/LegislatorProfile/TabComponents/DistrictTab.tsx index a00f706b4..19afb1418 100644 --- a/components/LegislatorProfile/DistrictTab.tsx +++ b/components/LegislatorProfile/TabComponents/DistrictTab.tsx @@ -1,6 +1,8 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { faLocationDot } from "@fortawesome/free-solid-svg-icons" +import { useTranslation } from "next-i18next" import styled from "styled-components" +import { TabBlock } from "../LegislatorComponents" import type { District } from "components/db" const MapPreview = styled.div` @@ -12,8 +14,8 @@ const MapPreview = styled.div` ` const DistrictCard = styled.section` - border: 1px solid #d9dee5; - border-radius: 8px; + border: 1px #b8c0c9 solid; + border-radius: 5px; overflow: hidden; ` @@ -54,16 +56,14 @@ export function DistrictTab({ district?: District loading?: boolean }) { + const { t } = useTranslation("legislators") + if (loading) { - return
Loading district...
+ return {t("loading")} } if (!district) { - return ( -
- District details are not available yet. -
- ) + return {t("districtDetails")} } const chips = subdivisionChips(district) @@ -71,7 +71,7 @@ export function DistrictTab({ return ( <> - +

{district.district} District

diff --git a/components/LegislatorProfile/TabComponents/ElectionsTab.tsx b/components/LegislatorProfile/TabComponents/ElectionsTab.tsx new file mode 100644 index 000000000..1bb6bfccf --- /dev/null +++ b/components/LegislatorProfile/TabComponents/ElectionsTab.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function ElectionsTab() { + return - Elections +} diff --git a/components/LegislatorProfile/TabComponents/FinanceTab.tsx b/components/LegislatorProfile/TabComponents/FinanceTab.tsx new file mode 100644 index 000000000..4c263d26a --- /dev/null +++ b/components/LegislatorProfile/TabComponents/FinanceTab.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function FinanceTab() { + return - Finance +} diff --git a/components/LegislatorProfile/TabComponents/PrioritiesTab.tsx b/components/LegislatorProfile/TabComponents/PrioritiesTab.tsx new file mode 100644 index 000000000..000d6d564 --- /dev/null +++ b/components/LegislatorProfile/TabComponents/PrioritiesTab.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function PrioritiesTab() { + return - Priorities +} diff --git a/components/LegislatorProfile/TabComponents/TestimonyTab.tsx b/components/LegislatorProfile/TabComponents/TestimonyTab.tsx new file mode 100644 index 000000000..eb3bc6e04 --- /dev/null +++ b/components/LegislatorProfile/TabComponents/TestimonyTab.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function TestimonyTab() { + return - Testimony +} diff --git a/components/legislator/TabComponents/Testimony.tsx b/components/LegislatorProfile/TabComponents/TestimonyTab_PendingProfileLink.tsx similarity index 87% rename from components/legislator/TabComponents/Testimony.tsx rename to components/LegislatorProfile/TabComponents/TestimonyTab_PendingProfileLink.tsx index 6f5c0e40b..12b8174fd 100644 --- a/components/legislator/TabComponents/Testimony.tsx +++ b/components/LegislatorProfile/TabComponents/TestimonyTab_PendingProfileLink.tsx @@ -2,8 +2,9 @@ import { useMemo } from "react" import { useTranslation } from "next-i18next" import styled from "styled-components" +import { TabBlock } from "../LegislatorComponents" + 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" @@ -23,15 +24,6 @@ const DisclaimerBlock = styled.div` 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") @@ -86,13 +78,13 @@ export function Testimony({ {allTestimonies.length > 0 ? (

{allTestimonies.map(testimony => ( - + - + ))}
) : ( diff --git a/components/LegislatorProfile/TabComponents/VotesTab.tsx b/components/LegislatorProfile/TabComponents/VotesTab.tsx new file mode 100644 index 000000000..09e0558a4 --- /dev/null +++ b/components/LegislatorProfile/TabComponents/VotesTab.tsx @@ -0,0 +1,5 @@ +import { TabBlock } from "../LegislatorComponents" + +export function VotesTab() { + return - Votes +} diff --git a/components/LegislatorProfile/index.ts b/components/LegislatorProfile/index.ts index 056729577..01fb5e8c3 100644 --- a/components/LegislatorProfile/index.ts +++ b/components/LegislatorProfile/index.ts @@ -1,2 +1 @@ -export * from "./DistrictTab" export * from "./LegislatorProfilePage" diff --git a/components/db/members.ts b/components/db/members.ts index d4cd503bc..3025245ea 100644 --- a/components/db/members.ts +++ b/components/db/members.ts @@ -21,6 +21,8 @@ export type MemberContent = { PhoneNumber: string FaxNumber: string | null Committees: CommitteeReference[] + SponsoredBills: Array + CoSponsoredBills: Array } export type Member = { diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx deleted file mode 100644 index fbf6b9113..000000000 --- a/components/legislator/LegislatorPage.tsx +++ /dev/null @@ -1,356 +0,0 @@ -import { doc, getDoc } from "firebase/firestore" -import { faChevronRight } from "@fortawesome/free-solid-svg-icons" -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" -import { useTranslation } from "next-i18next" -import ErrorPage from "next/error" -import { useCallback, useEffect, useState } from "react" -import styled from "styled-components" - -import { Col, Container, Row, Spinner } from "../bootstrap" -import { usePublicProfile } from "../db" -import { firestore } from "../firebase" -import * as links from "../links" - -import { - Bluesky, - DistrictLabel, - formatPhoneNumber, - LinkedIn, - PartyLabel, - Twitter -} from "./LegislatorComponents" -import { LegislatorSidebar } from "./SidebarComponents/LegislatorSidebar" -import { LegislatorTabs } from "./TabComponents/LegislatorTabs" - -import { useAuth } from "components/auth" -import { useFlags } from "components/featureFlags" -import { Internal } from "components/links" -import { FollowUserButton } from "components/shared/FollowButton" -import { CircleImage } from "components/shared/LabeledIcon" - -const DirectoryPath = styled.div.attrs(props => ({ - className: `align-items-center d-flex flex-nowrap ${props.className}` -}))` - font-size: 12px; -` - -const ButtonContainer = styled(Col).attrs(props => ({ - className: `col-12 justify-content-md-end ${props.className}`, - md: `3`, - sm: `4` -}))` - width: max-content; -` - -const HeaderBlock = styled.div` - background-color: white; - border: "1px #ced4da solid"; - border-radius: 5px; - margin-top: 8px; - padding: 16px; -` - -const HeaderName = styled.div` - font-size: 26px; - font-weight: 700; - color: #0b0a3e; -` - -const RoleLine = styled.div.attrs(props => ({ - className: `mb-2 ${props.className}` -}))` - color: #6c757d; - font-size: 14px; -` - -const PhoneNum = styled.span` - color: #6c757d; -` - -const SocialLine = styled.div.attrs(props => ({ - className: `d-flex flex-wrap mb-2 ${props.className}` -}))` - font-size: 12px; - text-decoration: none; -` - -const StatBlock = styled(Col).attrs(props => ({ - className: `d-flex col-4 flex-grow-1 ${props.className}`, - md: `2` -}))` - background-color: white; - border: 1px #ced4da solid; - border-radius: 5px; - margin-top: 4px; - padding: 16px; -` - -const StatLine = styled(Row).attrs(props => ({ - className: `text-nowrap ${props.className}` -}))` - font-size: 12px; -` - -const StatNum = styled.div.attrs(props => ({ - className: `mx-auto ${props.className}` -}))` - color: #1a3185; - font-size: 22px; - font-weight: 700; - width: max-content; -` - -export function LegislatorPage(props: { id: string }) { - const { t } = useTranslation("legislators") - const { result: profile, loading } = usePublicProfile(props.id) - const { legislators } = useFlags() - const { user } = useAuth() - - // eventually this should be replaced with a profile prop array that - // contains a list of courts the legislator served on - const viableCourts = "194" - - const [branch, setBranch] = useState("") - const [cosponsoredBills, setCosponsoredBills] = useState>([""]) - const [district, setDistrict] = useState("") - const [email, setEmail] = useState("") - const [party, setParty] = useState("") - const [phoneNumber, setPhoneNumber] = useState("") - const [sponsoredBills, setSponsoredBills] = useState>([""]) - - const memberData = useCallback(async () => { - const member = await getDoc( - doc( - firestore, - `generalCourts/${viableCourts}/members/${profile?.memberId}` - ) - ) - const docData = member.data() - - setBranch(docData?.content.Branch) - setCosponsoredBills(docData?.content.CoSponsoredBills) - setDistrict(docData?.content.District) - setEmail(docData?.content.EmailAddress) - setParty(docData?.content.Party) - setPhoneNumber(docData?.content.PhoneNumber) - setSponsoredBills(docData?.content.SponsoredBills) - }, [district, party, phoneNumber]) - - useEffect(() => { - profile ? memberData() : null - }, [memberData, profile]) - - if (loading) { - return ( - - - - ) - } - if (!legislators) { - return - } - if (!profile) { - return - } - - return ( - - - - {t("home")} - - -
{t("legislators")}
- -
{profile.fullName}
-
- - - - {""} - - - - - {profile.fullName} - - - - - {branch == "Senate" ? ( - {t("stateSenator")} - ) : ( - {t("stateRepresentative")} - )} - {/* · Town */} - - -
- - {/* Incumbent Label */} - -
- - -
- - {email} - -
- - {profile.website ? ( -
- · - - {profile.website} - -
- ) : ( -
- · - - {`malegislature.gov/Legislators/Profile/${profile.memberId}`} - -
- )} - - {phoneNumber ? ( -
- · - {formatPhoneNumber(phoneNumber)} -
- ) : ( - <> - )} - -
- {profile?.social?.twitter || - profile?.social?.linkedIn || - profile?.social?.blueSky ? ( - · - ) : ( - <> - )} - - {profile?.social?.twitter ? ( - - - - ) : ( - <> - )} - {profile?.social?.linkedIn ? ( - - - - ) : ( - <> - )} - {profile?.social?.blueSky ? ( - - - - ) : ( - <> - )} -
-
- - - - {user ? ( -
- -
- ) : ( - <> - )} - - {t("contact")} - -
-
- -
- - - ? - {t("termsServed")} - - - - - - {sponsoredBills?.length ? <>{sponsoredBills.length} : <>?} - - {t("billsSponsored")} - - - - - - {cosponsoredBills?.length ? ( - <>{cosponsoredBills.length} - ) : ( - <>? - )} - - {t("cosponsored")} - - - - - ? - {t("fundsRaised")} - - -
- - - - - - - - - -
- ) -} diff --git a/components/legislator/SidebarComponents/Biography.tsx b/components/legislator/SidebarComponents/Biography.tsx deleted file mode 100644 index 90cf3f5e0..000000000 --- a/components/legislator/SidebarComponents/Biography.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Biography() { - return
- Biography
-} diff --git a/components/legislator/SidebarComponents/LegislatorSidebar.tsx b/components/legislator/SidebarComponents/LegislatorSidebar.tsx deleted file mode 100644 index 39f77168e..000000000 --- a/components/legislator/SidebarComponents/LegislatorSidebar.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { Biography } from "./Biography" -import { OtherTestimony } from "./OtherTestimony" -import { UpcomingHearings } from "./UpcomingHearings" - -export function LegislatorSidebar() { - return ( - <> - Sidebar Components - - - - - ) -} diff --git a/components/legislator/SidebarComponents/OtherTestimony.tsx b/components/legislator/SidebarComponents/OtherTestimony.tsx deleted file mode 100644 index 8b3940014..000000000 --- a/components/legislator/SidebarComponents/OtherTestimony.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function OtherTestimony() { - return
- Other Testimony
-} diff --git a/components/legislator/SidebarComponents/UpcomingHearings.tsx b/components/legislator/SidebarComponents/UpcomingHearings.tsx deleted file mode 100644 index 69e68cb05..000000000 --- a/components/legislator/SidebarComponents/UpcomingHearings.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function UpcomingHearings() { - return
- Upcoming Hearings
-} diff --git a/components/legislator/TabComponents/Bills.tsx b/components/legislator/TabComponents/Bills.tsx deleted file mode 100644 index 61d6b5918..000000000 --- a/components/legislator/TabComponents/Bills.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Bills() { - return
- Bills
-} diff --git a/components/legislator/TabComponents/District.tsx b/components/legislator/TabComponents/District.tsx deleted file mode 100644 index 06025fbff..000000000 --- a/components/legislator/TabComponents/District.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function District() { - return
- District
-} diff --git a/components/legislator/TabComponents/Elections.tsx b/components/legislator/TabComponents/Elections.tsx deleted file mode 100644 index c20356658..000000000 --- a/components/legislator/TabComponents/Elections.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Elections() { - return
- Elections
-} diff --git a/components/legislator/TabComponents/Finance.tsx b/components/legislator/TabComponents/Finance.tsx deleted file mode 100644 index f1431f05f..000000000 --- a/components/legislator/TabComponents/Finance.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Finance() { - return
- Finance
-} diff --git a/components/legislator/TabComponents/Priorities.tsx b/components/legislator/TabComponents/Priorities.tsx deleted file mode 100644 index 534f54540..000000000 --- a/components/legislator/TabComponents/Priorities.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Priorities() { - return
- Priorities
-} diff --git a/components/legislator/TabComponents/Votes.tsx b/components/legislator/TabComponents/Votes.tsx deleted file mode 100644 index ecdfb5f01..000000000 --- a/components/legislator/TabComponents/Votes.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function Votes() { - return
- Votes
-} diff --git a/components/legislator/index.ts b/components/legislator/index.ts deleted file mode 100644 index 13355a639..000000000 --- a/components/legislator/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./LegislatorPage" diff --git a/pages/legislators/[court]/[memberCode].tsx b/pages/legislators/[court]/[memberCode].tsx index 5824626c9..5c6357718 100644 --- a/pages/legislators/[court]/[memberCode].tsx +++ b/pages/legislators/[court]/[memberCode].tsx @@ -1,8 +1,9 @@ import { GetServerSideProps } from "next" import { serverSideTranslations } from "next-i18next/serverSideTranslations" import { z } from "zod" -import { LegislatorProfilePage } from "components/LegislatorProfile" + import { flags } from "components/featureFlags" +import { LegislatorProfilePage } from "components/LegislatorProfile" import { createPage } from "components/page" const Query = z.object({ @@ -14,7 +15,7 @@ export default createPage<{ court: number memberCode: string }>({ - titleI18nKey: "titles.legislatorProfile", + titleI18nKey: "navigation.legislator", Page: ({ court, memberCode }) => ( ) @@ -38,7 +39,14 @@ export const getServerSideProps: GetServerSideProps = async ctx => { return { props: { ...query.data, - ...(await serverSideTranslations(locale, ["auth", "common", "footer"])) + ...(await serverSideTranslations(locale, [ + "auth", + "common", + "footer", + "legislators", + "profile", + "testimony" + ])) } } } diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx deleted file mode 100644 index 2e3b29d76..000000000 --- a/pages/legislators/profile.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { useTranslation } from "next-i18next" -import { useEffect, useState } from "react" -import { Spinner } from "react-bootstrap" - -import { LegislatorPage } from "components/legislator" -import { createPage } from "components/page" -import { createGetStaticTranslationProps } from "components/translations" - -export default createPage<{ court: string }>({ - titleI18nKey: "navigation.legislator", - Page: () => { - const { id, loading } = useProfileRouting() - const { t } = useTranslation("profile") - - return ( -
- {loading ? ( -
- -
- ) : id ? ( - - ) : ( -
{t("noLegislator")}
- )} -
- ) - } -}) - -const useProfileRouting = () => { - const [id, setId] = useState("od") - const [loading, setLoading] = useState(true) - - useEffect(() => { - if (window) { - const urlParams = new URLSearchParams(window.location?.search) - const urlid = urlParams.get("id") - - if (typeof urlid === "string") { - setId(urlid) - } - if (urlid !== undefined) { - setLoading(false) - } - } - }, [id]) - - return { id, loading } -} - -export const getStaticProps = createGetStaticTranslationProps([ - "auth", - "common", - "footer", - "legislators", - "profile", - "testimony" -]) diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json index fecb79040..886f6a1ba 100644 --- a/public/locales/en/legislators.json +++ b/public/locales/en/legislators.json @@ -3,9 +3,11 @@ "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", + "districtDetails": "District details are not available yet.", "fundsRaised": "Funds Raised", "home": "Home", "legislators": "Legislators", + "loading": "Loading district...", "party": { "democratic": "Democratic Party", "party": "Party",