From 05f137366f08374d3441f1ff8cfb3ab8a0d4589e Mon Sep 17 00:00:00 2001 From: mertbagt Date: Thu, 30 Apr 2026 15:24:26 -0400 Subject: [PATCH 01/15] initial page --- components/legislator/LegislatorPage.tsx | 44 +++++++++++++ components/legislator/index.ts | 1 + pages/hearing/[hearingId].tsx | 2 +- pages/legislators/profile.tsx | 78 ++++++++++++++++++++++++ public/locales/en/common.json | 2 + public/locales/en/legislators.json | 4 ++ 6 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 components/legislator/LegislatorPage.tsx create mode 100644 components/legislator/index.ts create mode 100644 pages/legislators/profile.tsx create mode 100644 public/locales/en/legislators.json diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx new file mode 100644 index 000000000..d3ed512dd --- /dev/null +++ b/components/legislator/LegislatorPage.tsx @@ -0,0 +1,44 @@ +import { collectionGroup, getDocs, query, where } from "firebase/firestore" +import { useTranslation } from "next-i18next" +import ErrorPage from "next/error" +import { useEffect, useState } from "react" + +import { Role, useAuth } from "../auth" +import { Col, Container, Row, Spinner } from "../bootstrap" +import { usePublicProfile, usePublishedTestimonyListing } from "../db" +import { Banner } from "../shared/StyledSharedComponents" +import ViewTestimony from "../TestimonyCard/ViewTestimony" + +//import { OrgContactInfo } from "./OrgContactInfo" +//import { ProfileAboutSection } from "./ProfileAboutSection" +//import { ProfileHeader } from "./ProfileHeader" +//import { ProfileLegislators } from "./ProfileLegislators" +//import { VerifyAccountSectionLegacy } from "./VerifyAccountSectionLegacy" + +import { useFlags } from "components/featureFlags" +import { firestore } from "components/firebase" +import { PendingUpgradeBanner } from "components/PendingUpgradeBanner" +import { FollowContext, OrgFollowStatus } from "components/shared/FollowContext" +import { VerifyAccountSection } from "components/shared" + +export function LegislatorPage(props: { id: string }) { + const { t } = useTranslation("legislators") + const { result: profile, loading } = usePublicProfile(props.id) + + if (loading) { + return ( + + + + ) + } + if (!profile) { + return + } + + return ( + <> +

{t("test2")}

