Skip to content

Commit

Permalink
Show sanctions risk in the risk level table
Browse files Browse the repository at this point in the history
  • Loading branch information
erikao1998 committed Dec 1, 2023
1 parent bd30fd4 commit bbd1ae8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/client/components/ResultPage/CountryResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const CountryResults = ({
(r) => r.optionLabel === `safetyLevel${country.safetyLevel}`
)?.isSelected[language as keyof Locales]

const sanctionsRisk = country.sanctions ? 2 : 1

return (
<>
<RiskElement
Expand All @@ -44,6 +46,11 @@ const CountryResults = ({
resultText={t('results:safetyLevel')}
risk={country.safetyLevel}
/>
<RiskElement
resultText="Pakotteet"
risk={sanctionsRisk}
infoText={sanctionsRisk === 2 ? t('risks:sanctionsRisk') : ''}
/>
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/ResultPage/RiskElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { resultStyles } = styles

export interface RiskElementProps {
// eslint-disable-next-line react/require-default-props
infoText?: string
infoText?: string | null
resultText: string
risk: number
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"funderRiskLevel": "Risk level of the project funder",
"fundingRiskLevel": "Risk level of the external funding",
"totalRiskLevel": "Total risk level of the project",
"noRisk": "No identifiable risk"
"noRisk": "No identifiable risk",
"sanctionsRisk": "*Read more information about the sanctions at [sanctionsmap.eu](https://sanctionsmap.eu/#/main)*"
},
"results": {
"title": "Summary of Your Choices",
Expand Down
3 changes: 2 additions & 1 deletion src/client/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"funderRiskLevel": "Projektin rahoittajan riskitaso",
"fundingRiskLevel": "Ulkopuolisen rahoituksen riskitaso",
"totalRiskLevel": "Yhteistyön kokonaisriskitaso",
"noRisk": "Ei erityistä riskiä"
"noRisk": "Ei erityistä riskiä",
"sanctionsRisk": "*Lue lisää maahan kohdistuvista pakotteista [sanctionsmap.eu](https://sanctionsmap.eu/#/main)-sivulta*"
},
"results": {
"title": "Yhteenveto valinnoistasi",
Expand Down
3 changes: 2 additions & 1 deletion src/client/locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"funderRiskLevel": "Risk level of the project funder",
"fundingRiskLevel": "Risk level of the external funding",
"totalRiskLevel": "Total risk level of the project",
"noRisk": "No identifiable risk"
"noRisk": "No identifiable risk",
"sanctionsRisk": "*Read more information about the sanctions at [sanctionsmap.eu](https://sanctionsmap.eu/#/main)*"
},
"results": {
"title": "Sammanfattning av dina val",
Expand Down
1 change: 1 addition & 0 deletions src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ export type CountryData = {
hci: number
safetyLevel: number
universities: string[]
sanctions: object[]
}
2 changes: 1 addition & 1 deletion src/server/data/sanctions/sanctionsMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fetchSanctionsData = async (countryName: string | undefined) => {

const countrySanctions = data.data.find(
(c: any) => c.country.data.title === countryName
).legal_acts
)?.legal_acts.data

if (!countrySanctions) return null

Expand Down

0 comments on commit bbd1ae8

Please sign in to comment.