Skip to content

Commit 6e24365

Browse files
authored
Merge pull request #1826 from codeforboston/main
PROD Deploy 5/27
2 parents 97a7ef0 + fc8b6d1 commit 6e24365

9 files changed

Lines changed: 98 additions & 59 deletions

File tree

.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,24 @@
659659
"contributions": [
660660
"code"
661661
]
662+
},
663+
{
664+
"login": "ishana-goyal",
665+
"name": "ishana-goyal",
666+
"avatar_url": "https://avatars.githubusercontent.com/u/88641809?v=4",
667+
"profile": "https://github.com/ishana-goyal",
668+
"contributions": [
669+
"code"
670+
]
671+
},
672+
{
673+
"login": "shannonh800",
674+
"name": "shannonh800",
675+
"avatar_url": "https://avatars.githubusercontent.com/u/113308101?v=4",
676+
"profile": "https://github.com/shannonh800",
677+
"contributions": [
678+
"code"
679+
]
662680
}
663681
],
664682
"commitType": "docs"

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,22 @@ Thanks to all our contributors!
217217
<td align="center" valign="top" width="14.28%"><a href="https://github.com/d-ondrich"><img src="https://avatars.githubusercontent.com/u/25425042?v=4?s=100" width="100px;" alt="d.ondrich"/><br /><sub><b>d.ondrich</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=d-ondrich" title="Code">💻</a></td>
218218
<td align="center" valign="top" width="14.28%"><a href="https://github.com/djtanner"><img src="https://avatars.githubusercontent.com/u/3960256?v=4?s=100" width="100px;" alt="djtanner"/><br /><sub><b>djtanner</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=djtanner" title="Code">💻</a></td>
219219
<td align="center" valign="top" width="14.28%"><a href="https://github.com/iWumboUWumbo2"><img src="https://avatars.githubusercontent.com/u/17531877?v=4?s=100" width="100px;" alt="iWumboUWumbo2"/><br /><sub><b>iWumboUWumbo2</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=iWumboUWumbo2" title="Code">💻</a></td>
220+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ishana-goyal"><img src="https://avatars.githubusercontent.com/u/88641809?v=4?s=100" width="100px;" alt="ishana-goyal"/><br /><sub><b>ishana-goyal</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=ishana-goyal" title="Code">💻</a></td>
220221
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jamesvas5307"><img src="https://avatars.githubusercontent.com/u/14347149?v=4?s=100" width="100px;" alt="jamesvas5307"/><br /><sub><b>jamesvas5307</b></sub></a><br /><a href="#design-jamesvas5307" title="Design">🎨</a> <a href="#mentoring-jamesvas5307" title="Mentoring">🧑‍🏫</a> <a href="#userTesting-jamesvas5307" title="User Testing">📓</a></td>
221222
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jellyyams"><img src="https://avatars.githubusercontent.com/u/53629007?v=4?s=100" width="100px;" alt="jellyyams"/><br /><sub><b>jellyyams</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=jellyyams" title="Code">💻</a></td>
222-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jkinzer85"><img src="https://avatars.githubusercontent.com/u/80472427?v=4?s=100" width="100px;" alt="jkinzer85"/><br /><sub><b>jkinzer85</b></sub></a><br /><a href="#userTesting-jkinzer85" title="User Testing">📓</a></td>
223223
</tr>
224224
<tr>
225+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jkinzer85"><img src="https://avatars.githubusercontent.com/u/80472427?v=4?s=100" width="100px;" alt="jkinzer85"/><br /><sub><b>jkinzer85</b></sub></a><br /><a href="#userTesting-jkinzer85" title="User Testing">📓</a></td>
225226
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mertbagt"><img src="https://avatars.githubusercontent.com/u/73559781?v=4?s=100" width="100px;" alt="mertbagt"/><br /><sub><b>mertbagt</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=mertbagt" title="Code">💻</a></td>
226227
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mmailloux22"><img src="https://avatars.githubusercontent.com/u/48417120?v=4?s=100" width="100px;" alt="mmailloux22"/><br /><sub><b>mmailloux22</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=mmailloux22" title="Code">💻</a></td>
227228
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mvictor55"><img src="https://avatars.githubusercontent.com/u/71357256?v=4?s=100" width="100px;" alt="mvictor55"/><br /><sub><b>mvictor55</b></sub></a><br /><a href="#business-mvictor55" title="Business development">💼</a> <a href="#projectManagement-mvictor55" title="Project Management">📆</a> <a href="#fundingFinding-mvictor55" title="Funding Finding">🔍</a> <a href="https://github.com/codeforboston/maple/commits?author=mvictor55" title="Code">💻</a></td>
228229
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pranay8297"><img src="https://avatars.githubusercontent.com/u/47974414?v=4?s=100" width="100px;" alt="pranay"/><br /><sub><b>pranay</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=pranay8297" title="Code">💻</a></td>
229230
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ren0nie0"><img src="https://avatars.githubusercontent.com/u/32780767?v=4?s=100" width="100px;" alt="ren0nie0"/><br /><sub><b>ren0nie0</b></sub></a><br /><a href="#research-ren0nie0" title="Research">🔬</a></td>
230231
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sammymyi"><img src="https://avatars.githubusercontent.com/u/105759252?v=4?s=100" width="100px;" alt="sammymyi"/><br /><sub><b>sammymyi</b></sub></a><br /><a href="#design-sammymyi" title="Design">🎨</a> <a href="#userTesting-sammymyi" title="User Testing">📓</a></td>
232+
</tr>
233+
<tr>
231234
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sashamaryl"><img src="https://avatars.githubusercontent.com/u/30247522?v=4?s=100" width="100px;" alt="sashamaryl"/><br /><sub><b>sashamaryl</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=sashamaryl" title="Code">💻</a> <a href="#mentoring-sashamaryl" title="Mentoring">🧑‍🏫</a> <a href="#research-sashamaryl" title="Research">🔬</a></td>
235+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/shannonh800"><img src="https://avatars.githubusercontent.com/u/113308101?v=4?s=100" width="100px;" alt="shannonh800"/><br /><sub><b>shannonh800</b></sub></a><br /><a href="https://github.com/codeforboston/maple/commits?author=shannonh800" title="Code">💻</a></td>
232236
</tr>
233237
</tbody>
234238
</table>

