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

feat(service-portal): Health - Organ donation #15227

Merged
merged 29 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ee49bd0
feat: add organ donation overview
disaerna Jun 11, 2024
f2adaf1
feat: add organ donation registration
disaerna Jun 13, 2024
f3223e0
Merge branch 'main' into service-portal/organ-donors-ui
lodmfjord Jun 13, 2024
95790dc
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Jun 21, 2024
24fd9b4
fix: form logic
disaerna Jun 25, 2024
9299419
fix: form logic
disaerna Jun 27, 2024
8bb7bce
fix: text
disaerna Jun 27, 2024
2062294
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Jul 1, 2024
6100bc4
fix: wrong naming
disaerna Jul 2, 2024
aa35663
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Aug 6, 2024
6ce10ed
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Aug 7, 2024
94ec2fb
feat: add checkboxes
disaerna Aug 8, 2024
b04d917
feat: simplify form
disaerna Aug 13, 2024
1caf7f3
feat: add organ donation to submenu
disaerna Aug 13, 2024
aa66ce3
feat: update list
disaerna Aug 13, 2024
a401f0f
fix: mobile input
disaerna Aug 13, 2024
ac617ea
fix: rewrite to fix order of checkboxes
disaerna Aug 13, 2024
7b82571
feat: add feature flag for routes
disaerna Aug 13, 2024
6dd4007
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Aug 14, 2024
48bd029
feat: remove input & fix texts
disaerna Aug 14, 2024
666b553
feat: add scopes
disaerna Aug 14, 2024
a5ceb06
fix: scope
disaerna Aug 15, 2024
a5716fc
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Aug 19, 2024
b2b1020
fix: domain build issues
disaerna Aug 19, 2024
714e131
fix: nullable error
disaerna Aug 19, 2024
6073c6e
feat: connect to graphql
disaerna Aug 19, 2024
7d4088a
Merge branch 'main' into service-portal/organ-donors-ui
disaerna Aug 19, 2024
fa619bd
fix: naming
disaerna Aug 19, 2024
a6bdd24
Merge branch 'main' into service-portal/organ-donors-ui
kodiakhq[bot] Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/auth/scopes/src/lib/api.scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum ApiScope {
intellectualProperties = '@island.is/assets/ip',
healthDentists = '@island.is/health/dentists',
healthRightsStatus = '@island.is/health/rights-status',
healthOrganDonation = '@island.is/health/organ-donation',
workMachines = '@island.is/work-machines',
vinnueftirlitid = '@island.is/applications/ver',
samgongustofaVehicles = '@island.is/applications/samgongustofa-vehicles',
Expand Down
4 changes: 4 additions & 0 deletions libs/service-portal/core/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1555,4 +1555,8 @@ export const m = defineMessages({
id: 'service.portal:read-more-about',
defaultMessage: 'Lesa meira um {arg}',
},
submit: {
id: 'service.portal:submit',
defaultMessage: 'Staðfesta',
},
})
50 changes: 50 additions & 0 deletions libs/service-portal/health/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -944,4 +944,54 @@ export const messages = defineMessages({
id: 'sp.health:medicine-calculator-add-to-purchase-label',
defaultMessage: 'Bæta {arg} við lyfjakaupalista',
},
organDonation: {
id: 'sp.health:organ-donation',
defaultMessage: 'Líffæragjöf',
},
organDonationDescription: {
id: 'sp.health:organ-donation-description',
defaultMessage:
'Íslendingar eru sjálfkrafa skráðir líffæragjafar. Þau sem vilja geta breytt afstöðu sinni.',
},
readAboutOrganDonation: {
id: 'sp.health:read-about-organ-donation',
defaultMessage: 'Lesa um líffæragjöf',
},
takeOnOrganDonation: {
id: 'sp.health:take-on-organ-donation',
defaultMessage: 'Afstaða til líffæragjafar',
},
changeTake: {
id: 'sp.health:change-take',
defaultMessage: 'Breyta afstöðu',
},
organDonationLink: {
id: 'sp.health:organ-donation-link',
defaultMessage: 'https://island.is/liffaeragjof',
},
organRegistrationOtherLabel: {
id: 'sp.health:organ-registration-other-label',
defaultMessage: 'Skrifaðu hér',
},
organRegistrationOtherText: {
id: 'sp.health:organ-registration-other-text',
defaultMessage: 'Vinsamlegast skráðu hvaða líffæri hér',
},
organLimitationsError: {
id: 'sp.health:organ-limitations-error',
defaultMessage:
'Textareitur má ekki vera tómur sé þessi valkostur valinn. ',
},
other: {
id: 'sp.health:other-lower-case',
defaultMessage: 'annað',
},
registrationComplete: {
id: 'sp.health:registration-complete',
defaultMessage: 'Skráning tókst',
},
registrationFailed: {
id: 'sp.health:registration-failed',
defaultMessage: 'Skráning mistókst',
},
})
11 changes: 11 additions & 0 deletions libs/service-portal/health/src/lib/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ export const healthNavigation: PortalNavigationItem = {
},
],
},
{
name: messages.organDonation,
path: HealthPaths.HealthOrganDonation,
children: [
{
name: messages.changeRegistration,
path: HealthPaths.HealthOrganDonationRegistration,
navHide: true,
},
],
},
],
description: m.healthDescription,
}
3 changes: 3 additions & 0 deletions libs/service-portal/health/src/lib/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ export enum HealthPaths {

HealthOverview = '/heilsa/yfirlit',

HealthOrganDonation = '/heilsa/liffaeragjof',
HealthOrganDonationRegistration = '/heilsa/liffaeragjof/skraning',

HealthTherapies = '/heilsa/thjalfun',
HealthTherapiesPhysical = '/heilsa/thjalfun/sjukrathjalfun',
HealthTherapiesSpeech = '/heilsa/thjalfun/talthjalfun',
Expand Down
22 changes: 22 additions & 0 deletions libs/service-portal/health/src/module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ const PaymentParticipation = lazy(() =>
)
const PaymentOverview = lazy(() => import('./screens/Payments/PaymentOverview'))

const OrganDonation = lazy(() =>
import('./screens/OrganDonation/OrganDonation'),
)

const OrganDonationRegistration = lazy(() =>
import('./screens/OrganDonationRegistration/RegistrationForm'),
)

export const healthModule: PortalModule = {
name: 'Heilsa',
enabled: ({ isCompany }) => !isCompany,
Expand Down Expand Up @@ -189,5 +197,19 @@ export const healthModule: PortalModule = {
enabled: userInfo.scopes.includes(ApiScope.healthDentists),
element: <DentistRegistration />,
},
{
name: hm.organDonation,
path: HealthPaths.HealthOrganDonation,
key: 'HealthOrganDonation',
enabled: userInfo.scopes.includes(ApiScope.healthOrganDonation), // TODO: Change to correct scope!
disaerna marked this conversation as resolved.
Show resolved Hide resolved
element: <OrganDonation />,
},
{
name: hm.organDonation,
path: HealthPaths.HealthOrganDonationRegistration,
key: 'HealthOrganDonation',
enabled: userInfo.scopes.includes(ApiScope.healthOrganDonation), // TODO: Change to correct scope!
element: <OrganDonationRegistration />,
},
disaerna marked this conversation as resolved.
Show resolved Hide resolved
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { useLocale, useNamespaces } from '@island.is/localization'
import { getOrganDonor } from '../../utils/OrganDonationMock'
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'
const OrganDonation = () => {
useNamespaces('sp.health')

const { formatMessage, lang } = useLocale()
const { data, loading, error } = getOrganDonor(lang)
disaerna marked this conversation as resolved.
Show resolved Hide resolved

return (
<Box>
<IntroHeader
title={formatMessage(m.organDonation)}
intro={formatMessage(m.organDonationDescription)}
/>
{!error && !loading && data.data !== null && (
<>
<Box>
<LinkResolver
href={formatMessage(m.organDonationLink)}
key="organ-donation"
>
<Button
variant="utility"
size="small"
icon="open"
iconType="outline"
>
{formatMessage(m.readAboutOrganDonation)}
</Button>
</LinkResolver>
disaerna marked this conversation as resolved.
Show resolved Hide resolved
</Box>
<Box>
<Text
variant="eyebrow"
color="purple400"
marginTop={5}
marginBottom={1}
>
{formatMessage(m.takeOnOrganDonation)}
</Text>
<ActionCard
heading={data.data.title}
text={data.data.description}
disaerna marked this conversation as resolved.
Show resolved Hide resolved
cta={{
url: HealthPaths.HealthOrganDonationRegistration,
label: formatMessage(m.changeTake),
centered: true,
}}
/>
</Box>
</>
)}
{error && !loading && <Problem error={undefined} noBorder={false} />}
{!error && !loading && data === null && (
<Problem type="no_data" noBorder={false} />
)}
</Box>
)
}

export default OrganDonation
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import {
Box,
Checkbox,
Divider,
GridColumn,
GridContainer,
GridRow,
Input,
Stack,
} from '@island.is/island-ui/core'
import React, { useState } from 'react'
import { OptionsLimitations } from '../../utils/OrganDonationMock'
import { messages } from '../..'
import { useLocale, useNamespaces } from '@island.is/localization'

interface LimitationsProps {
data: OptionsLimitations[]
}

const Limitations = ({ data }: LimitationsProps) => {
useNamespaces('sp.health')
const { formatMessage } = useLocale()
const [checked, setChecked] = useState<Array<string>>([])

const handleCheckboxChange = (id: string, isChecked: boolean) => {
setChecked((prevState) =>
isChecked ? [...prevState, id] : prevState.filter((item) => item !== id),
)
}

const input = data.find((x) => x.type === 'input')

return (
<Box marginTop={2} position="relative">
<Stack space={2}>
<Divider />
<Box display="flex" flexDirection="row" flexWrap="wrap" width="full">
{data?.map(
(y, yi) =>
y.type === 'checkbox' && (
<Box
key={`organ-donation-limitation-${yi}`}
width="half"
marginY="smallGutter"
>
<Checkbox
id={`organ-registration-form-${y.value.toLowerCase()}`}
name={`selected-limitations-${y.value.toLowerCase()}`}
label={y.value}
value={y.value.toLowerCase()}
onChange={(e) =>
handleCheckboxChange(
y.value.toLowerCase(),
e.target.checked,
)
}
/>
</Box>
),
)}
</Box>
</Stack>
{input && checked.includes(input.value.toLowerCase()) && (
<GridContainer>
<GridRow>
<GridColumn span={['7/7', '5/7']}>
<Box marginY="gutter">
<Input
id="organ-donation-limitation"
name="otherLimitatons"
textarea
label={formatMessage(messages.organRegistrationOtherLabel)}
placeholder={formatMessage(
messages.organRegistrationOtherText,
)}
maxLength={220}
/>
</Box>
</GridColumn>
</GridRow>
</GridContainer>
)}
disaerna marked this conversation as resolved.
Show resolved Hide resolved
</Box>
)
}

export default Limitations
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { style } from '@vanilla-extract/css'
import { theme } from '@island.is/island-ui/theme'

export const buttonContainer = style({
gap: theme.spacing[2],
})
Loading
Loading