Skip to content

Commit dd50ae9

Browse files
authored
Revert "PROD Deploy 1/27 (#1688)" (#1689)
This reverts commit b55dc07.
1 parent b55dc07 commit dd50ae9

File tree

131 files changed

+1039
-6230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1039
-6230
lines changed

.env.example

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @sashamaryl @mertbagt @nesanders @mvictor55 @timblais @alexjball @Mephistic @kiminkim724
1+
* @sashamaryl @mertbagt @nesanders @mvictor55 @timblais @alexjball @Mephistic

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
/playwright-report/
1515
/blob-report/
1616
/playwright/.cache/
17-
.env
1817

1918
.next/
2019
.eslintcache

.prettierignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ analysis/data
1212
dist
1313
*.handlebars
1414
coverage
15-
storybook-static
16-
llm
15+
storybook-static

README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,7 @@ Install the [Redux DevTools](https://chrome.google.com/webstore/detail/redux-dev
7979

8080
MAPLE uses Jest for unit and integration testing, and Playwright for e2e testing.
8181

82-
Environment Setup for Testing.
83-
84-
To set up your environment for testing, make sure you have a .env file configured with the necessary variables. You can create it by copying the provided .env.example template:
85-
86-
```
87-
cp .env.example .env
88-
```
89-
90-
This file includes placeholders for key environment variables, which you should customize as needed:
91-
92-
```
93-
TEST_ADMIN_USERNAME: Username for admin testing.
94-
TEST_ADMIN_PASSWORD: Password for admin testing.
95-
APP_API_URL: The base URL for the application API (default is http://localhost:3000).
96-
```
97-
98-
Running Tests.
99-
100-
Once your environment is set up, you can start running tests with one of the following commands:
82+
To start running tests, use one of the following commands:
10183

10284
- `yarn test:integration [--watch] [-t testNamePattern] [my/feature.test.ts]`: Run integration tests in `components/` and `tests/integration/`. These tests run against the full local application -- start it with `yarn up`. You can use `--watch` to rerun your tests as you change them and filter by test name and file.
10385
- `yarn test:e2e`: Run e2e tests in `tests/e2e` with the Playwright UI

components/AboutSectionInfoCard/AboutInfoCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function AboutInfoCard({ title, bodytext }: AboutInfoCardProps) {
2121
<Card className="h-100 bg-white">
2222
<StyledCardHeader
2323
forwardedAs="h3"
24-
className="text-center align-self-center bg-warning text-white rounded-0 border-0 mb-n3 overflow-visible"
24+
className="text-center align-self-center bg-info text-white rounded-0 border-0 mb-n3 overflow-visible"
2525
>
2626
{title}
2727
</StyledCardHeader>

components/AlertCard/AlertCard.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { CardTitle } from "components/Card"
2+
import { Timestamp } from "firebase/firestore"
3+
import { Card as MapleCard } from "../Card/Card"
4+
import { AlertCardBody } from "./AlertCardBody"
5+
6+
export const AlertCard = (props: {
7+
header: string
8+
subheader: string
9+
timestamp: Timestamp
10+
headerImgSrc: string
11+
headerImgTitle?: string
12+
bodyImgSrc: string
13+
bodyImgAltTxt: string
14+
bodyText: string
15+
}) => {
16+
const date = props.timestamp.toDate()
17+
const formattedTimestamp = `${date.toLocaleDateString()}, ${date.toLocaleTimeString()}`
18+
const header = (
19+
<CardTitle
20+
header={props.header}
21+
subheader={props.subheader}
22+
timestamp={formattedTimestamp}
23+
imgSrc={props.headerImgSrc}
24+
imgTitle={props.headerImgTitle ?? ""}
25+
/>
26+
)
27+
28+
const body = (
29+
<AlertCardBody
30+
imgSrc={props.bodyImgSrc}
31+
imgAltTxt={props.bodyImgAltTxt}
32+
text={props.bodyText}
33+
/>
34+
)
35+
36+
return <MapleCard headerElement={header} body={body} />
37+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { ReactElement } from "react"
2+
import CardBootstrap from "react-bootstrap/Card"
3+
4+
interface AlertCardBodyProps {
5+
imgSrc?: string
6+
imgAltTxt?: string
7+
text: string
8+
}
9+
10+
export const AlertCardBody = (props: AlertCardBodyProps) => {
11+
const { imgSrc, imgAltTxt, text } = props
12+
return (
13+
<div>
14+
{imgSrc && <img src={imgSrc} width="100%" alt={imgAltTxt}></img>}
15+
<CardBootstrap.Body>
16+
<CardBootstrap.Text>{text}</CardBootstrap.Text>
17+
</CardBootstrap.Body>
18+
</div>
19+
)
20+
}

components/Card/CardTitle.tsx

Lines changed: 27 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -1,212 +1,44 @@
1-
import { useTranslation } from "next-i18next"
21
import { ReactElement } from "react"
32
import CardBootstrap from "react-bootstrap/Card"
4-
import { formatBillId } from "components/formatting"
5-
import { Internal } from "components/links"
63

74
interface CardTitleProps {
8-
authorUid?: string
9-
billId?: string
10-
court?: string
115
header?: string
126
subheader?: string
137
timestamp?: string
148
imgSrc?: string
9+
imgTitle?: string
1510
inHeaderElement?: ReactElement
16-
isBillMatch?: boolean
17-
isUserMatch?: boolean
18-
type?: string
19-
userRole?: string
2011
}
2112

2213
export const CardTitle = (props: CardTitleProps) => {
23-
const {
24-
authorUid,
25-
billId,
26-
court,
27-
header,
28-
isBillMatch,
29-
isUserMatch,
30-
subheader,
31-
type,
32-
userRole
33-
} = props
34-
14+
const { header, subheader, timestamp, imgSrc, imgTitle, inHeaderElement } =
15+
props
3516
return (
36-
<CardBootstrap.Body className={`align-items-center d-flex px-2 pt-2 pb-0`}>
37-
<CardHeaderImg type={type} userRole={userRole} />
38-
<CardBootstrap.Body className="px-3 py-0">
39-
<CardTitleHeadline
40-
authorUid={authorUid}
41-
billId={billId}
42-
court={court}
43-
header={header}
44-
subheader={subheader}
45-
type={type}
46-
/>
47-
<CardTitleFollowing
48-
billId={billId}
49-
header={header}
50-
subheader={subheader}
51-
isBillMatch={isBillMatch}
52-
isUserMatch={isUserMatch}
53-
type={type}
54-
/>
55-
</CardBootstrap.Body>
56-
</CardBootstrap.Body>
57-
)
58-
}
59-
60-
const CardHeaderImg = (props: CardTitleProps) => {
61-
const { type, userRole } = props
62-
63-
let avatar = `individualUser.svg`
64-
if (userRole == `organization`) {
65-
avatar = `OrganizationUser.svg`
66-
}
67-
68-
switch (type) {
69-
case "testimony":
70-
return (
71-
<div className="justify-content-middle d-flex flex-column align-items-center">
72-
<img alt="capitol building" src={avatar} width="32" height="32" />
73-
</div>
74-
)
75-
case "bill":
76-
return (
77-
<div className="justify-content-middle d-flex flex-column align-items-center">
78-
<img
79-
alt="capitol building"
80-
src={`/images/bill-capitol.svg`}
81-
width="32"
82-
height="32"
83-
/>
84-
</div>
85-
)
86-
default:
87-
return <></>
88-
}
89-
}
90-
91-
const CardTitleHeadline = (props: CardTitleProps) => {
92-
const { authorUid, billId, court, header, subheader, type } = props
93-
const { t } = useTranslation("common")
94-
95-
switch (type) {
96-
case "testimony":
97-
return (
98-
<>
99-
{header && subheader && (
100-
<CardBootstrap.Title
101-
className={`align-items-start fs-6 lh-sm mb-1 text-secondary`}
102-
>
103-
<Internal href={`/profile?id=${authorUid}`}>
104-
<strong>{subheader}</strong>
105-
</Internal>
106-
107-
{t("newsfeed.endorsed")}
108-
<a href={`/bills/${court}/${billId}`}>
109-
{billId && <strong>{formatBillId(billId)}</strong>}
110-
</a>
111-
</CardBootstrap.Title>
112-
)}
113-
</>
114-
)
115-
case "bill":
116-
return (
117-
<>
118-
{header && (
119-
<CardBootstrap.Title
120-
className={`align-items-start fs-6 lh-sm mb-1 text-secondary`}
121-
>
122-
{billId && (
123-
<a href={`/bills/${court}/${billId}`}>
124-
<strong>{formatBillId(billId)}</strong>
125-
</a>
126-
)}{" "}
127-
{subheader && (
128-
<>
129-
{t("newsfeed.actionUpdate")}
130-
{subheader}
131-
</>
132-
)}
133-
</CardBootstrap.Title>
134-
)}
135-
</>
136-
)
137-
default:
138-
return (
139-
<CardBootstrap.Title
140-
className={`align-items-start fs-6 lh-sm mb-1 text-secondary`}
141-
>
142-
<strong>{header}</strong>
143-
</CardBootstrap.Title>
144-
)
145-
}
146-
}
147-
148-
const CardTitleFollowing = (props: CardTitleProps) => {
149-
const { billId, header, isBillMatch, isUserMatch, subheader, type } = props
150-
const { t } = useTranslation("common")
151-
152-
if (type == ``) {
153-
return <></>
154-
} else if (type === `bill`) {
155-
return (
156-
<>
17+
<CardBootstrap.Body
18+
className={`align-items-center bg-secondary d-flex text-white`}
19+
>
20+
<div className="justify-content-middle d-flex flex-column align-items-center">
21+
{imgSrc && <img alt="" src={imgSrc} width="75" height="75" />}
22+
<div className="mt-1">{imgTitle}</div>
23+
</div>
24+
<CardBootstrap.Body>
15725
{header && (
158-
<CardBootstrap.Title
159-
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`}
160-
>
161-
{isBillMatch ? (
162-
<>{t("newsfeed.follow")}</>
163-
) : (
164-
<>{t("newsfeed.notFollow")}</>
165-
)}
166-
{billId && <strong>{formatBillId(billId)}</strong>}
26+
<CardBootstrap.Title className={`fs-4 lh-sm mb-1`}>
27+
{header}
16728
</CardBootstrap.Title>
16829
)}
169-
</>
170-
)
171-
} else if (isBillMatch && isUserMatch) {
172-
return (
173-
<CardBootstrap.Title
174-
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`}
175-
>
176-
{t("newsfeed.follow")}
177-
{billId && <strong>{formatBillId(billId)}</strong>}
178-
{t("newsfeed.and")}
179-
{subheader}
180-
</CardBootstrap.Title>
181-
)
182-
} else if (isBillMatch === true && isUserMatch === false) {
183-
return (
184-
<CardBootstrap.Title
185-
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`}
186-
>
187-
{t("newsfeed.follow")}
188-
{billId && <strong>{formatBillId(billId)}</strong>}
189-
</CardBootstrap.Title>
190-
)
191-
} else if (isBillMatch === false && isUserMatch === true) {
192-
return (
193-
<CardBootstrap.Title
194-
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`}
195-
>
196-
{t("newsfeed.follow")}
197-
{subheader}
198-
</CardBootstrap.Title>
199-
)
200-
} else {
201-
return (
202-
<CardBootstrap.Title
203-
className={`align-items-start fs-6 lh-sm mb-1 text-body-tertiary`}
204-
>
205-
{t("newsfeed.notFollowEither")}
206-
{billId && <strong>{formatBillId(billId)}</strong>}
207-
{t("newsfeed.or")}
208-
{subheader}
209-
</CardBootstrap.Title>
210-
)
211-
}
30+
{subheader && (
31+
<CardBootstrap.Text className={`fs-5 lh-sm mb-1`}>
32+
{subheader}
33+
</CardBootstrap.Text>
34+
)}
35+
{timestamp && (
36+
<CardBootstrap.Text className={`fs-6 lh-sm`}>
37+
{timestamp}
38+
</CardBootstrap.Text>
39+
)}
40+
</CardBootstrap.Body>
41+
{inHeaderElement && inHeaderElement}
42+
</CardBootstrap.Body>
43+
)
21244
}

0 commit comments

Comments
 (0)