components/EditProfilePage/FollowingTabComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export function FollowedItem({
124124
<Row className={`align-items-center flex-column flex-md-row`}>
125125
{isBillElement(element) ? (
126126
<>
127-
<Internal href={`bills/${element.court}/${element.billId}`}>
127+
<Internal href={`/bills/${element.court}/${element.billId}`}>
128128
{formatBillId(element.billId)}
129129
</Internal>
130130
<Col xs={12} md={8} className={`d-flex`}>

components/search/HierarchicalMenuWidget.tsx

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type { SearchResults } from "algoliasearch-helper"
33
import type { Connector } from "instantsearch.js"
44
import type { AdditionalWidgetProperties } from "react-instantsearch"
55
import { useCallback, useEffect, useMemo, useState } from "react"
6+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
7+
import { faMinus, faPlus } from "@fortawesome/free-solid-svg-icons"
68

79
const cx = (...classNames: string[]): string =>
810
classNames.filter(Boolean).join(" ")
@@ -169,7 +171,7 @@ export const connectMultiselectHierarchicalMenu: MultiselectHierarchicalMenuConn
169171
}
170172
},
171173
init(initOptions) {
172-
const { helper, instantSearchInstance } = initOptions
174+
const { helper } = initOptions
173175
attributes.forEach(attr => {
174176
if (!helper.state.disjunctiveFacets.includes(attr)) {
175177
helper.setQueryParameter("disjunctiveFacets", [
@@ -178,8 +180,7 @@ export const connectMultiselectHierarchicalMenu: MultiselectHierarchicalMenuConn
178180
])
179181
}
180182
})
181-
helper.search()
182-
183+
const { instantSearchInstance } = initOptions
183184
renderFn(
184185
{
185186
...this.getWidgetRenderState(initOptions),
@@ -309,18 +310,14 @@ const MultiselectHierarchicalMenuItem = ({
309310

310311
const onButtonClick = useCallback(() => {
311312
if (isOpen) {
312-
const currentLevel = levels[index]
313-
const subLevel = levels[index + 1]
314-
if (item.isRefined) {
315-
currentLevel.refine(item.name)
316-
}
317-
if (subLevel) {
318-
subLevel.items
319-
.filter(
320-
subItem => subItem.name.startsWith(item.name) && subItem.isRefined
321-
)
322-
.forEach(subItem => subLevel.refine(subItem.name))
323-
}
313+
// Clear all refinements
314+
levels.forEach(level => {
315+
level.items.forEach(subItem => {
316+
if (subItem.isRefined) {
317+
level.refine(subItem.name)
318+
}
319+
})
320+
})
324321
}
325322
setIsOpen(!isOpen)
326323
}, [isOpen, levels])
@@ -369,7 +366,11 @@ const MultiselectHierarchicalMenuItem = ({
369366
hasSubLevel ? "" : "--child"
370367
}`}
371368
>
372-
{isOpen ? "-" : "+"}
369+
{isOpen ? (
370+
<FontAwesomeIcon icon={faMinus} size="2xs" />
371+
) : (
372+
<FontAwesomeIcon icon={faPlus} size="2xs" />
373+
)}
373374
</button>
374375
) : (
375376
<input
@@ -389,10 +390,7 @@ const MultiselectHierarchicalMenuItem = ({
389390
{item.label}
390391
</span>
391392
{!hasSubLevel && ( // Only render count if it's child
392-
<span
393-
className={`ais-MultiselectHierarchicalMenu-count--child
394-
}`}
395-
>
393+
<span className={`ais-MultiselectHierarchicalMenu-count--child`}>
396394
{item.count}
397395
</span>
398396
)}

components/search/SearchContainer.tsx

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export const SearchContainer = styled.div`
149149
150150
.ais-MultiselectHierarchicalMenu-list {
151151
background-color: white;
152-
padding: 1rem;
152+
padding: 0.5rem 1rem 1rem;
153153
border-radius: 4px;
154154
margin-bottom: 1.5rem;
155155
max-height: 250px;
@@ -201,33 +201,34 @@ export const SearchContainer = styled.div`
201201
width: 100%;
202202
list-style: none;
203203
}
204+
204205
.ais-MultiselectHierarchicalMenu-checkbox--child {
205206
box-shadow: none;
206207
outline: 1px solid black;
207208
border-radius: 1px;
208209
color: var(--bs-blue);
209-
margin-right: 6px;
210210
cursor: pointer;
211+
appearance: none;
212+
background-color: #fff;
213+
border: 1px solid var(--bs-blue);
214+
height: 1rem;
215+
margin: 0 0.5rem 0 0;
216+
min-width: 1rem;
211217
}
212-
.ais-MultiselectHierarchicalMenu-item--selected
213-
.ais-MultiselectHierarchicalMenu-label {
214-
font-weight: bold;
215-
}
216-
.ais-MultiselectHierarchicalMenu-item--child--selected
217-
.ais-MultiselectHierarchicalMenu-label--child {
218-
font-weight: bold;
219-
}
218+
220219
.ais-MultiselectHierarchicalMenu-item--child--selected
221220
.ais-MultiselectHierarchicalMenu-checkbox--child {
222221
background-image: url("/check-solid.svg");
223222
background-size: 0.75rem;
224223
background-position: center;
225224
background-repeat: no-repeat;
226225
}
227-
.ais-MultiselectHierarchicalMenu-item--child {
228-
font-size: 1rem;
229-
border-top: dashed 1px;
226+
227+
.ais-MultiselectHierarchicalMenu-item--selected
228+
.ais-MultiselectHierarchicalMenu-label {
229+
font-weight: bold;
230230
}
231+
231232
.ais-MultiselectHierarchicalMenu-label--child {
232233
white-space: normal;
233234
display: flex;
@@ -236,6 +237,17 @@ export const SearchContainer = styled.div`
236237
gap: 10px;
237238
cursor: pointer;
238239
}
240+
241+
.ais-MultiselectHierarchicalMenu-item--child--selected
242+
.ais-MultiselectHierarchicalMenu-label--child {
243+
font-weight: bold;
244+
}
245+
246+
.ais-MultiselectHierarchicalMenu-item--child {
247+
font-size: 1rem;
248+
border-top: dashed 1px;
249+
}
250+
239251
.ais-MultiselectHierarchicalMenu-count--child {
240252
background: var(--bs-blue);
241253
color: white;

components/search/common.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function getServerConfig(): TypesenseInstantsearchAdapterOptions["server"
3030
}
3131

3232
function RefinementList({ attribute }: { attribute: string }) {
33-
useRefinementList({ attribute })
33+
useRefinementList({ attribute, limit: 500 })
3434
return null
3535
}
3636

@@ -44,7 +44,8 @@ export function VirtualFilters({ type }: { type: "bill" | "testimony" }) {
4444
"city",
4545
"primarySponsor",
4646
"cosponsors",
47-
"topics.lvl1"
47+
"topics.lvl1",
48+
"topics.lvl0"
4849
]
4950

5051
return (

components/search/testimony/TestimonyHit.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { Hit } from "instantsearch.js"
2-
import { maple } from "components/links"
32
import Link from "next/link"
4-
import { Testimony } from "components/db/testimony"
5-
import { trimContent } from "components/TestimonyCallout/TestimonyCallout"
6-
import { formatBillId } from "components/formatting"
7-
import { useBill } from "components/db/bills"
8-
import { FollowUserButton } from "components/shared/FollowButton"
3+
import { useTranslation } from "next-i18next"
94
import { Image } from "react-bootstrap"
10-
import { useFlags } from "components/featureFlags"
5+
import { useMediaQuery } from "usehooks-ts"
6+
117
import { useAuth } from "components/auth"
12-
import { useTranslation } from "next-i18next"
8+
import { useBill } from "components/db/bills"
9+
import { Testimony } from "components/db/testimony"
10+
import { useFlags } from "components/featureFlags"
11+
import { formatBillId, truncateText } from "components/formatting"
12+
import { maple } from "components/links"
13+
import { FollowUserButton } from "components/shared/FollowButton"
14+
import { trimContent } from "components/TestimonyCallout/TestimonyCallout"
1315

1416
export const TestimonyHit = ({ hit }: { hit: Hit<Testimony> }) => {
1517
const url = maple.testimony({ publishedId: hit.id })
@@ -44,6 +46,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
4446
const { user } = useAuth()
4547
const { followOrg } = useFlags()
4648
const isCurrentUser = user?.uid === hit.authorUid
49+
const isMobile = useMediaQuery("(max-width: 768px)")
4750

4851
return (
4952
<div
@@ -71,7 +74,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
7174
<span style={{ flexGrow: 1 }}>
7275
<b>Written by {writtenBy}</b>
7376
</span>
74-
{!isCurrentUser && followOrg && user && (
77+
{hit.public && !isCurrentUser && followOrg && user && (
7578
<FollowUserButton profileId={hit.authorUid} />
7679
)}
7780
</div>
@@ -104,14 +107,16 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
104107
padding: "5px 10px"
105108
}}
106109
>
107-
{committee.name}
110+
{isMobile ? truncateText(committee.name, 35) : committee.name}
108111
</span>
109112
)}
110113
</div>
111114
<h6 style={{ color: "var(--bs-blue)", fontWeight: 600 }}>
112115
{bill?.content.Title}
113116
</h6>
114-
<p>"{trimContent(hit.content, 500)}"</p>
117+
<p style={{ wordBreak: "break-all" }}>
118+
"{trimContent(hit.content, 500)}"
119+
</p>
115120
<div style={{ display: "flex", justifyContent: "space-between" }}>
116121
{/* {hit.content.trim().length > 0 && <a className="w-20">Read More</a>} */}
117122
<span style={{ marginLeft: "auto" }}>{`Posted ${date}`}</span>

functions/src/notifications/deliverNotifications.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as functions from "firebase-functions"
2-
import * as admin from "firebase-admin"
32
import * as handlebars from "handlebars"
43
import * as fs from "fs"
5-
import { Timestamp } from "../firebase"
4+
import { auth, db, Timestamp } from "../firebase"
65
import { getNextDigestAt, getNotificationStartDate } from "./helpers"
76
import { startOfDay } from "date-fns"
87
import { TestimonySubmissionNotificationFields, Profile } from "./types"
@@ -13,17 +12,13 @@ import {
1312
UserDigest
1413
} from "./emailTypes"
1514
import { prepareHandlebars } from "../email/handlebarsHelpers"
16-
import { getAuth } from "firebase-admin/auth"
1715
import { Frequency } from "../auth/types"
1816

1917
const NUM_BILLS_TO_DISPLAY = 4
2018
const NUM_USERS_TO_DISPLAY = 4
2119
const NUM_TESTIMONIES_TO_DISPLAY = 6
2220
const EMAIL_TEMPLATE_PATH = "../email/digestEmail.handlebars"
2321

24-
// Get a reference to the Firestore database
25-
const db = admin.firestore()
26-
const auth = getAuth()
2722
const path = require("path")
2823

2924
const getVerifiedUserEmail = async (uid: string) => {
@@ -103,7 +98,9 @@ const deliverEmailNotifications = async () => {
10398
batch.update(profileDoc.ref, { nextDigestAt })
10499
await batch.commit()
105100

106-
console.log(`Updated nextDigestAt for ${profileDoc.id} to ${nextDigestAt}`)
101+
console.log(
102+
`Updated nextDigestAt for ${profileDoc.id} to ${nextDigestAt?.toDate()}`
103+
)
107104
})
108105

109106
// Wait for all email documents to be created

functions/src/profile/finishSignup.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ export const finishSignup = functions.https.onCall(async (data, context) => {
1414

1515
const { requestedRole } = checkRequestZod(CreateProfileRequest, data)
1616

17-
let role: Role = "user"
17+
let role: Role = requestedRole
1818

1919
// Only an admin can approve organizations, after they've signed up initially
2020
// There's a nextjs api route: PATCH /users/<uid> {"role": <role>}
21-
if (requestedRole === "organization") {
22-
role = "pendingUpgrade"
23-
}
21+
22+
// Removing the "pendingUpgrade" flow (temporarily) because the
23+
// organization approval process is currently too cumbersome.
24+
25+
// if (requestedRole === "organization") {
26+
// role = "pendingUpgrade"
27+
// }
2428

2529
await setRole({ role, auth, db, uid })
2630

0 commit comments

Comments
 (0)