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

fix(my-pages): small tweaks for vaccinations #17138

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@
"schema": { "type": "string" }
},
{
"name": "age",
"name": "agePatient",
"required": true,
"in": "query",
"schema": { "type": "number" }
Expand All @@ -613,6 +613,12 @@
"required": true,
"in": "query",
"schema": { "type": "array", "items": { "type": "string" } }
},
{
"name": "vaccineCodes",
"required": true,
"in": "query",
"schema": { "type": "array", "items": { "type": "string" } }
}
],
"responses": {
Expand Down Expand Up @@ -820,6 +826,7 @@
"diseaseId": { "type": "string" },
"order": { "type": "number" },
"type": { "type": "object" },
"vaccineCodes": { "type": "string" },
disaerna marked this conversation as resolved.
Show resolved Hide resolved
"cond1Type": { "type": "string" },
"cond1Min": { "type": "number" },
"cond1Max": { "type": "number" },
Expand Down Expand Up @@ -859,6 +866,7 @@
"description": { "type": "string" },
"isFeatured": { "type": "boolean" },
"isVisible": { "type": "boolean" },
"hideIfNoVaccinations": { "type": "boolean" },
"vaccines": {
"type": "array",
"items": { "$ref": "#/components/schemas/VaccineDiseaseDto" }
Expand All @@ -877,6 +885,7 @@
"name",
"isFeatured",
"isVisible",
"hideIfNoVaccinations",
"vaccines",
"rules",
"translations"
Expand All @@ -890,6 +899,7 @@
"description": { "type": "string" },
"isFeatured": { "type": "boolean" },
"isVisible": { "type": "boolean" },
"hideIfNoVaccinations": { "type": "boolean" },
"vaccines": {
"type": "array",
"items": { "$ref": "#/components/schemas/VaccineDiseaseDto" }
Expand All @@ -909,6 +919,7 @@
"properties": {
"order": { "type": "number" },
"type": { "type": "object" },
"vaccineCodes": { "type": "string" },
"cond1Type": { "type": "string" },
"cond1Min": { "type": "number" },
"cond1Max": { "type": "number" },
Expand Down Expand Up @@ -938,6 +949,7 @@
"diseaseId": { "type": "string" },
"order": { "type": "number" },
"type": { "type": "object" },
"vaccineCodes": { "type": "string" },
"cond1Type": { "type": "string" },
"cond1Min": { "type": "number" },
"cond1Max": { "type": "number" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useMemo, useState } from 'react'
import {
Text,
Table as T,
Icon,
TagVariant,
Table as T,
Tag,
TagVariant,
Text,
} from '@island.is/island-ui/core'
import * as styles from './SortableTable.css'
import React, { useMemo, useState } from 'react'
import { ExpandHeader, ExpandRow } from '../ExpandableTable'
import * as styles from './SortableTable.css'

type ConfigType = { direction: 'ascending' | 'descending'; key: string }

Expand Down Expand Up @@ -166,7 +166,7 @@ export const SortableTable = (props: SortableTableProps) => {
data={valueItems.map((valueItem, i) => ({
value:
valueItems.length - 1 === i && tag ? (
<Tag variant={tag} outlined={props.tagOutlined}>
<Tag variant={tag} outlined={props.tagOutlined} disabled>
{valueItem}
</Tag>
) : (
Expand All @@ -187,7 +187,11 @@ export const SortableTable = (props: SortableTableProps) => {
return (
<T.Data key={`body-${id}-${i}`}>
{lastItem && tag ? (
<Tag variant={tag} outlined={props.tagOutlined}>
<Tag
variant={tag}
outlined={props.tagOutlined}
disabled
>
{valueItem}
</Tag>
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { useUserInfo } from '@island.is/react-spa/bff'
import {
AlertMessage,
Box,
Text,
Button,
GridColumn,
GridRow,
Icon,
SkeletonLoader,
Stack,
Text,
toast,
Icon,
} from '@island.is/island-ui/core'
import { useLocale, useNamespaces } from '@island.is/localization'
import { Problem } from '@island.is/react-spa/shared'
import {
IntroHeader,
IntroWrapper,
SJUKRATRYGGINGAR_SLUG,
StackWithBottomDivider,
UserInfoLine,
Expand All @@ -24,6 +22,8 @@ import {
isDateAfterToday,
m,
} from '@island.is/portals/my-pages/core'
import { useUserInfo } from '@island.is/react-spa/bff'
import { Problem } from '@island.is/react-spa/shared'
import { useEffect, useState } from 'react'
import { messages } from '../../lib/messages'
import { HealthPaths } from '../../lib/paths'
Expand Down Expand Up @@ -85,15 +85,13 @@ export const HealthOverview = () => {
)

return (
<Box>
<Box marginBottom={CONTENT_GAP_LG}>
<IntroHeader
title={formatMessage(user.profile.name)}
intro={formatMessage(messages.overviewIntro)}
serviceProviderSlug={SJUKRATRYGGINGAR_SLUG}
serviceProviderTooltip={formatMessage(messages.healthTooltip)}
/>
</Box>
<IntroWrapper
marginBottom={CONTENT_GAP_LG}
title={formatMessage(user.profile.name)}
intro={formatMessage(messages.overviewIntro)}
serviceProviderSlug={SJUKRATRYGGINGAR_SLUG}
serviceProviderTooltip={formatMessage(messages.healthTooltip)}
>
{error ? (
disaerna marked this conversation as resolved.
Show resolved Hide resolved
<Problem error={error} noBorder={false} />
) : loading ? (
Expand Down Expand Up @@ -209,7 +207,7 @@ export const HealthOverview = () => {
)}
</Stack>
)}
</Box>
</IntroWrapper>
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useLocale, useNamespaces } from '@island.is/localization'
import { Box, SkeletonLoader, Tabs } from '@island.is/island-ui/core'
import { useLocale, useNamespaces } from '@island.is/localization'
import {
EmptyTable,
HEALTH_DIRECTORATE_SLUG,
IntroHeader,
IntroWrapper,
LinkButton,
EmptyTable,
} from '@island.is/portals/my-pages/core'
import { Problem } from '@island.is/react-spa/shared'
import { isDefined } from '@island.is/shared/utils'
import { messages as m } from '../../lib/messages'
import { SECTION_GAP } from '../../utils/constants'
import { useGetVaccinationsQuery } from './Vaccinations.generated'
import { SortedVaccinationsTable } from './tables/SortedVaccinationsTable'
import { isDefined } from '@island.is/shared/utils'
import { Problem } from '@island.is/react-spa/shared'

export const VaccinationsWrapper = () => {
useNamespaces('sp.health')
Expand Down Expand Up @@ -39,13 +39,12 @@ export const VaccinationsWrapper = () => {
].filter(isDefined)

return (
<Box>
<IntroHeader
title={formatMessage(m.vaccinations)}
intro={formatMessage(m.vaccinationsIntro)}
serviceProviderSlug={HEALTH_DIRECTORATE_SLUG}
serviceProviderTooltip={formatMessage(m.landlaeknirVaccinationsTooltip)}
/>
<IntroWrapper
title={formatMessage(m.vaccinations)}
intro={formatMessage(m.vaccinationsIntro)}
serviceProviderSlug={HEALTH_DIRECTORATE_SLUG}
serviceProviderTooltip={formatMessage(m.landlaeknirVaccinationsTooltip)}
>
{/* Buttons */}
<Box printHidden display="flex" flexDirection="row" marginBottom={6}>
<LinkButton
Expand Down Expand Up @@ -91,7 +90,7 @@ export const VaccinationsWrapper = () => {
/>
</Box>
)}
</Box>
</IntroWrapper>
)
}
export default VaccinationsWrapper
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { HealthDirectorateVaccination } from '@island.is/api/schema'
import { Box } from '@island.is/island-ui/core'
import { useLocale, useNamespaces } from '@island.is/localization'
import {
EmptyTable,
Expand All @@ -6,10 +8,8 @@ import {
} from '@island.is/portals/my-pages/core'
import { messages } from '../../../lib/messages'
import { tagSelector } from '../../../utils/tagSelector'
import { VaccinationsDetailTable } from './VaccinationsDetailTable'
import { DetailHeader, DetailRow } from '../../../utils/types'
import { HealthDirectorateVaccination } from '@island.is/api/schema'
import { Box } from '@island.is/island-ui/core'
import { VaccinationsDetailTable } from './VaccinationsDetailTable'

interface Props {
data?: Array<HealthDirectorateVaccination>
Expand Down Expand Up @@ -48,7 +48,7 @@ export const SortedVaccinationsTable = ({ data }: Props) => {
}}
tagOutlined
expandable
defaultSortByKey="vaccine"
defaultSortByKey="status"
items={
data.map((item, i) => ({
id: item?.id ?? `${i}`,
Expand Down
Loading