diff --git a/components/AlertCard/AlertCard.tsx b/components/AlertCard/AlertCard.tsx index a4ead2015..17dfeece4 100644 --- a/components/AlertCard/AlertCard.tsx +++ b/components/AlertCard/AlertCard.tsx @@ -1,7 +1,7 @@ -import { CardTitle } from "components/Card" +import { CardTitle, CardTitleV2 } from "components/Card" import { Timestamp } from "firebase/firestore" import { Card as MapleCard } from "../Card/Card" -import { AlertCardBody } from "./AlertCardBody" +import { AlertCardBody, AlertCardBodyV2 } from "./AlertCardBody" export const AlertCard = (props: { header: string @@ -35,3 +35,42 @@ export const AlertCard = (props: { return } + +// newsfeed bill card +export const AlertCardV2 = (props: { + court: string + header: string + subheader: string + timestamp: Timestamp + headerImgSrc: string + headerImgTitle?: string + bodyImgSrc: string + bodyImgAltTxt: string + bodyText: string + isBillMatch: boolean +}) => { + const date = props.timestamp.toDate() + const formattedTimestamp = `${date.toLocaleDateString()}` + const header = ( + + ) + + const body = ( + + ) + + return +} diff --git a/components/AlertCard/AlertCardBody.tsx b/components/AlertCard/AlertCardBody.tsx index 15612489e..c520330f3 100644 --- a/components/AlertCard/AlertCardBody.tsx +++ b/components/AlertCard/AlertCardBody.tsx @@ -1,10 +1,18 @@ import { ReactElement } from "react" import CardBootstrap from "react-bootstrap/Card" +import styled from "styled-components" +import { Col, Row, Spinner } from "../bootstrap" +import { Timestamp } from "firebase/firestore" + +const AlertCardInnerBodyV2 = styled.div` + background-color: #d1d6e7; +` interface AlertCardBodyProps { imgSrc?: string imgAltTxt?: string text: string + timestamp?: string } export const AlertCardBody = (props: AlertCardBodyProps) => { @@ -18,3 +26,33 @@ export const AlertCardBody = (props: AlertCardBodyProps) => { ) } + +export const AlertCardBodyV2 = (props: AlertCardBodyProps) => { + const { imgSrc, imgAltTxt, text, timestamp } = props + return ( +
+ + + {imgAltTxt} + + + {text} + + <> + {"Action taken on "} + {timestamp} + + + + +
+ ) +} diff --git a/components/Card/CardTitle.tsx b/components/Card/CardTitle.tsx index 81dda235a..2c06a8eeb 100644 --- a/components/Card/CardTitle.tsx +++ b/components/Card/CardTitle.tsx @@ -1,13 +1,32 @@ +import { collection, getDocs, query, where } from "firebase/firestore" +import { getFunctions, httpsCallable } from "firebase/functions" +import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { ReactElement } from "react" import CardBootstrap from "react-bootstrap/Card" +import { formatBillId } from "components/formatting" + +import { useTranslation } from "next-i18next" +import { useAuth } from "../auth" +import { Stack } from "../bootstrap" +import { firestore } from "../firebase" +import { TitledSectionCard } from "../shared" + +import { + BillElement, + UserElement +} from "components/EditProfilePage/FollowingTabComponents" +import { is } from "date-fns/locale" interface CardTitleProps { + court?: string header?: string subheader?: string timestamp?: string imgSrc?: string imgTitle?: string inHeaderElement?: ReactElement + isBillMatch?: boolean + isUserMatch?: boolean } export const CardTitle = (props: CardTitleProps) => { @@ -42,3 +61,59 @@ export const CardTitle = (props: CardTitleProps) => { ) } + +// newsfeed bill card title +export const CardTitleV2 = (props: CardTitleProps) => { + const { + court, + header, + subheader, + timestamp, + imgSrc, + imgTitle, + inHeaderElement, + isBillMatch + } = props + const { t } = useTranslation("common") + + return ( + +
+ {imgSrc && } +
+ + {header && ( + + + {formatBillId(header)} + {" "} + {subheader ? ( + <> + {t("newsfeed.action_update")} + {subheader} + + ) : ( + <> + )} + + )} + {header ? ( + + {header && isBillMatch ? ( + <>{t("newsfeed.follow")} + ) : ( + <>{t("newsfeed.not_follow")} + )} + {formatBillId(header)} + + ) : ( + <> + )} + +
+ ) +} diff --git a/components/DesktopNav.tsx b/components/DesktopNav.tsx index 458f6c544..b2b69f6ee 100644 --- a/components/DesktopNav.tsx +++ b/components/DesktopNav.tsx @@ -1,3 +1,4 @@ +import { useFlags } from "components/featureFlags" import { useTranslation } from "next-i18next" import React from "react" import { SignInWithButton, signOutAndRedirectToHome, useAuth } from "./auth" @@ -12,6 +13,7 @@ import { NavbarLinkFAQ, NavbarLinkGoals, NavbarLinkLogo, + NavbarLinkNewsfeed, NavbarLinkProcess, NavbarLinkSignOut, NavbarLinkSupport, @@ -23,6 +25,7 @@ import { export const DesktopNav: React.FC> = () => { const { authenticated } = useAuth() + const { notifications } = useFlags() const { t } = useTranslation(["common", "auth"]) return ( @@ -47,6 +50,16 @@ export const DesktopNav: React.FC> = () => { + {authenticated && notifications ? ( +
+ +
+ ) : ( + <> + )} +
diff --git a/components/Footer/Footer.tsx b/components/Footer/Footer.tsx index be24bd7d5..7212b2f1e 100644 --- a/components/Footer/Footer.tsx +++ b/components/Footer/Footer.tsx @@ -154,6 +154,9 @@ const AccountLinks = ({ authenticated, user, signOut }: PageFooterProps) => { > {t("navigation.accountProfile")} + + {t("navigation.newsfeed")} + signOut()}> {t("signOut", { ns: "auth" })} diff --git a/components/MobileNav.tsx b/components/MobileNav.tsx index 68b106519..cb3432366 100644 --- a/components/MobileNav.tsx +++ b/components/MobileNav.tsx @@ -1,3 +1,4 @@ +import { useFlags } from "components/featureFlags" import { useTranslation } from "next-i18next" import React, { useState } from "react" import Image from "react-bootstrap/Image" @@ -13,6 +14,7 @@ import { NavbarLinkFAQ, NavbarLinkGoals, NavbarLinkLogo, + NavbarLinkNewsfeed, NavbarLinkProcess, NavbarLinkSignOut, NavbarLinkSupport, @@ -64,6 +66,11 @@ export const MobileNav: React.FC> = () => {