+ + ) +} diff --git a/components/legislator/index.ts b/components/legislator/index.ts new file mode 100644 index 000000000..13355a639 --- /dev/null +++ b/components/legislator/index.ts @@ -0,0 +1 @@ +export * from "./LegislatorPage" diff --git a/pages/hearing/[hearingId].tsx b/pages/hearing/[hearingId].tsx index 84263d4e1..46431a13e 100644 --- a/pages/hearing/[hearingId].tsx +++ b/pages/hearing/[hearingId].tsx @@ -9,7 +9,7 @@ import { fetchHearingData, HearingData } from "components/hearing/hearing" const Query = z.object({ hearingId: z.coerce.number() }) export default createPage<{ hearingData: HearingData }>({ - titleI18nKey: "Hearing", + titleI18nKey: "navigation.hearing", Page: ({ hearingData }) => { return } diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx new file mode 100644 index 000000000..2a3222540 --- /dev/null +++ b/pages/legislators/profile.tsx @@ -0,0 +1,78 @@ +import { useTranslation } from "next-i18next" +import { useEffect, useState } from "react" +import { Spinner } from "react-bootstrap" +import { useAuth } from "components/auth" +import { createPage } from "components/page" +import { ProfilePage } from "components/ProfilePage" +import { createGetStaticTranslationProps } from "components/translations" + +import { LegislatorPage } from "components/legislator" + +export default createPage({ + titleI18nKey: "navigation.legislator", + Page: () => { + const { id, loading } = useProfileRouting() + const { authenticated, user } = useAuth() + const { t } = useTranslation("profile") + + return ( +
+ {loading ? ( +
+ +
+ ) : !loading && !id && authenticated ? ( + // + // t("test2") + + ) : id ? ( + // + // t("test2") + + ) : ( +
{t("noUser")}
+ )} +
+ ) + } +}) + +const useProfileRouting = () => { + const { user } = useAuth() + + 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 (urlid === null) { + if (user?.uid) { + setId(user.uid) + urlParams.set("id", user.uid) + } + } + + if (typeof urlid === "string") { + setId(urlid) + } + if (urlid !== undefined) { + setLoading(false) + } + } + }, [id, user?.uid]) + + return { id, loading } +} + +export const getStaticProps = createGetStaticTranslationProps([ + "auth", + "common", + "footer", + "legislators", + "profile" + // "editProfile", + // "testimony" +]) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 209b85ac4..3dda1fe62 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -119,10 +119,12 @@ "editProfile": "Edit Profile", "faq": "FAQ", "followingTab": "Followed Content", + "hearing": "Hearing", "hearings": "Hearings", "home": "Home", "learnAboutTestimony": "Learn About Testimony", "legislativeProcess": "About the MA Legislative Process", + "legislator": "Legislator", "logo": "Massachusetts Platform for Legislative Engagement home", "main": "Main navigation", "missionAndGoals": "Mission & Goals", diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json new file mode 100644 index 000000000..aa96ba566 --- /dev/null +++ b/public/locales/en/legislators.json @@ -0,0 +1,4 @@ +{ + "test": "Test", + "test2": "Hello World" +} \ No newline at end of file From 4b43e88855d27e8ac8478cde11e431c32429be54 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Fri, 1 May 2026 16:47:20 -0400 Subject: [PATCH 02/15] header and stat blocks --- components/legislator/LegislatorPage.tsx | 55 ++++++++++++++++++++++-- pages/legislators/profile.tsx | 9 +--- public/locales/en/legislators.json | 2 + 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index d3ed512dd..9f3fba8c1 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -1,11 +1,19 @@ +import { faChevronRight } from "@fortawesome/free-solid-svg-icons" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { collectionGroup, getDocs, query, where } from "firebase/firestore" import { useTranslation } from "next-i18next" import ErrorPage from "next/error" import { useEffect, useState } from "react" +import styled from "styled-components" import { Role, useAuth } from "../auth" import { Col, Container, Row, Spinner } from "../bootstrap" import { usePublicProfile, usePublishedTestimonyListing } from "../db" +import { + Back, + ButtonContainer, + FeatureCalloutButton +} from "../shared/CommonComponents" import { Banner } from "../shared/StyledSharedComponents" import ViewTestimony from "../TestimonyCard/ViewTestimony" @@ -21,10 +29,34 @@ import { PendingUpgradeBanner } from "components/PendingUpgradeBanner" import { FollowContext, OrgFollowStatus } from "components/shared/FollowContext" import { VerifyAccountSection } from "components/shared" +import { Internal } from "components/links" + +const DirectoryPath = styled.div` + font-size: 12px; +` + +const HeaderBlock = styled.div` + background-color: white; + border: "1px #ced4da solid"; + border-radius: 5px; + margin-top: 8px; + padding: 16px; +` + +const StatBlock = styled.div` + background-color: white; + border: 1px #ced4da solid; + border-radius: 5px; + margin-top: 4px; + padding: 16px; +` + export function LegislatorPage(props: { id: string }) { const { t } = useTranslation("legislators") const { result: profile, loading } = usePublicProfile(props.id) + console.log("Pro: ", profile) + if (loading) { return ( @@ -37,8 +69,25 @@ export function LegislatorPage(props: { id: string }) { } return ( - <> -

{t("test2")}

- + + + + {t("home")} + + +
{t("legislators")}
+ +
{profile.fullName}
+
+ + Header Info Goes Here + +
+ Stat + Info + Goes + Here +
+
) } diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx index 2a3222540..8c24390b4 100644 --- a/pages/legislators/profile.tsx +++ b/pages/legislators/profile.tsx @@ -1,13 +1,12 @@ import { useTranslation } from "next-i18next" import { useEffect, useState } from "react" import { Spinner } from "react-bootstrap" + import { useAuth } from "components/auth" +import { LegislatorPage } from "components/legislator" import { createPage } from "components/page" -import { ProfilePage } from "components/ProfilePage" import { createGetStaticTranslationProps } from "components/translations" -import { LegislatorPage } from "components/legislator" - export default createPage({ titleI18nKey: "navigation.legislator", Page: () => { @@ -22,12 +21,8 @@ export default createPage({ ) : !loading && !id && authenticated ? ( - // - // t("test2") ) : id ? ( - // - // t("test2") ) : (
{t("noUser")}
diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json index aa96ba566..5e8254df4 100644 --- a/public/locales/en/legislators.json +++ b/public/locales/en/legislators.json @@ -1,4 +1,6 @@ { + "home": "Home", + "legislators": "Legislators", "test": "Test", "test2": "Hello World" } \ No newline at end of file From 3a008d94f8dd2118fa003ba5302f305d8f66f34d Mon Sep 17 00:00:00 2001 From: mertbagt Date: Fri, 1 May 2026 17:16:52 -0400 Subject: [PATCH 03/15] bottom columns placement --- components/legislator/LegislatorPage.tsx | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index 9f3fba8c1..20eb9e951 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -25,11 +25,10 @@ import ViewTestimony from "../TestimonyCard/ViewTestimony" import { useFlags } from "components/featureFlags" import { firestore } from "components/firebase" +import { Internal } from "components/links" import { PendingUpgradeBanner } from "components/PendingUpgradeBanner" -import { FollowContext, OrgFollowStatus } from "components/shared/FollowContext" import { VerifyAccountSection } from "components/shared" - -import { Internal } from "components/links" +import { FollowContext, OrgFollowStatus } from "components/shared/FollowContext" const DirectoryPath = styled.div` font-size: 12px; @@ -43,7 +42,7 @@ const HeaderBlock = styled.div` padding: 16px; ` -const StatBlock = styled.div` +const StatBlock = styled(Col)` background-color: white; border: 1px #ced4da solid; border-radius: 5px; @@ -83,11 +82,28 @@ export function LegislatorPage(props: { id: string }) { Header Info Goes Here
- Stat - Info - Goes - Here + + Stat + + + Info + + + Goes + + + Here +
+ + + + Tabs + + + Sidebar + + ) } From 9a304a8903669ef5473c39e6207bae5391d91743 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Fri, 1 May 2026 17:31:51 -0400 Subject: [PATCH 04/15] Sidebar folder --- components/legislator/LegislatorPage.tsx | 3 ++- .../legislator/SidebarComponents/Biography.tsx | 3 +++ .../SidebarComponents/LegislatorSidebar.tsx | 14 ++++++++++++++ .../SidebarComponents/OtherTestimony.tsx | 3 +++ .../SidebarComponents/UpcomingHearings.tsx | 3 +++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 components/legislator/SidebarComponents/Biography.tsx create mode 100644 components/legislator/SidebarComponents/LegislatorSidebar.tsx create mode 100644 components/legislator/SidebarComponents/OtherTestimony.tsx create mode 100644 components/legislator/SidebarComponents/UpcomingHearings.tsx diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index 20eb9e951..8deb692ab 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -17,6 +17,7 @@ import { import { Banner } from "../shared/StyledSharedComponents" import ViewTestimony from "../TestimonyCard/ViewTestimony" +import { LegislatorSidebar } from "./SidebarComponents/LegislatorSidebar" //import { OrgContactInfo } from "./OrgContactInfo" //import { ProfileAboutSection } from "./ProfileAboutSection" //import { ProfileHeader } from "./ProfileHeader" @@ -101,7 +102,7 @@ export function LegislatorPage(props: { id: string }) { Tabs - Sidebar +
diff --git a/components/legislator/SidebarComponents/Biography.tsx b/components/legislator/SidebarComponents/Biography.tsx new file mode 100644 index 000000000..90cf3f5e0 --- /dev/null +++ b/components/legislator/SidebarComponents/Biography.tsx @@ -0,0 +1,3 @@ +export function Biography() { + return
- Biography
+} diff --git a/components/legislator/SidebarComponents/LegislatorSidebar.tsx b/components/legislator/SidebarComponents/LegislatorSidebar.tsx new file mode 100644 index 000000000..39f77168e --- /dev/null +++ b/components/legislator/SidebarComponents/LegislatorSidebar.tsx @@ -0,0 +1,14 @@ +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 new file mode 100644 index 000000000..8b3940014 --- /dev/null +++ b/components/legislator/SidebarComponents/OtherTestimony.tsx @@ -0,0 +1,3 @@ +export function OtherTestimony() { + return
- Other Testimony
+} diff --git a/components/legislator/SidebarComponents/UpcomingHearings.tsx b/components/legislator/SidebarComponents/UpcomingHearings.tsx new file mode 100644 index 000000000..69e68cb05 --- /dev/null +++ b/components/legislator/SidebarComponents/UpcomingHearings.tsx @@ -0,0 +1,3 @@ +export function UpcomingHearings() { + return
- Upcoming Hearings
+} From 419d9f371d856c3d681faf111867041d7646aaf9 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Fri, 1 May 2026 21:13:24 -0400 Subject: [PATCH 05/15] set up tabs --- components/legislator/LegislatorPage.tsx | 3 +- components/legislator/TabComponents/Bills.tsx | 3 + .../legislator/TabComponents/District.tsx | 3 + .../legislator/TabComponents/Elections.tsx | 3 + .../legislator/TabComponents/Finance.tsx | 3 + .../TabComponents/LegislatorTabs.tsx | 95 +++++++++++++++++++ .../legislator/TabComponents/Priorities.tsx | 3 + .../legislator/TabComponents/Testimony.tsx | 3 + components/legislator/TabComponents/Votes.tsx | 3 + pages/legislators/profile.tsx | 5 +- public/locales/en/legislators.json | 9 ++ 11 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 components/legislator/TabComponents/Bills.tsx create mode 100644 components/legislator/TabComponents/District.tsx create mode 100644 components/legislator/TabComponents/Elections.tsx create mode 100644 components/legislator/TabComponents/Finance.tsx create mode 100644 components/legislator/TabComponents/LegislatorTabs.tsx create mode 100644 components/legislator/TabComponents/Priorities.tsx create mode 100644 components/legislator/TabComponents/Testimony.tsx create mode 100644 components/legislator/TabComponents/Votes.tsx diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index 8deb692ab..ea38fb836 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -18,6 +18,7 @@ import { Banner } from "../shared/StyledSharedComponents" import ViewTestimony from "../TestimonyCard/ViewTestimony" import { LegislatorSidebar } from "./SidebarComponents/LegislatorSidebar" +import { LegislatorTabs } from "./TabComponents/LegislatorTabs" //import { OrgContactInfo } from "./OrgContactInfo" //import { ProfileAboutSection } from "./ProfileAboutSection" //import { ProfileHeader } from "./ProfileHeader" @@ -99,7 +100,7 @@ export function LegislatorPage(props: { id: string }) { - Tabs + diff --git a/components/legislator/TabComponents/Bills.tsx b/components/legislator/TabComponents/Bills.tsx new file mode 100644 index 000000000..61d6b5918 --- /dev/null +++ b/components/legislator/TabComponents/Bills.tsx @@ -0,0 +1,3 @@ +export function Bills() { + return
- Bills
+} diff --git a/components/legislator/TabComponents/District.tsx b/components/legislator/TabComponents/District.tsx new file mode 100644 index 000000000..06025fbff --- /dev/null +++ b/components/legislator/TabComponents/District.tsx @@ -0,0 +1,3 @@ +export function District() { + return
- District
+} diff --git a/components/legislator/TabComponents/Elections.tsx b/components/legislator/TabComponents/Elections.tsx new file mode 100644 index 000000000..c20356658 --- /dev/null +++ b/components/legislator/TabComponents/Elections.tsx @@ -0,0 +1,3 @@ +export function Elections() { + return
- Elections
+} diff --git a/components/legislator/TabComponents/Finance.tsx b/components/legislator/TabComponents/Finance.tsx new file mode 100644 index 000000000..f1431f05f --- /dev/null +++ b/components/legislator/TabComponents/Finance.tsx @@ -0,0 +1,3 @@ +export function Finance() { + return
- Finance
+} diff --git a/components/legislator/TabComponents/LegislatorTabs.tsx b/components/legislator/TabComponents/LegislatorTabs.tsx new file mode 100644 index 000000000..1f3f3b4c4 --- /dev/null +++ b/components/legislator/TabComponents/LegislatorTabs.tsx @@ -0,0 +1,95 @@ +import { useTranslation } from "next-i18next" +import { TabPane } from "react-bootstrap" +import TabContainer from "react-bootstrap/TabContainer" + +import { Container, Row, Spinner } 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 { + StyledTabContent, + TabNavItem, + TabNavWrapper +} from "components/EditProfilePage/StyledEditProfileComponents" + +const tabCategory = [ + "priorities", + "bills", + "elections", + "finance", + "district", + "testimony", + "votes" +] +type TabCategories = (typeof tabCategory)[number] + +export function LegislatorTabs({ + tabCategory +}: { + tabCategory?: TabCategories +}) { + const { t } = useTranslation("legislators") + + const tabs = [ + { + title: t("tabs.priorities"), + eventKey: "priorities", + content: + }, + { + title: t("tabs.bills"), + eventKey: "bills", + content: + }, + { + title: t("tabs.elections"), + eventKey: "elections", + content: + }, + { + title: t("tabs.finance"), + eventKey: "finance", + content: + }, + { + title: t("tabs.district"), + eventKey: "district", + content: + }, + { + title: t("tabs.testimony"), + eventKey: "testimony", + content: + }, + { + title: t("tabs.votes"), + eventKey: "votes", + content: + } + ] + + return ( + + + + {tabs.map((t, i) => ( + + ))} + + + {tabs.map(t => ( + + {t.content} + + ))} + + + + ) +} diff --git a/components/legislator/TabComponents/Priorities.tsx b/components/legislator/TabComponents/Priorities.tsx new file mode 100644 index 000000000..534f54540 --- /dev/null +++ b/components/legislator/TabComponents/Priorities.tsx @@ -0,0 +1,3 @@ +export function Priorities() { + return
- Priorities
+} diff --git a/components/legislator/TabComponents/Testimony.tsx b/components/legislator/TabComponents/Testimony.tsx new file mode 100644 index 000000000..d69dde353 --- /dev/null +++ b/components/legislator/TabComponents/Testimony.tsx @@ -0,0 +1,3 @@ +export function Testimony() { + return
- Testimony
+} diff --git a/components/legislator/TabComponents/Votes.tsx b/components/legislator/TabComponents/Votes.tsx new file mode 100644 index 000000000..ecdfb5f01 --- /dev/null +++ b/components/legislator/TabComponents/Votes.tsx @@ -0,0 +1,3 @@ +export function Votes() { + return
- Votes
+} diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx index 8c24390b4..83858d53b 100644 --- a/pages/legislators/profile.tsx +++ b/pages/legislators/profile.tsx @@ -67,7 +67,6 @@ export const getStaticProps = createGetStaticTranslationProps([ "common", "footer", "legislators", - "profile" - // "editProfile", - // "testimony" + "profile", + "testimony" ]) diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json index 5e8254df4..8e4b72d3d 100644 --- a/public/locales/en/legislators.json +++ b/public/locales/en/legislators.json @@ -1,6 +1,15 @@ { "home": "Home", "legislators": "Legislators", + "tabs": { + "bills": "Bills", + "district": "District", + "elections": "Elections", + "finance": "Finance", + "priorities": "Priorities", + "testimony": "Testimony", + "votes": "Votes" + }, "test": "Test", "test2": "Hello World" } \ No newline at end of file From 72e7906f28501c82dfcf597a44ce69c9175bdd2b Mon Sep 17 00:00:00 2001 From: mertbagt Date: Fri, 1 May 2026 21:57:46 -0400 Subject: [PATCH 06/15] tab title colors --- .../TabComponents/LegislatorTabs.tsx | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/components/legislator/TabComponents/LegislatorTabs.tsx b/components/legislator/TabComponents/LegislatorTabs.tsx index 1f3f3b4c4..5feb3558c 100644 --- a/components/legislator/TabComponents/LegislatorTabs.tsx +++ b/components/legislator/TabComponents/LegislatorTabs.tsx @@ -2,7 +2,7 @@ import { useTranslation } from "next-i18next" import { TabPane } from "react-bootstrap" import TabContainer from "react-bootstrap/TabContainer" -import { Container, Row, Spinner } from "../../bootstrap" +import { Container, Nav, Row, Spinner } from "../../bootstrap" import { Bills } from "./Bills" import { District } from "./District" @@ -14,10 +14,11 @@ import { Votes } from "./Votes" import { StyledTabContent, - TabNavItem, TabNavWrapper } from "components/EditProfilePage/StyledEditProfileComponents" +import styled from "styled-components" + const tabCategory = [ "priorities", "bills", @@ -93,3 +94,37 @@ export function LegislatorTabs({ ) } + +type TabType = { title: string; eventKey: string; content: JSX.Element } + +const TabNavLink = styled(Nav.Link).attrs(props => ({ + className: `rounded-top m-0 p-0 ${props.className}` +}))` + color: #6c757d; + + &.active { + color: #1a3185; + font-weight: bold; + } +` + +const TabNavItem = ({ + tab, + i: i, + className +}: { + tab: TabType + i: number + className?: string +}) => { + return ( + + +

+ {tab.title} +

+
+
+
+ ) +} From f4961b6687a19a418d2fc4083ede8f0e83bc497d Mon Sep 17 00:00:00 2001 From: mertbagt Date: Sun, 3 May 2026 13:09:42 -0400 Subject: [PATCH 07/15] fill in stat blocks --- components/legislator/LegislatorPage.tsx | 44 +++++++---- .../TabComponents/LegislatorTabs.tsx | 74 +++++++++---------- public/locales/en/legislators.json | 6 +- 3 files changed, 71 insertions(+), 53 deletions(-) diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index ea38fb836..323bc6ed8 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -19,11 +19,6 @@ import ViewTestimony from "../TestimonyCard/ViewTestimony" import { LegislatorSidebar } from "./SidebarComponents/LegislatorSidebar" import { LegislatorTabs } from "./TabComponents/LegislatorTabs" -//import { OrgContactInfo } from "./OrgContactInfo" -//import { ProfileAboutSection } from "./ProfileAboutSection" -//import { ProfileHeader } from "./ProfileHeader" -//import { ProfileLegislators } from "./ProfileLegislators" -//import { VerifyAccountSectionLegacy } from "./VerifyAccountSectionLegacy" import { useFlags } from "components/featureFlags" import { firestore } from "components/firebase" @@ -52,6 +47,17 @@ const StatBlock = styled(Col)` padding: 16px; ` +const StatLine = styled(Row)` + font-size: 12px; +` + +const StatNum = styled.div` + 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) @@ -84,17 +90,29 @@ export function LegislatorPage(props: { id: string }) { Header Info Goes Here
- - Stat + + + ? + {t("termsServed")} + - - Info + + + ? + {t("billsSponsored")} + - - Goes + + + ? + {t("cosponsored")} + - - Here + + + ? + {t("fundsRaised")} +
diff --git a/components/legislator/TabComponents/LegislatorTabs.tsx b/components/legislator/TabComponents/LegislatorTabs.tsx index 5feb3558c..34cc14260 100644 --- a/components/legislator/TabComponents/LegislatorTabs.tsx +++ b/components/legislator/TabComponents/LegislatorTabs.tsx @@ -1,8 +1,9 @@ import { useTranslation } from "next-i18next" import { TabPane } from "react-bootstrap" import TabContainer from "react-bootstrap/TabContainer" +import styled from "styled-components" -import { Container, Nav, Row, Spinner } from "../../bootstrap" +import { Container, Nav } from "../../bootstrap" import { Bills } from "./Bills" import { District } from "./District" @@ -14,11 +15,10 @@ import { Votes } from "./Votes" import { StyledTabContent, - TabNavWrapper + TabNavWrapper, + TabType } from "components/EditProfilePage/StyledEditProfileComponents" -import styled from "styled-components" - const tabCategory = [ "priorities", "bills", @@ -30,6 +30,38 @@ const tabCategory = [ ] type TabCategories = (typeof tabCategory)[number] +const TabNavLink = styled(Nav.Link).attrs(props => ({ + className: `rounded-top m-0 p-0 ${props.className}` +}))` + color: #6c757d; + + &.active { + color: #1a3185; + font-weight: bold; + } +` + +const TabNavItem = ({ + tab, + i: i, + className +}: { + tab: TabType + i: number + className?: string +}) => { + return ( + + +

+ {tab.title} +

+
+
+
+ ) +} + export function LegislatorTabs({ tabCategory }: { @@ -94,37 +126,3 @@ export function LegislatorTabs({ ) } - -type TabType = { title: string; eventKey: string; content: JSX.Element } - -const TabNavLink = styled(Nav.Link).attrs(props => ({ - className: `rounded-top m-0 p-0 ${props.className}` -}))` - color: #6c757d; - - &.active { - color: #1a3185; - font-weight: bold; - } -` - -const TabNavItem = ({ - tab, - i: i, - className -}: { - tab: TabType - i: number - className?: string -}) => { - return ( - - -

- {tab.title} -

-
-
-
- ) -} diff --git a/public/locales/en/legislators.json b/public/locales/en/legislators.json index 8e4b72d3d..4974cfc9d 100644 --- a/public/locales/en/legislators.json +++ b/public/locales/en/legislators.json @@ -1,4 +1,7 @@ { + "billsSponsored": "Bills Sponsored", + "cosponsored": "Cosponsored", + "fundsRaised": "Funds Raised", "home": "Home", "legislators": "Legislators", "tabs": { @@ -10,6 +13,5 @@ "testimony": "Testimony", "votes": "Votes" }, - "test": "Test", - "test2": "Hello World" + "termsServed": "Terms Served" } \ No newline at end of file From 494a84adaf50a5dc8fc3c63d396be39313a02959 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Tue, 5 May 2026 19:35:45 -0400 Subject: [PATCH 08/15] minor cleanup --- components/legislator/LegislatorPage.tsx | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index 323bc6ed8..4190fac54 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -1,31 +1,16 @@ import { faChevronRight } from "@fortawesome/free-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" -import { collectionGroup, getDocs, query, where } from "firebase/firestore" import { useTranslation } from "next-i18next" import ErrorPage from "next/error" -import { useEffect, useState } from "react" import styled from "styled-components" -import { Role, useAuth } from "../auth" import { Col, Container, Row, Spinner } from "../bootstrap" -import { usePublicProfile, usePublishedTestimonyListing } from "../db" -import { - Back, - ButtonContainer, - FeatureCalloutButton -} from "../shared/CommonComponents" -import { Banner } from "../shared/StyledSharedComponents" -import ViewTestimony from "../TestimonyCard/ViewTestimony" +import { usePublicProfile } from "../db" import { LegislatorSidebar } from "./SidebarComponents/LegislatorSidebar" import { LegislatorTabs } from "./TabComponents/LegislatorTabs" -import { useFlags } from "components/featureFlags" -import { firestore } from "components/firebase" import { Internal } from "components/links" -import { PendingUpgradeBanner } from "components/PendingUpgradeBanner" -import { VerifyAccountSection } from "components/shared" -import { FollowContext, OrgFollowStatus } from "components/shared/FollowContext" const DirectoryPath = styled.div` font-size: 12px; From e60ca6a4cc44ce573b71c2c4f0c9659342938adc Mon Sep 17 00:00:00 2001 From: mertbagt Date: Tue, 5 May 2026 20:21:12 -0400 Subject: [PATCH 09/15] cleanup 2 --- components/legislator/LegislatorPage.tsx | 45 ++++++++++++++---------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index 4190fac54..6e52ae587 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -12,7 +12,9 @@ import { LegislatorTabs } from "./TabComponents/LegislatorTabs" import { Internal } from "components/links" -const DirectoryPath = styled.div` +const DirectoryPath = styled.div.attrs(props => ({ + className: `align-items-center d-flex flex-nowrap ${props.className}` +}))` font-size: 12px; ` @@ -24,7 +26,10 @@ const HeaderBlock = styled.div` padding: 16px; ` -const StatBlock = styled(Col)` +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; @@ -32,11 +37,15 @@ const StatBlock = styled(Col)` padding: 16px; ` -const StatLine = styled(Row)` +const StatLine = styled(Row).attrs(props => ({ + className: `text-nowrap ${props.className}` +}))` font-size: 12px; ` -const StatNum = styled.div` +const StatNum = styled.div.attrs(props => ({ + className: `mx-auto ${props.className}` +}))` color: #1a3185; font-size: 22px; font-weight: 700; @@ -62,7 +71,7 @@ export function LegislatorPage(props: { id: string }) { return ( - + {t("home")} @@ -72,31 +81,31 @@ export function LegislatorPage(props: { id: string }) {
{profile.fullName}
- Header Info Goes Here + Header Info Goes Here
- + - ? - {t("termsServed")} + ? + {t("termsServed")} - + - ? - {t("billsSponsored")} + ? + {t("billsSponsored")} - + - ? - {t("cosponsored")} + ? + {t("cosponsored")} - + - ? - {t("fundsRaised")} + ? + {t("fundsRaised")}
From d0a00fcb6928d01c18a2d8980e43930523bdd57e Mon Sep 17 00:00:00 2001 From: mertbagt Date: Tue, 5 May 2026 20:47:43 -0400 Subject: [PATCH 10/15] feature flags --- components/featureFlags.ts | 13 +++++++++---- components/legislator/LegislatorPage.tsx | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/components/featureFlags.ts b/components/featureFlags.ts index 459d5efee..04214dc18 100644 --- a/components/featureFlags.ts +++ b/components/featureFlags.ts @@ -19,7 +19,9 @@ export const FeatureFlags = z.object({ /** Phone Verification UI changes **/ phoneVerificationUI: z.boolean().default(false), /** Ballot Questions feature */ - ballotQuestions: z.boolean().default(false) + ballotQuestions: z.boolean().default(false), + /** Legislators Page feature **/ + legislators: z.boolean().default(false) }) export type FeatureFlags = z.infer @@ -41,7 +43,8 @@ const defaults: Record = { showLLMFeatures: true, hearingsAndTranscriptions: true, phoneVerificationUI: true, - ballotQuestions: true + ballotQuestions: true, + legislators: true }, production: { testimonyDiffing: false, @@ -52,7 +55,8 @@ const defaults: Record = { showLLMFeatures: true, hearingsAndTranscriptions: true, phoneVerificationUI: false, - ballotQuestions: false + ballotQuestions: false, + legislators: false }, test: { testimonyDiffing: false, @@ -63,7 +67,8 @@ const defaults: Record = { showLLMFeatures: true, hearingsAndTranscriptions: true, phoneVerificationUI: true, - ballotQuestions: false + ballotQuestions: false, + legislators: false } } diff --git a/components/legislator/LegislatorPage.tsx b/components/legislator/LegislatorPage.tsx index 6e52ae587..35f2b5251 100644 --- a/components/legislator/LegislatorPage.tsx +++ b/components/legislator/LegislatorPage.tsx @@ -10,6 +10,7 @@ import { usePublicProfile } from "../db" import { LegislatorSidebar } from "./SidebarComponents/LegislatorSidebar" import { LegislatorTabs } from "./TabComponents/LegislatorTabs" +import { useFlags } from "components/featureFlags" import { Internal } from "components/links" const DirectoryPath = styled.div.attrs(props => ({ @@ -55,6 +56,7 @@ const StatNum = styled.div.attrs(props => ({ export function LegislatorPage(props: { id: string }) { const { t } = useTranslation("legislators") const { result: profile, loading } = usePublicProfile(props.id) + const { legislators } = useFlags() console.log("Pro: ", profile) @@ -65,6 +67,9 @@ export function LegislatorPage(props: { id: string }) {
) } + if (!legislators) { + return + } if (!profile) { return } From f4696839d6102079307c48529275a295f02863bf Mon Sep 17 00:00:00 2001 From: mertbagt Date: Wed, 6 May 2026 11:22:01 -0400 Subject: [PATCH 11/15] cleanup page --- pages/legislators/profile.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx index 83858d53b..de4aa347a 100644 --- a/pages/legislators/profile.tsx +++ b/pages/legislators/profile.tsx @@ -7,11 +7,10 @@ import { LegislatorPage } from "components/legislator" import { createPage } from "components/page" import { createGetStaticTranslationProps } from "components/translations" -export default createPage({ +export default createPage<{ court: string }>({ titleI18nKey: "navigation.legislator", Page: () => { const { id, loading } = useProfileRouting() - const { authenticated, user } = useAuth() const { t } = useTranslation("profile") return ( @@ -20,8 +19,6 @@ export default createPage({
- ) : !loading && !id && authenticated ? ( - ) : id ? ( ) : ( @@ -34,7 +31,6 @@ export default createPage({ const useProfileRouting = () => { const { user } = useAuth() - const [id, setId] = useState("od") const [loading, setLoading] = useState(true) From 77f05aa32b538bea1fa1bb728f52ac22d6c1610c Mon Sep 17 00:00:00 2001 From: mertbagt Date: Wed, 6 May 2026 11:27:03 -0400 Subject: [PATCH 12/15] remove user from page --- pages/legislators/profile.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx index de4aa347a..936037f03 100644 --- a/pages/legislators/profile.tsx +++ b/pages/legislators/profile.tsx @@ -2,7 +2,6 @@ import { useTranslation } from "next-i18next" import { useEffect, useState } from "react" import { Spinner } from "react-bootstrap" -import { useAuth } from "components/auth" import { LegislatorPage } from "components/legislator" import { createPage } from "components/page" import { createGetStaticTranslationProps } from "components/translations" @@ -30,7 +29,6 @@ export default createPage<{ court: string }>({ }) const useProfileRouting = () => { - const { user } = useAuth() const [id, setId] = useState("od") const [loading, setLoading] = useState(true) @@ -39,13 +37,6 @@ const useProfileRouting = () => { const urlParams = new URLSearchParams(window.location?.search) const urlid = urlParams.get("id") - if (urlid === null) { - if (user?.uid) { - setId(user.uid) - urlParams.set("id", user.uid) - } - } - if (typeof urlid === "string") { setId(urlid) } @@ -53,7 +44,7 @@ const useProfileRouting = () => { setLoading(false) } } - }, [id, user?.uid]) + }, [id]) return { id, loading } } From a793955bfa2598ea8ae78d346edc50e8394bc0e5 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Wed, 6 May 2026 11:35:06 -0400 Subject: [PATCH 13/15] update translations --- pages/legislators/profile.tsx | 2 +- public/locales/en/profile.json | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pages/legislators/profile.tsx b/pages/legislators/profile.tsx index 936037f03..2e3b29d76 100644 --- a/pages/legislators/profile.tsx +++ b/pages/legislators/profile.tsx @@ -21,7 +21,7 @@ export default createPage<{ court: string }>({ ) : id ? ( ) : ( -
{t("noUser")}
+
{t("noLegislator")}
)} ) diff --git a/public/locales/en/profile.json b/public/locales/en/profile.json index 339637c00..6e0dba5fb 100644 --- a/public/locales/en/profile.json +++ b/public/locales/en/profile.json @@ -1,10 +1,7 @@ { "aboutMe": "About {{firstName}}", "aboutUs": "About Us", - "user": "User", - "noUser": "no user", "anonymousUser": "Anonymous User", - "joinDate": "Joined in {{date}}", "button":{ "editProfile": "Edit\u00A0Profile", "notficationFrequencyDropdown": "open envelope with letter, toggles update frequency options", @@ -19,12 +16,14 @@ "privateProfile": "Your profile is currently private. You can change this in \"settings\"", "noLegislatorInfo": "No legislator information given" }, - "verifyAccountSection":{ - "verifyAccount": "We sent a link to your email to verify your account, but you haven't\nclicked it yet. If you don't see it, be sure to check your spam\nfolder.", - "checkEmail": "Check your email!", - "sendAnotherLink": "Send Another Link" - }, + "joinDate": "Joined in {{date}}", "legislators": "Legislators", + "noLegislator": "No legislator", + "noUser": "no user", + "orgIcon": { + "large": "Large Organization Icon", + "small": "Small Organization Icon" + }, "position": { "endorse":"The author of the submitted testimony endorses the bill.", "neutral":"The author of the submitted testimony is neutral towards the bill.", @@ -33,12 +32,14 @@ "profileMenu": "Open/Close Profile Menu", "representative": "Representative", "senator": "Senator", - "orgIcon": { - "large": "Large Organization Icon", - "small": "Small Organization Icon" - }, + "user": "User", "userIcon": { "large": "Large User Icon", "small": "Small User Icon" + }, + "verifyAccountSection":{ + "verifyAccount": "We sent a link to your email to verify your account, but you haven't\nclicked it yet. If you don't see it, be sure to check your spam\nfolder.", + "checkEmail": "Check your email!", + "sendAnotherLink": "Send Another Link" } } From 833d4a6493961901bd57a4985bc05726fb307a10 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Wed, 6 May 2026 11:36:06 -0400 Subject: [PATCH 14/15] cleanup --- public/locales/en/profile.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/en/profile.json b/public/locales/en/profile.json index 6e0dba5fb..c2e143d40 100644 --- a/public/locales/en/profile.json +++ b/public/locales/en/profile.json @@ -37,7 +37,7 @@ "large": "Large User Icon", "small": "Small User Icon" }, - "verifyAccountSection":{ + "verifyAccountSection": { "verifyAccount": "We sent a link to your email to verify your account, but you haven't\nclicked it yet. If you don't see it, be sure to check your spam\nfolder.", "checkEmail": "Check your email!", "sendAnotherLink": "Send Another Link" From a84066bab2632e000cf40eb324018d0bf1e46e36 Mon Sep 17 00:00:00 2001 From: mertbagt Date: Wed, 6 May 2026 11:39:01 -0400 Subject: [PATCH 15/15] cleanup2 --- public/locales/en/profile.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/locales/en/profile.json b/public/locales/en/profile.json index c2e143d40..fca924cbb 100644 --- a/public/locales/en/profile.json +++ b/public/locales/en/profile.json @@ -4,17 +4,17 @@ "anonymousUser": "Anonymous User", "button":{ "editProfile": "Edit\u00A0Profile", - "notficationFrequencyDropdown": "open envelope with letter, toggles update frequency options", "follow" : "Follow", "followedContent": "Followed Content", "following" : "Following", + "notficationFrequencyDropdown": "open envelope with letter, toggles update frequency options", "yourTestimonies": "Your Testimonies" }, "content": { - "viewingProfile": "Currently viewing your profile", - "publicProfile": "Your profile is currently public. You can change this in \"settings\"", + "noLegislatorInfo": "No legislator information given", "privateProfile": "Your profile is currently private. You can change this in \"settings\"", - "noLegislatorInfo": "No legislator information given" + "publicProfile": "Your profile is currently public. You can change this in \"settings\"", + "viewingProfile": "Currently viewing your profile" }, "joinDate": "Joined in {{date}}", "legislators": "Legislators", @@ -38,8 +38,8 @@ "small": "Small User Icon" }, "verifyAccountSection": { - "verifyAccount": "We sent a link to your email to verify your account, but you haven't\nclicked it yet. If you don't see it, be sure to check your spam\nfolder.", "checkEmail": "Check your email!", - "sendAnotherLink": "Send Another Link" + "sendAnotherLink": "Send Another Link", + "verifyAccount": "We sent a link to your email to verify your account, but you haven't\nclicked it yet. If you don't see it, be sure to check your spam\nfolder." } }