Skip to content

Commit

Permalink
PROD Deploy 1/27 (#1688)
Browse files Browse the repository at this point in the history
* Create adminPage test

* Admin account sign in

* Setup login to admin account and create no user report test

* Setting admin account

* Update yarn.lock adn package.json

* Add icon display test

* Add e2e test for admin page

* Add sorting, user reports and upgrade requests page test

* Merged with upstream main

* modified follow button to prevent navigating to another page

* Make test serial and rewrite reslove report test

* LLM summarization and tagging features added

* Added readme.md file

* fixed follow button to accurately show following or not

* Remove setup from playwright congig and delte the auth file

* Run prettier

* Update llm/demo_app_functions.py

Co-authored-by: Nathan E. Sanders <[email protected]>

* Update llm/demo_app_functions.py

Co-authored-by: Nathan E. Sanders <[email protected]>

* Update llm/readme.md

Co-authored-by: Nathan E. Sanders <[email protected]>

* Update llm/readme.md

Co-authored-by: Nathan E. Sanders <[email protected]>

* Update llm/readme.md

Co-authored-by: Nathan E. Sanders <[email protected]>

* Update llm/readme.md

Co-authored-by: Nathan E. Sanders <[email protected]>

* Merged changes from remote to local

* Changed the file names as per code review

* Added necessary instrcutions for openAI API key

* Updated requirements.txt file

* Move the credentials to .env

* fixed the follow button on the bill details page

* Adding topics to bills to prep for LLM data, Hard-coding the category -> topic map because that should be frozen as a product decision, Updating search indexing for bills to hydrate topic categories and properly format the bill topics so they can be used in the front-end by the Instantsearch hierarchical menu widget

* Added python version in readme.md file

* Added more detailed explanation on why we chunk with a length of 2000

* Updating topics and categories to reflect the finalized assignments, making capitalization consistent across topics, making topics an optional field across both Bill data types

* Extracting category/topic building to helper function, fixing type error

* Adding base summary field to bill models

* Adding kiminkim724 as CODEOWNER

* Add .env.example and Updated README with instructions

* Update README

* Update README

* Extracting PaginationButtons for translation

* Extracting translatable strings from HearingsScheduled component

* Extracting translation strings from Legislative Process learn page

* Extracting strings from Testimony Panel CTAs

* Extracting translation strings for YourTestimony component

* Extracting strings for translation for ThankYouModal

* Using translated string for EditTestimonyButton tooltip

* Extracting translation strings from SubmitTestimonyForm

* Extracting translatable strings from ChooseStance component

* Extracting translatable strings for SelectLegislatorsCta component

* Extracting translatable strings for KeepNote component

* Extracting translatable strings from WriteTestimony component in publish flow

* Capitalizing all headers for legislative process learn page per PR feedback

* Update publishNotifications to include Bill History Updates

* Added 2 new API functions, one to generate summaries and tags using summaries combined and the second one is to generate only tags using summaries

* Updated prettierignore to ignore llm directory for Prettier check

* Bill Topic Updates (#1647)

* Switching bill topic format per dev feedback, extracting topic parser for later use, adding unit tests for topic parser

* Prettier fixes

* Llm bill summary (#1645)

* initial dividers

* translations for literal strings

* update common.json

* mobile sizing for smart summary

* smart disclaimer

* feature flagging

* smart tags

* mobile pruning

* cleanup

* cleaned up old court banner translation

* added icon files

* remaining icons

* nowrap enforced on SmartTagButton to fix firefox issue

* switch smart-summary image from png to svg and moved to subfolder

* cleanup common.json

* translation

* navigation

* footer

* added auth translation file to newsfeed page

* adjust filter positioning

* newsfeed bill card work

* bill card almost done

* polished newsfeed bill card

* enable follow organizations tab display

* userLookup

* Create notificationEvent on BillHistory Updates (#1648)

* Create notificationEvent on BillHistory Updates

* Add authorUid

* Updated Notification types to be more explicit with possible undefined fields

* Add useState

* fix following button

* isBillMatch

* reminder to clean out old code

* cleanup

* upgrade Profile page to use new follow context

* cleanup

* change Orgs -> Users You Follow

* renamed components

* update stories to new naming scheme

* testimony card title

* cleanup

* fixed broken Bill Updates filter

* testimony card body basic

* cleaned up NewsfeedCard

* fixed stories

* mobile spacing

* adjust mobile breakpoint

* cleanup

* refactored CardTitle using switch

* Update firestore indexes to include topicName

* Added notification fields on back-end to supply more information to Newsfeed

* Make the Notification types more explicit for Testimony vs Bill History notifications (#1659)

* Make the notification return type more explicit

* Added billId field to types

* Fix lint

* Revert ignoreUndefinedProperties

* updated testimony author link

* cleanup

* cleanup props

* prop cleanup

* bill notifications updated

* replaced header with billId on CardTitleFollowing

* more cleanup

* updated stories

* polish

* translations

* Follow btn individual users (#1654)

* feat: follow buttons for individual users

* fix: remove second follow user button

* fix: user cannot follow their own testimony hit

* fix: rn prettier

* link to Edit Profile - Following Tab

* mobile nav link

* cleanup

* removed useless code line

* removed more useless code

* fixed mobile nav double light up bug

* dev comments

* combined navbar files

* move social info to own row

* added FollowedContent and YourTestimonies buttons

* connected SettingsModal to View Profile page

* recolored buttons

* bug fix

* cleaned up integration tests

* updated stories

* deactivated ProfileHeader story - to be updated later

* updated ProfileSettingsModal story

* updated personalInfoTal.stories

* updated EditProfilePage.stories

* cleanup

* fixed modal not updating after save

* cleanup

* cleanup

* fixed Edit Profile button to link to correct tab

* deactivated outdated stories

* resized Edit Profile button

* fix: hide follow btn for logged out users bill detail pg

* Used query instead of function in Firebase

* Remove unused imports and functions

* fix: ran prettier

* count fixed (#1673)

* count fixed

* Forgot to commit changes before push

* 1607 add llm genrated tag (#1655)

* add hierarchicalMenu(fake data)

* Update HierarchialMenu

* Update menu with llm data

* Create useHierarchicalMenu and fix add padding to the left of child

* Craete a customize HierarchicalMenuWidget

* update css for llm tag menu

* Delete the parent counting and sort parent Alphabetical

* Baypass typesense error

* Delete the algoliasearch dependncy

* Add Col to testimony Search

* Add refinement

* Implement sorting logic for llm tags display

* Extract the subtitle for filter tags

* Add updated facets into getItems and remove redinment from useHierarachicalMenu

* Run prettier

* Change the iteration and detelet the downlevelIteration

* Add filter to getWidgetSearchParameter

* Newsfeed Content Buttons (#1672)

* newsfeed content buttons

* repositioned newsfeed buttons

* added prop on ProfileHeader

* added / to image src (#1678)

* added / to image src

* cleanup

* typo

* feat: bill follow and unfollow functionality to testimony page (#1661)

* feat: bill follow and unfollow functionality to testimony page

* ran prettier

* fix: remove unnecesary code

* fix: run linter

---------

Co-authored-by: Merritt Baggett <[email protected]>

* V2 style copy updates (#1680)

* undo main commit

* fix: v2 styple copy and updates

* feat: fixed hyperlink and summary

* feat: fixed hyperlink and summary

* fix: remove summary spacing

* Add HierarchicalMenu after InstantSearch initialize (#1684)

* Add HierarchicalMenu after InstantSearch initialize

* Run prettier

* removed obsolete spinner (#1686)

---------

Co-authored-by: huanfeng <[email protected]>
Co-authored-by: LauraUmana <[email protected]>
Co-authored-by: pranay8297 <[email protected]>
Co-authored-by: Nathan E. Sanders <[email protected]>
Co-authored-by: huanfeng <[email protected]>
Co-authored-by: kiminkim724 <[email protected]>
Co-authored-by: Kimin Kim <[email protected]>
Co-authored-by: mertbagt <[email protected]>
Co-authored-by: Merritt Baggett <[email protected]>
Co-authored-by: Aaron <[email protected]>
Co-authored-by: aerhartic <[email protected]>
Co-authored-by: ananyasinghz <[email protected]>
Co-authored-by: Huanfeng <[email protected]>
  • Loading branch information
14 people authored Jan 28, 2025
1 parent f831b60 commit b55dc07
Show file tree
Hide file tree
Showing 131 changed files with 6,230 additions and 1,039 deletions.
4 changes: 4 additions & 0 deletions .env.example
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/playwright-report/
/blob-report/
/playwright/.cache/
.env

.next/
.eslintcache
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ analysis/data
dist
*.handlebars
coverage
storybook-static
storybook-static
llm
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,25 @@ Install the [Redux DevTools](https://chrome.google.com/webstore/detail/redux-dev

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

To start running tests, use one of the following commands:
Environment Setup for Testing.

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:

```
cp .env.example .env
```

This file includes placeholders for key environment variables, which you should customize as needed:

```
TEST_ADMIN_USERNAME: Username for admin testing.
TEST_ADMIN_PASSWORD: Password for admin testing.
APP_API_URL: The base URL for the application API (default is http://localhost:3000).
```

Running Tests.

Once your environment is set up, you can start running tests with one of the following commands:

- `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.
- `yarn test:e2e`: Run e2e tests in `tests/e2e` with the Playwright UI
Expand Down
2 changes: 1 addition & 1 deletion components/AboutSectionInfoCard/AboutInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function AboutInfoCard({ title, bodytext }: AboutInfoCardProps) {
<Card className="h-100 bg-white">
<StyledCardHeader
forwardedAs="h3"
className="text-center align-self-center bg-info text-white rounded-0 border-0 mb-n3 overflow-visible"
className="text-center align-self-center bg-warning text-white rounded-0 border-0 mb-n3 overflow-visible"
>
{title}
</StyledCardHeader>
Expand Down
37 changes: 0 additions & 37 deletions components/AlertCard/AlertCard.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions components/AlertCard/AlertCardBody.tsx

This file was deleted.

222 changes: 195 additions & 27 deletions components/Card/CardTitle.tsx
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>
)
}
}
Loading

0 comments on commit b55dc07

Please sign in to comment.