Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app(IN-941): Search page alerts #1182

Draft
wants to merge 120 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
4364c13
Current services still filtered when changing pages
kuck1 Mar 13, 2024
9b9875c
Warnings added at certain levels per state
kuck1 Mar 22, 2024
ac4221b
Tweaks to color system and design for search alert banner
kuck1 Mar 22, 2024
40598eb
Merge conflict
kuck1 Mar 22, 2024
4f834a3
Cleanup
kuck1 Mar 22, 2024
b531d61
Design updates
kuck1 Mar 23, 2024
18e8976
Color updates and USA check
kuck1 Mar 24, 2024
aa9b9dc
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 25, 2024
a6def0e
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 25, 2024
3541264
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 25, 2024
cb38c78
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 25, 2024
981d651
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 26, 2024
f0f4a3b
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 26, 2024
1fc8cdb
Merge branch 'dev' into search-page-alerts
JoeKarow Mar 26, 2024
abafc40
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 26, 2024
8faeb20
Alert banner components
kuck1 Mar 27, 2024
03023a9
Merge branch 'search-page-alerts' of https://github.com/weareinreach/…
kuck1 Mar 27, 2024
7b71fbd
create LocationAlert table
JoeKarow Mar 27, 2024
a2338f0
update freeText generator
JoeKarow Mar 27, 2024
18b2915
add alert level field
JoeKarow Mar 27, 2024
ea37be5
create api route & mock data
JoeKarow Mar 27, 2024
171f56a
fix component & story
JoeKarow Mar 27, 2024
0812bc5
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 28, 2024
db6503f
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 28, 2024
1270e46
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 28, 2024
288705a
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Mar 29, 2024
6d1b9f3
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 1, 2024
98205f3
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 1, 2024
3d64306
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 2, 2024
22f43da
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 2, 2024
c51d503
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
7d86903
Merge branch 'dev' into search-page-alerts
JoeKarow Apr 3, 2024
e8d0c24
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
fa78947
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
c6a4d78
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
045b747
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
563259b
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
50223a9
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 3, 2024
62441be
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 4, 2024
f1a45d9
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 4, 2024
9ae63e3
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 9, 2024
640193f
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 9, 2024
7841e80
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 9, 2024
4dcb3ab
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 10, 2024
c0a24cb
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 10, 2024
91c5d39
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 11, 2024
1f3c3a0
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 11, 2024
c367eb7
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 11, 2024
85a65e3
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 11, 2024
a650d1d
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 11, 2024
1fa9cd0
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 11, 2024
529d029
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 12, 2024
914c4a9
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 12, 2024
0ebad05
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
1792e3d
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
8e93bd1
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
40d2433
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
f62ade6
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
3193b46
remove overrides
JoeKarow Apr 15, 2024
6744e14
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
f4ef6a8
Merge branch 'dev' into search-page-alerts
JoeKarow Apr 15, 2024
9172728
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 15, 2024
dd58a33
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 17, 2024
ba5257b
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 17, 2024
e7f2264
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 18, 2024
b90e7d8
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 19, 2024
2ceae23
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 19, 2024
f7e16dd
Merge branch 'dev' into search-page-alerts
JoeKarow Apr 22, 2024
69c1452
chore: lint & format
InReach-svc Apr 22, 2024
ff59167
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 22, 2024
0d4b97e
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 22, 2024
3968a3e
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 22, 2024
9995efe
fix: social media saving (#1238)
JoeKarow Apr 22, 2024
b05e0d0
fix(db): update all non-major dependencies (#1237)
renovate[bot] Apr 23, 2024
bc0941f
chore(workflows): update github actions (#1239)
renovate[bot] Apr 23, 2024
419c039
chore(db): update all non-major dependencies (#1242)
renovate[bot] Apr 23, 2024
a43ef77
fix: misc sonarlint issues (#1240)
JoeKarow Apr 23, 2024
3ff8f60
fix: sonarlint issues - api (#1245)
JoeKarow Apr 24, 2024
5ba4e46
Merge branch 'dev' into search-page-alerts
JoeKarow Apr 24, 2024
aa8f4f8
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 24, 2024
d4f2875
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 24, 2024
f1e34a2
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 25, 2024
6ebfd7c
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 25, 2024
14f43d4
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 26, 2024
4db914d
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 26, 2024
7acf791
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 29, 2024
38928ea
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] Apr 29, 2024
4a7f4ba
Merge branch 'dev' into search-page-alerts
JoeKarow Apr 30, 2024
72cb89b
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 1, 2024
0b1aeec
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 2, 2024
a9a1d6e
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 2, 2024
4308735
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 3, 2024
475030d
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 3, 2024
39415d0
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 3, 2024
f4e9277
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 3, 2024
a3307cb
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 6, 2024
e7b56bb
Merge branch 'dev' into search-page-alerts
JoeKarow May 6, 2024
9969e7f
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 6, 2024
bf83dcb
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 7, 2024
4a157dc
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 7, 2024
74c1ee8
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 7, 2024
d1660ff
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 7, 2024
d7ce6d4
Integrating frontend and backend messaging
kuck1 May 8, 2024
807bf0d
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 9, 2024
83fe74d
Merge branch 'search-page-alerts' of https://github.com/weareinreach/…
kuck1 May 14, 2024
8e701ff
Pair programming updates with Joe to move logic to component
kuck1 May 14, 2024
61aa216
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 20, 2024
bc80afe
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 20, 2024
6c10984
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 20, 2024
d464dd7
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 20, 2024
9cf88ea
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 20, 2024
151173e
Pair programming results
kuck1 May 20, 2024
812c70e
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 21, 2024
44a327a
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 22, 2024
1529af8
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 24, 2024
d8a1abd
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 28, 2024
8f01aea
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 28, 2024
84b92d5
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 28, 2024
985da6d
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 29, 2024
069f289
Merge branch 'dev' into search-page-alerts
kodiakhq[bot] May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/app/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
"alert-message-instructions": "Enter the alert message",
"alert-title-instructions": "Enter a title for the message...",
"alerts": {
"search-page-legislative-map": "This <ATLink>anti-trans legislative risk map</ATLink> shows the 2-year risk for anti-trans laws in all 50 states and D.C."
"search-page-legislative-map": "This <ATLink>anti-trans legislative risk map</ATLink> shows the 2-year risk for anti-trans laws in all 50 states and D.C.",
"search-page-do-not-fly-florida": "Please be aware there is a <ATLink>travel advisory alert</ATLink> for the LGBTQ+ community in Florida.",
"search-page-high-risk-state": "This state is a <ATLink>high-risk state</ATLink> for anti-trans legislation. Contact providers for more information.",
"search-page-med-risk-state": "This state is a <ATLink>moderate-risk state</ATLink> for anti-trans legislation. Contact providers for more information.",
"search-page-low-risk-state": "This state is a <ATLink>low-risk state</ATLink> for anti-trans legislation.",
"search-page-most-protective-state": "This state is <ATLink>one of the most protective states</ATLink> for transgender, nonbinary and gender non-conforming people."
},
"all-service-category": "All {{serviceCategory}}",
"anti-hate": {
Expand Down
210 changes: 194 additions & 16 deletions apps/app/src/pages/search/[...params]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,77 @@ const ServiceFilter = dynamic(() =>
import('@weareinreach/ui/modals/ServiceFilter').then((mod) => mod.ServiceFilter)
)

const stateRiskLevels: Record<string, string> = {
FL: 'alerts.search-page-do-not-fly-florida',
KS: 'alerts.search-page-high-risk-state',
MT: 'alerts.search-page-high-risk-state',
OK: 'alerts.search-page-high-risk-state',
ND: 'alerts.search-page-high-risk-state',
TN: 'alerts.search-page-high-risk-state',
UT: 'alerts.search-page-high-risk-state',
AL: 'alerts.search-page-high-risk-state',
AR: 'alerts.search-page-high-risk-state',
IA: 'alerts.search-page-high-risk-state',
IN: 'alerts.search-page-high-risk-state',
LA: 'alerts.search-page-high-risk-state',
MO: 'alerts.search-page-high-risk-state',
MS: 'alerts.search-page-high-risk-state',
NE: 'alerts.search-page-high-risk-state',
OH: 'alerts.search-page-high-risk-state',
SC: 'alerts.search-page-high-risk-state',
TX: 'alerts.search-page-high-risk-state',
WV: 'alerts.search-page-high-risk-state',
AK: 'alerts.search-page-med-risk-state',
GA: 'alerts.search-page-med-risk-state',
ID: 'alerts.search-page-med-risk-state',
KY: 'alerts.search-page-med-risk-state',
NC: 'alerts.search-page-med-risk-state',
NH: 'alerts.search-page-med-risk-state',
SD: 'alerts.search-page-med-risk-state',
WY: 'alerts.search-page-med-risk-state',
AZ: 'alerts.search-page-low-risk-state',
DE: 'alerts.search-page-low-risk-state',
ME: 'alerts.search-page-low-risk-state',
MI: 'alerts.search-page-low-risk-state',
NV: 'alerts.search-page-low-risk-state',
PA: 'alerts.search-page-low-risk-state',
RI: 'alerts.search-page-low-risk-state',
VA: 'alerts.search-page-low-risk-state',
WI: 'alerts.search-page-low-risk-state',
CA: 'alerts.search-page-most-protective-state',
CO: 'alerts.search-page-most-protective-state',
CT: 'alerts.search-page-most-protective-state',
DC: 'alerts.search-page-most-protective-state',
HI: 'alerts.search-page-most-protective-state',
IL: 'alerts.search-page-most-protective-state',
MA: 'alerts.search-page-most-protective-state',
MD: 'alerts.search-page-most-protective-state',
MN: 'alerts.search-page-most-protective-state',
NJ: 'alerts.search-page-most-protective-state',
NM: 'alerts.search-page-most-protective-state',
NY: 'alerts.search-page-most-protective-state',
OR: 'alerts.search-page-most-protective-state',
VT: 'alerts.search-page-most-protective-state',
WA: 'alerts.search-page-most-protective-state',
}
const protectiveStates = [
'CA',
'CO',
'CT',
'DC',
'HI',
'IL',
'MA',
'MD',
'MN',
'NJ',
'NM',
'NY',
'OR',
'VT',
'WA',
]

const PageIndexSchema = z.coerce.number().default(1)

const useStyles = createStyles((theme) => ({
Expand Down Expand Up @@ -86,6 +157,35 @@ const useStyles = createStyles((theme) => ({
height: rem(80),
},
},
searchBanner: {
...theme.other.utilityFonts.utility1,
color: theme.other.colors.secondary.black,
width: '100%',
maxWidth: '100%',
height: 'auto',
display: 'flex',
alignItems: 'flex-start',
justifyContent: 'center',
textAlign: 'center',
position: 'relative',
borderRadius: rem(8),
padding: `${rem(12)} ${rem(16)} ${rem(16)}`,
marginBottom: rem(32),
[theme.fn.largerThan('sm')]: {
marginTop: rem(-40),
},
[theme.fn.largerThan('md')]: {
marginTop: rem(-20),
},
[theme.fn.smallerThan('sm')]: {
height: rem(80),
},
},
emoji: {
marginRight: rem(8),
verticalAlign: 'top',
display: 'block',
},
}))

const SearchResults = () => {
Expand Down Expand Up @@ -174,6 +274,16 @@ const SearchResults = () => {
}
}, [data, loadingPage])

const [stateInUS, setStateInUS] = useState<string>('')

useEffect(() => {
if (searchState.searchTerm?.slice(-3) == 'USA') {
setStateInUS(searchState.searchTerm?.split(', ')[1] || '')
} else {
setStateInUS('')
}
}, [searchState.searchTerm])

JoeKarow marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +181 to +190
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine logic to determine state from search term.

Consider using a more robust method to parse the location information from the search term, as the current method may not handle all cases effectively.

useEffect(
() => {
if (typeof router.query.page === 'string' && searchState.page !== router.query.page)
Expand Down Expand Up @@ -210,14 +320,15 @@ const SearchResults = () => {
}, [])

if (error) return <>Error</>
const showAlertMessage = ['PW', 'AS', 'UM', 'MP', 'MH', 'US', 'VI', 'GU', 'PR'].includes(country)
const showCountryAlertMessage = ['PW', 'AS', 'UM', 'MP', 'MH', 'US', 'VI', 'GU', 'PR'].includes(country)
const showStateAlertMessage = true

return (
<>
<Head>
<title>{t('page-title.base', { ns: 'common', title: '$t(page-title.search-results)' })}</title>
</Head>
{showAlertMessage && (
{showCountryAlertMessage && (
<Box className={classes.banner}>
<Text variant={variants.Text.utility1white}>
<Trans
Expand All @@ -237,25 +348,53 @@ const SearchResults = () => {
</Text>
</Box>
)}

{showStateAlertMessage && (
<Box className={classes.banner}>
<Text variant={variants.Text.utility1white}>
<Trans
i18nKey='alerts.search-page-legislative-map'
ns='common'
components={{
ATLink: (
<Link
external
variant={variants.Link.inheritStyle}
href='https://www.erininthemorning.com/p/anti-trans-legislative-risk-assessment-96f'
target='_blank'
></Link>
),
}}
/>
</Text>
</Box>
)}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract the banner code out in to a separate component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good call, I'll work on that this week!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the banners go in the story book as components?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you can create it in components/core in the ui package - there are plenty of *.stories.tsx files to use as a starting template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the banners to components although my folder structure may be a bit different, was having an issue with imports

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed part of it - you were trying to move the component in to a storybook file (*.stories.tsx shouldn't get imported in to any functional part of the app - those are for Storybook only). I moved the component to ui/components/core/LocationBasedAlertBanner/index.tsx and set up 3 different use examples. Inside the storybook file, in the RenderWrapper component I put in there (just for purposes of pulling mock API data), you'll see how the API call is done. The API can return more than one result, in the event that there are multiple alerts for an area or overlapping alerts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't touch the implementation on this page though -- that still needs to be done

<Grid.Col
xs={12}
sm={12}
pb={30}
{...(showAlertMessage ? { mt: { base: 80, xs: 80, sm: 20, md: 20, lg: 20, xl: 40 } } : {})}
{...(showCountryAlertMessage || showStateAlertMessage
? { mt: { base: 80, xs: 80, sm: 20, md: 20, lg: 20, xl: 40 } }
: {})}
>
<Group spacing={20} w='100%' className={classes.searchControls}>
<Group maw={{ md: '50%', base: '100%' }} w='100%'>
<SearchBox
type='location'
loadingManager={{ setLoading: setLoadingPage, isLoading: loadingPage }}
initialValue={searchState.searchTerm}
resetInitialValue={() => {
searchStateActions.setSearchTerm('')
setSearchValue={(newValue: string) => {
searchStateActions.setSearchTerm(newValue)
}}
/>
</Group>
<Group noWrap w={{ base: '100%', md: '50%' }}>
<ServiceFilter resultCount={resultCount} isFetching={searchIsFetching} />
<ServiceFilter
resultCount={resultCount}
isFetching={searchIsFetching}
current={searchState.services}
/>
{/* @ts-expect-error `component` prop not needed.. */}
<MoreFilter resultCount={resultCount} isFetching={searchIsFetching}>
{t('more.filters')}
Expand All @@ -279,16 +418,55 @@ const SearchResults = () => {
loadingManager={{ setLoading: setLoadingPage, isLoading: loadingPage }}
/>
</Grid.Col>
<Grid.Col xs={12} sm={8} md={8}>
{data?.resultCount === 0 && crisisResults ? (
<NoResults data={crisisResults} />
) : (
<>
{resultDisplay}
<Pagination total={getSearchResultPageCount(data?.resultCount)} />
</>
)}
</Grid.Col>
<>
<Grid.Col xs={12} sm={8} md={8}>
{data?.resultCount === 0 && crisisResults ? (
<NoResults data={crisisResults} />
) : (
<>
{stateRiskLevels[stateInUS] && (
<div>
<Box
className={classes.searchBanner}
style={{
backgroundColor: protectiveStates.includes(stateInUS)
? theme.other.colors.secondary.cornflower
: theme.fn.lighten(theme.other.colors.tertiary.pink, 0.3),
}}
>
<div className={classes.emoji}>🔔</div>
<Text
variant={
protectiveStates.includes(stateInUS)
? variants.Text.utility1white
: variants.Text.utility1
}
>
<Trans
i18nKey={stateRiskLevels[stateInUS]}
ns='common'
components={{
ATLink: (
<Link
external
variant={variants.Link.inheritStyle}
href='https://www.erininthemorning.com/p/anti-trans-legislative-risk-assessment-96f'
target='_blank'
></Link>
),
}}
/>
</Text>
</Box>
</div>
)}

{resultDisplay}
<Pagination total={getSearchResultPageCount(data?.resultCount)} />
</>
)}
</Grid.Col>
</>
</>
)
}
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/components/core/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const SearchBox = ({
initialValue = '',
pinToLeft,
placeholderTextKey,
resetInitialValue,
setSearchValue: setSearchValue,
}: SearchBoxProps) => {
const { classes, cx } = useStyles()
const variants = useCustomVariant()
Expand Down Expand Up @@ -181,6 +181,7 @@ export const SearchBox = ({
(!autocompleteData?.results?.length && autocompleteLoading && notBlank(search))
) {
setSearchLoading(true)
setSearchValue?.(search)
setResults([{ value: search, label: search, fetching: true }])
}
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -244,7 +245,7 @@ export const SearchBox = ({
onClick={() => {
form.reset()
form.values.search = ''
resetInitialValue?.()
setSearchValue?.('')
}}
>
<Text>{t('clear')}</Text>
Expand Down Expand Up @@ -402,7 +403,7 @@ type SearchBoxProps = {
initialValue?: string
pinToLeft?: boolean
placeholderTextKey?: string
resetInitialValue?: () => void
setSearchValue?: (newValue: string) => void
}
type FormValues = {
search: string
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/modals/ServiceFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import { useAccordionStyles, useModalStyles, useStyles } from './styles'

export const ServiceFilter = ({ resultCount, isFetching, disabled }: ServiceFilterProps) => {
export const ServiceFilter = ({ resultCount, isFetching, current, disabled }: ServiceFilterProps) => {

Check warning on line 31 in packages/ui/modals/ServiceFilter/index.tsx

View check run for this annotation

InReachBot / Check Code for Errors

packages/ui/modals/ServiceFilter/index.tsx#L31

[@typescript-eslint/no-unused-vars] 'current' is defined but never used.
const { data: serviceOptionData } = api.service.getFilterOptions.useQuery(undefined, {
select: (data) =>
data.map(({ id, tsKey, tsNs, services }) => ({
Expand Down Expand Up @@ -302,5 +302,6 @@
interface ServiceFilterProps {
resultCount?: number
isFetching?: boolean
current?: string[]
disabled?: boolean
}
2 changes: 2 additions & 0 deletions packages/ui/theme/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const colors = {
coolGray: '#d9d9d9',
red: '#C05C4A',
pink: '#D4A1BA',
lightPink: '#F2E1E9',
lightGreen: '#E4F9EA',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose the light green based on this https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors

This was not in the design, so not sure if we want to use this instead of the lightPink for all states.

lightBlue: '#79ADD7',
purple: '#705890',
darkBlue: '#3c4e8f',
Expand Down