Skip to content

Commit

Permalink
feat(health-insurance): zod for health insurance (#16379)
Browse files Browse the repository at this point in the history
* chore: little housekeeping

* feat: organize files, translate countries

* feat: expand zod, codesplit, remove custom components

* feat: import options

* chore: add comment

* fix YesNo to YesOrNo

* Update libs/application/templates/health-insurance/src/forms/HealthInsuranceForm/confirmSection.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* feat: simplify logic for conditions

* chore: update imports

* chore; remove unused svg

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 14, 2024
1 parent 166f7d6 commit ef14e1c
Show file tree
Hide file tree
Showing 47 changed files with 1,845 additions and 2,947 deletions.
2 changes: 1 addition & 1 deletion libs/application/templates/health-insurance/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"extract-strings": {
"executor": "nx:run-commands",
"options": {
"command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract libs/application/templates/health-insurance/src/forms/messages.ts"
"command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract libs/application/templates/health-insurance/src/lib/messages/*.ts"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React, { FC } from 'react'

const Logo: FC<React.PropsWithChildren<unknown>> = () => (
export const Logo = () => (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1300 323.32">
<path
d="M184.06 192.43C183.93 174.59 180.99 161.17 175.12 150.65C172.12 145.3 168.39 140.83 164.23 137.15C160.07 133.47 155.53 130.57 150.85 128.1C137.257 120.94 123.667 113.78 110.08 106.62C106.36 104.66 103.19 102.58 100.51 100.21C96.5103 96.63 93.4503 92.46 91.0603 85.97C88.7003 79.49 87.1903 70.57 87.2003 58.25V21.31C87.2003 20.79 87.3903 20.35 87.7803 19.95C88.1803 19.57 88.6103 19.38 89.1403 19.38H162.77C163.29 19.38 163.73 19.57 164.13 19.95C164.51 20.35 164.7 20.79 164.71 21.31V58.46H184.09V21.31C184.05 9.53 174.56 0.03 162.78 0H89.1503C77.3603 0.04 67.8803 9.53 67.8403 21.31V58.26C67.8403 76.7 70.7803 90.49 76.7903 101.24C79.7803 106.59 83.5203 111.06 87.6803 114.73C91.8403 118.41 96.3803 121.31 101.06 123.77C114.654 130.937 128.244 138.097 141.83 145.25C145.55 147.22 148.72 149.29 151.4 151.66C155.4 155.24 158.47 159.41 160.85 165.9C163.21 172.38 164.72 181.29 164.71 193.62V230.57C164.71 231.1 164.52 231.53 164.13 231.93C163.74 232.31 163.3 232.5 162.77 232.51H89.1403C88.6103 232.51 88.1803 232.31 87.7803 231.93C87.4003 231.54 87.2103 231.1 87.2003 230.57V193.42H67.8203V230.57C67.8603 242.36 77.3503 251.84 89.1303 251.88H162.76C174.54 251.84 184.03 242.35 184.07 230.57V192.43H184.06Z"
Expand Down Expand Up @@ -80,5 +78,3 @@ const Logo: FC<React.PropsWithChildren<unknown>> = () => (
/>
</svg>
)

export default Logo

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React, { FC } from 'react'
import { getValueViaPath } from '@island.is/application/core'
import { FieldBaseProps } from '@island.is/application/types'
import { Input, Box } from '@island.is/island-ui/core'
import { useFormContext } from 'react-hook-form'
import { MissingInfoType } from '../../types'
import { MissingInfoType } from '../../utils/types'

const HiddenDateField: FC<React.PropsWithChildren<FieldBaseProps>> = ({
application,
}) => {
export const HiddenDateField = ({ application }: FieldBaseProps) => {
const { register } = useFormContext()
const missingInfo =
(getValueViaPath(
Expand All @@ -31,5 +28,3 @@ const HiddenDateField: FC<React.PropsWithChildren<FieldBaseProps>> = ({
</Box>
)
}

export default HiddenDateField
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, { FC } from 'react'
import { formatText, getValueViaPath } from '@island.is/application/core'
import { Input } from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { useFormContext } from 'react-hook-form'
import { m } from '../../forms/messages'
import { MissingInfoType, ReviewFieldProps } from '../../types'
import { m } from '../../lib/messages/messages'
import { MissingInfoType, ReviewFieldProps } from '../../utils/types'

const MissingInfoRemarks: FC<React.PropsWithChildren<ReviewFieldProps>> = ({
export const MissingInfoRemarks = ({
application,
isEditable = true,
index = 0,
}) => {
}: ReviewFieldProps) => {
const { register } = useFormContext()
const { formatMessage } = useLocale()

Expand Down Expand Up @@ -40,5 +39,3 @@ const MissingInfoRemarks: FC<React.PropsWithChildren<ReviewFieldProps>> = ({
/>
)
}

export default MissingInfoRemarks
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { FC } from 'react'
import { m } from '../../forms/messages'
import { m } from '../../lib/messages/messages'
import { FieldBaseProps } from '@island.is/application/types'
import { Box } from '@island.is/island-ui/core'
import SummaryItem from './SummaryItem'
import { SummaryItem } from './SummaryItem'
import {
hasHealthInsurance,
hasNoIcelandicAddress,
} from '../../healthInsuranceUtils'
import { useLocale } from '@island.is/localization'

const PrerequisiteSummary: FC<React.PropsWithChildren<FieldBaseProps>> = ({
application,
}) => {
export const PrerequisiteSummary = ({ application }: FieldBaseProps) => {
const { formatMessage } = useLocale()
const externalData = application.externalData

Expand Down Expand Up @@ -78,7 +75,7 @@ const PrerequisiteSummary: FC<React.PropsWithChildren<FieldBaseProps>> = ({
{prerequisites.map((prerequisite, i) => {
return (
<SummaryItem
key={i}
key={`${prerequisite.name}-${i}`}
index={i + 1}
application={application}
{...prerequisite}
Expand All @@ -88,5 +85,3 @@ const PrerequisiteSummary: FC<React.PropsWithChildren<FieldBaseProps>> = ({
</Box>
)
}

export default PrerequisiteSummary
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { FC } from 'react'
import { Box, Button, Icon, Tag, Text } from '@island.is/island-ui/core'

import * as styles from './SummaryItem.css'
Expand All @@ -23,7 +22,7 @@ type SummaryItemProps = {
tagText: string
}

const SummaryItem: FC<React.PropsWithChildren<SummaryItemProps>> = ({
export const SummaryItem = ({
title,
description,
furtherInformationTitle,
Expand All @@ -33,7 +32,7 @@ const SummaryItem: FC<React.PropsWithChildren<SummaryItemProps>> = ({
buttonLink,
tagText,
index,
}) => {
}: SummaryItemProps) => {
return (
<Box
position="relative"
Expand Down Expand Up @@ -98,5 +97,3 @@ const SummaryItem: FC<React.PropsWithChildren<SummaryItemProps>> = ({
</Box>
)
}

export default SummaryItem
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { FC } from 'react'
import { useFormContext } from 'react-hook-form'
import { formatText, getValueViaPath } from '@island.is/application/core'
import {
Expand All @@ -10,16 +9,14 @@ import {
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { FieldDescription } from '@island.is/shared/form-fields'
import { m } from '../../forms/messages'
import { m } from '../../lib/messages/messages'
import {
ExternalDataNationalRegistry,
ExternalDataUserProfile,
ReviewFieldProps,
} from '../../types'
} from '../../utils/types'

const ContactInfo: FC<React.PropsWithChildren<ReviewFieldProps>> = ({
application,
}) => {
export const ContactInfo = ({ application }: ReviewFieldProps) => {
const { register } = useFormContext()
const { formatMessage } = useLocale()

Expand Down Expand Up @@ -133,5 +130,3 @@ const ContactInfo: FC<React.PropsWithChildren<ReviewFieldProps>> = ({
</Box>
)
}

export default ContactInfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useState } from 'react'
import { useState } from 'react'
import { useFormContext } from 'react-hook-form'
import { formatText, getValueViaPath } from '@island.is/application/core'
import {
Expand All @@ -14,25 +14,25 @@ import {
FieldDescription,
RadioController,
} from '@island.is/shared/form-fields'
import TextWithTooltip from '../TextWithTooltip/TextWithTooltip'
import { YES, NO, FILE_SIZE_LIMIT } from '../../shared'
import { m } from '../../forms/messages'
import { TextWithTooltip } from '../TextWithTooltip/TextWithTooltip'
import { m } from '../../lib/messages/messages'
import {
FormerInsurance as FormerInsuranceType,
ReviewFieldProps,
} from '../../types'
} from '../../utils/types'
import {
requireConfirmationOfResidency,
extractKeyFromStringObject,
} from '../../healthInsuranceUtils'
import { FileUploadController } from '@island.is/application/ui-components'
import { FILE_SIZE_LIMIT, NO, YES } from '../../utils/constants'

const FormerInsurance: FC<React.PropsWithChildren<ReviewFieldProps>> = ({
export const FormerInsurance = ({
application,
isEditable,
field,
error,
}) => {
}: ReviewFieldProps) => {
const { register } = useFormContext()
const { formatMessage } = useLocale()

Expand Down Expand Up @@ -251,5 +251,3 @@ const FormerInsurance: FC<React.PropsWithChildren<ReviewFieldProps>> = ({
</Box>
)
}

export default FormerInsurance
Loading

0 comments on commit ef14e1c

Please sign in to comment.