-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0ba98c
commit 8e4973d
Showing
14 changed files
with
235 additions
and
285 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
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 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
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,10 +1,9 @@ | ||
{ | ||
"namespace": "common", | ||
"namespace": "alertFilters", | ||
"strings": { | ||
"riskAllCountries": "All countries", | ||
"riskSelectHazardTypes": "Select Hazard types", | ||
"riskSelectMonths": "Select months", | ||
"riskNormalize": "Normalize by population", | ||
"riskCopingCapacity": "Include coping capacity" | ||
"alertCountries": "All countries", | ||
"alertUrgency": "Select Urgency type", | ||
"alertSeverity": "Select Severity type", | ||
"alertCertainty": "Select Certainty type" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.filters { | ||
display: grid; | ||
grid-gap: var(--go-ui-spacing-md); | ||
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); | ||
grid-gap: var(--go-ui-spacing-md); | ||
} |
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,6 @@ | ||
{ | ||
"namespace": "ongoingAlertRegion", | ||
"strings": { | ||
"regionList": "Region List" | ||
} | ||
} |
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,79 @@ | ||
import { useMemo } from 'react'; | ||
import { | ||
gql, | ||
useQuery, | ||
} from '@apollo/client'; | ||
import { | ||
BlockLoading, | ||
Container, | ||
} from '@ifrc-go/ui'; | ||
import { useTranslation } from '@ifrc-go/ui/hooks'; | ||
|
||
import { | ||
Admin1ListQuery, | ||
Admin1ListQueryVariables, | ||
} from '#generated/types'; | ||
|
||
import i18n from './i18n.json'; | ||
import styles from './styles.module.css'; | ||
|
||
const ADMIN1_LIST = gql` | ||
query Admin1List { | ||
public { | ||
admin1s { | ||
items { | ||
countryId | ||
name | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export interface RegionProps { | ||
countryId: string | undefined; | ||
} | ||
|
||
function RegionListItem(props: RegionProps) { | ||
const { | ||
countryId, | ||
} = props; | ||
|
||
const strings = useTranslation(i18n); | ||
|
||
const { | ||
data: admin1ListResponse, | ||
loading: admin1ListLoading, | ||
} = useQuery<Admin1ListQuery, Admin1ListQueryVariables>( | ||
ADMIN1_LIST, | ||
); | ||
|
||
const filteredAdmins = useMemo(() => { | ||
if (!countryId || !admin1ListResponse?.public?.admin1s?.items) return []; | ||
|
||
return admin1ListResponse.public.admin1s.items | ||
.filter((item) => countryId.includes(item.countryId)) | ||
.map((item) => item.name); | ||
}, [countryId, admin1ListResponse]); | ||
|
||
return ( | ||
<Container | ||
className={styles.alerts} | ||
childrenContainerClassName={styles.content} | ||
headingLevel={4} | ||
spacing="compact" | ||
heading={strings.regionList} | ||
> | ||
{admin1ListLoading && <BlockLoading />} | ||
<div className={styles.alertDetails}> | ||
{filteredAdmins.map((name) => ( | ||
<div> | ||
{name} | ||
</div> | ||
))} | ||
</div> | ||
</Container> | ||
); | ||
} | ||
|
||
export default RegionListItem; |
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,13 @@ | ||
.alerts { | ||
.content { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--go-ui-spacing-lg); | ||
|
||
.alert-details { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--go-ui-spacing-2xs); | ||
} | ||
} | ||
} |
Oops, something went wrong.