-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit dd50ae9.
- Loading branch information
Showing
131 changed files
with
6,230 additions
and
1,039 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Environment Variables for Local Development | ||
TEST_ADMIN_USERNAME=[email protected] | ||
TEST_ADMIN_PASSWORD=your_admin_password | ||
APP_API_URL=http://localhost:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* @sashamaryl @mertbagt @nesanders @mvictor55 @timblais @alexjball @Mephistic | ||
* @sashamaryl @mertbagt @nesanders @mvictor55 @timblais @alexjball @Mephistic @kiminkim724 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
.env | ||
|
||
.next/ | ||
.eslintcache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ analysis/data | |
dist | ||
*.handlebars | ||
coverage | ||
storybook-static | ||
storybook-static | ||
llm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,212 @@ | ||
import { useTranslation } from "next-i18next" | ||
import { ReactElement } from "react" | ||
import CardBootstrap from "react-bootstrap/Card" | ||
import { formatBillId } from "components/formatting" | ||
import { Internal } from "components/links" | ||
|
||
interface CardTitleProps { | ||
authorUid?: string | ||
billId?: string | ||
court?: string | ||
header?: string | ||
subheader?: string | ||
timestamp?: string | ||
imgSrc?: string | ||
imgTitle?: string | ||
inHeaderElement?: ReactElement | ||
isBillMatch?: boolean | ||
isUserMatch?: boolean | ||
type?: string | ||
userRole?: string | ||
} | ||
|
||
export const CardTitle = (props: CardTitleProps) => { | ||
const { header, subheader, timestamp, imgSrc, imgTitle, inHeaderElement } = | ||
props | ||
const { | ||
authorUid, | ||
billId, | ||
court, | ||
header, | ||
isBillMatch, | ||
isUserMatch, | ||
subheader, | ||
type, | ||
userRole | ||
} = props | ||
|
||
return ( | ||
<CardBootstrap.Body | ||
className={`align-items-center bg-secondary d-flex text-white`} | ||
> | ||
<div className="justify-content-middle d-flex flex-column align-items-center"> | ||
{imgSrc && <img alt="" src={imgSrc} width="75" height="75" />} | ||
<div className="mt-1">{imgTitle}</div> | ||
</div> | ||
<CardBootstrap.Body> | ||
{header && ( | ||
<CardBootstrap.Title className={`fs-4 lh-sm mb-1`}> | ||
{header} | ||
</CardBootstrap.Title> | ||
)} | ||
{subheader && ( | ||
<CardBootstrap.Text className={`fs-5 lh-sm mb-1`}> | ||
{subheader} | ||
</CardBootstrap.Text> | ||
)} | ||
{timestamp && ( | ||
<CardBootstrap.Text className={`fs-6 lh-sm`}> | ||
{timestamp} | ||
</CardBootstrap.Text> | ||
)} | ||
<CardBootstrap.Body className={`align-items-center d-flex px-2 pt-2 pb-0`}> | ||
<CardHeaderImg type={type} userRole={userRole} /> | ||
<CardBootstrap.Body className="px-3 py-0"> | ||
<CardTitleHeadline | ||
authorUid={authorUid} | ||
billId={billId} | ||
court={court} | ||
header={header} | ||
subheader={subheader} | ||
type={type} | ||
/> | ||
<CardTitleFollowing | ||
billId={billId} | ||
header={header} | ||
subheader={subheader} | ||
isBillMatch={isBillMatch} | ||
isUserMatch={isUserMatch} | ||
type={type} | ||
/> | ||
</CardBootstrap.Body> | ||
{inHeaderElement && inHeaderElement} | ||
</CardBootstrap.Body> | ||
) | ||
} | ||
|
||
const CardHeaderImg = (props: CardTitleProps) => { | ||
const { type, userRole } = props | ||
|
||
let avatar = `individualUser.svg` | ||
if (userRole == `organization`) { | ||
avatar = `OrganizationUser.svg` | ||
} | ||
|
||
switch (type) { | ||
case "testimony": | ||
return ( | ||
<div className="justify-content-middle d-flex flex-column align-items-center"> | ||
<img alt="capitol building" src={avatar} width="32" height="32" /> | ||
</div> | ||
) | ||
case "bill": | ||
return ( | ||
<div className="justify-content-middle d-flex flex-column align-items-center"> | ||
<img | ||
alt="capitol building" | ||
src={`/images/bill-capitol.svg`} | ||
width="32" | ||
height="32" | ||
/> | ||
</div> | ||
) | ||
default: | ||
return <></> | ||
} | ||
} | ||
|
||
const CardTitleHeadline = (props: CardTitleProps) => { | ||
const { authorUid, billId, court, header, subheader, type } = props | ||
const { t } = useTranslation("common") | ||
|
||
switch (type) { | ||
case "testimony": | ||
return ( | ||
<> | ||
{header && subheader && ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-secondary`} | ||
> | ||
<Internal href={`/profile?id=${authorUid}`}> | ||
<strong>{subheader}</strong> | ||
</Internal> | ||
|
||
{t("newsfeed.endorsed")} | ||
<a href={`/bills/${court}/${billId}`}> | ||
{billId && <strong>{formatBillId(billId)}</strong>} | ||
</a> | ||
</CardBootstrap.Title> | ||
)} | ||
</> | ||
) | ||
case "bill": | ||
return ( | ||
<> | ||
{header && ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-secondary`} | ||
> | ||
{billId && ( | ||
<a href={`/bills/${court}/${billId}`}> | ||
<strong>{formatBillId(billId)}</strong> | ||
</a> | ||
)}{" "} | ||
{subheader && ( | ||
<> | ||
{t("newsfeed.actionUpdate")} | ||
{subheader} | ||
</> | ||
)} | ||
</CardBootstrap.Title> | ||
)} | ||
</> | ||
) | ||
default: | ||
return ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-secondary`} | ||
> | ||
<strong>{header}</strong> | ||
</CardBootstrap.Title> | ||
) | ||
} | ||
} | ||
|
||
const CardTitleFollowing = (props: CardTitleProps) => { | ||
const { billId, header, isBillMatch, isUserMatch, subheader, type } = props | ||
const { t } = useTranslation("common") | ||
|
||
if (type == ``) { | ||
return <></> | ||
} else if (type === `bill`) { | ||
return ( | ||
<> | ||
{header && ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`} | ||
> | ||
{isBillMatch ? ( | ||
<>{t("newsfeed.follow")}</> | ||
) : ( | ||
<>{t("newsfeed.notFollow")}</> | ||
)} | ||
{billId && <strong>{formatBillId(billId)}</strong>} | ||
</CardBootstrap.Title> | ||
)} | ||
</> | ||
) | ||
} else if (isBillMatch && isUserMatch) { | ||
return ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`} | ||
> | ||
{t("newsfeed.follow")} | ||
{billId && <strong>{formatBillId(billId)}</strong>} | ||
{t("newsfeed.and")} | ||
{subheader} | ||
</CardBootstrap.Title> | ||
) | ||
} else if (isBillMatch === true && isUserMatch === false) { | ||
return ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`} | ||
> | ||
{t("newsfeed.follow")} | ||
{billId && <strong>{formatBillId(billId)}</strong>} | ||
</CardBootstrap.Title> | ||
) | ||
} else if (isBillMatch === false && isUserMatch === true) { | ||
return ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`} | ||
> | ||
{t("newsfeed.follow")} | ||
{subheader} | ||
</CardBootstrap.Title> | ||
) | ||
} else { | ||
return ( | ||
<CardBootstrap.Title | ||
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`} | ||
> | ||
{t("newsfeed.notFollowEither")} | ||
{billId && <strong>{formatBillId(billId)}</strong>} | ||
{t("newsfeed.or")} | ||
{subheader} | ||
</CardBootstrap.Title> | ||
) | ||
} | ||
} |
Oops, something went wrong.