-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service-portal): Health - Organ donation (#15227)
* feat: add organ donation overview * feat: add organ donation registration * fix: form logic * fix: form logic * fix: text * fix: wrong naming * feat: add checkboxes * feat: simplify form * feat: add organ donation to submenu * feat: update list * fix: mobile input * fix: rewrite to fix order of checkboxes * feat: add feature flag for routes * feat: remove input & fix texts * feat: add scopes * fix: scope * fix: domain build issues * fix: nullable error * feat: connect to graphql * fix: naming --------- Co-authored-by: lommi <jonorn@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
Showing
18 changed files
with
638 additions
and
10 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 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 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 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
23 changes: 23 additions & 0 deletions
23
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.graphql
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,23 @@ | ||
query getDonorStatus { | ||
HealthDirectorateOrganDonationGetDonorStatus { | ||
isDonor | ||
exceptions | ||
exceptionComment | ||
registrationDate | ||
} | ||
} | ||
|
||
query getOrganDonationExceptions($locale: String) { | ||
HealthDirectorateOrganDonationGetDonationExceptions(locale: $locale) { | ||
values { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
|
||
mutation updateOrganDonationInfo( | ||
$input: HealthDirectorateOrganDonorStatusInput! | ||
) { | ||
HealthDirectorateOrganDonationUpdateDonorStatus(input: $input) | ||
} |
83 changes: 83 additions & 0 deletions
83
libs/service-portal/health/src/screens/OrganDonation/OrganDonation.tsx
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,83 @@ | ||
import { useLocale, useNamespaces } from '@island.is/localization' | ||
import { | ||
ActionCard, | ||
IntroHeader, | ||
LinkResolver, | ||
} from '@island.is/service-portal/core' | ||
import { messages as m } from '../../lib/messages' | ||
import { Button, Box, Text } from '@island.is/island-ui/core' | ||
import { HealthPaths } from '../../lib/paths' | ||
import { Problem } from '@island.is/react-spa/shared' | ||
import { useGetDonorStatusQuery } from './OrganDonation.generated' | ||
const OrganDonation = () => { | ||
useNamespaces('sp.health') | ||
|
||
const { formatMessage } = useLocale() | ||
const { data, loading, error } = useGetDonorStatusQuery() | ||
const donorStatus = data?.HealthDirectorateOrganDonationGetDonorStatus | ||
|
||
const exceptionText: string = | ||
donorStatus?.exceptions?.length && donorStatus.exceptions.length > 0 | ||
? [ | ||
donorStatus?.exceptionComment, | ||
|
||
donorStatus?.exceptions?.join(', '), | ||
].join(':') ?? '' | ||
: donorStatus?.exceptionComment ?? '' | ||
return ( | ||
<Box> | ||
<IntroHeader | ||
title={formatMessage(m.organDonation)} | ||
intro={formatMessage(m.organDonationDescription)} | ||
/> | ||
{!error && !loading && donorStatus !== null && ( | ||
<> | ||
<Box> | ||
<LinkResolver | ||
href={formatMessage(m.organDonationLink)} | ||
key="organ-donation" | ||
> | ||
<Button | ||
variant="utility" | ||
size="small" | ||
icon="open" | ||
iconType="outline" | ||
> | ||
{formatMessage(m.readAboutOrganDonation)} | ||
</Button> | ||
</LinkResolver> | ||
</Box> | ||
<Box> | ||
<Text | ||
variant="eyebrow" | ||
color="purple400" | ||
marginTop={5} | ||
marginBottom={1} | ||
> | ||
{formatMessage(m.takeOnOrganDonation)} | ||
</Text> | ||
<ActionCard | ||
heading={ | ||
donorStatus?.isDonor | ||
? formatMessage(m.iAmOrganDonor) | ||
: formatMessage(m.iAmNotOrganDonor) | ||
} | ||
text={exceptionText} | ||
cta={{ | ||
url: HealthPaths.HealthOrganDonationRegistration, | ||
label: formatMessage(m.changeTake), | ||
centered: true, | ||
}} | ||
/> | ||
</Box> | ||
</> | ||
)} | ||
{error && !loading && <Problem error={error} noBorder={false} />} | ||
{!error && !loading && data === null && ( | ||
<Problem type="no_data" noBorder={false} /> | ||
)} | ||
</Box> | ||
) | ||
} | ||
|
||
export default OrganDonation |
Oops, something went wrong.