Skip to content

Commit

Permalink
chore: move constants to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnigs committed Oct 23, 2024
1 parent c9fe8ed commit 42fa271
Show file tree
Hide file tree
Showing 23 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useLocale } from '@island.is/localization'
import { DatePickerController } from '@island.is/shared/form-fields'
import React, { FC, useCallback, useEffect, useState } from 'react'
import { Controller, useFormContext } from 'react-hook-form'
import { NO, YES } from '../../constants'
import { NO, YES } from '../../utils/constants'
import { useLazyIsHealthInsured } from '../../hooks/useLazyIsHealthInsured'
import { AccidentNotification } from '../../lib/dataSchema'
import { accidentDetails } from '../../lib/messages'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import is from 'date-fns/locale/is'
import parseISO from 'date-fns/parseISO'
import kennitala from 'kennitala'
import React, { FC } from 'react'
import { States, YES } from '../../constants'
import { States, YES } from '../../utils/constants'
import { AccidentNotification } from '../../lib/dataSchema'
import {
accidentDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ import {
isRepresentativeOfCompanyOrInstitute,
} from '../../../utils'
import { AttachmentsEnum } from '../../../types'
import { FILE_SIZE_LIMIT, NO, UPLOAD_ACCEPT, YES } from '../../../constants'
import {
FILE_SIZE_LIMIT,
NO,
UPLOAD_ACCEPT,
YES,
} from '../../../utils/constants'

// Injury certificate and fatal accident section
export const attachmentsSubSection = buildSubSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
isRescueWorkAccident,
isStudiesAccident,
} from '../../../utils'
import { NO, YES } from '../../../constants'
import { NO, YES } from '../../../utils/constants'
import { isSportAccidentAndEmployee } from '../../../utils/isSportAccidentAndEmployee'
import {
AgricultureAccidentLocationEnum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
isGeneralWorkplaceAccident,
} from '../../../utils'
import { isSportAccidentAndEmployee } from '../../../utils/isSportAccidentAndEmployee'
import { NO, YES } from '../../../constants'
import { NO, YES } from '../../../utils/constants'

// Workmachine information only applicable to generic workplace accidents
export const workMachineSubSection = buildSubSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@island.is/application/core'
import { juridicalPerson } from '../../../lib/messages'
import { isReportingOnBehalfOfEmployee } from '../../../utils'
import { YES } from '../../../constants'
import { YES } from '../../../utils/constants'

export const juridicalPersonCompanySubSection = buildSubSection({
id: 'juridicalPerson.company',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
buildSubSection,
} from '@island.is/application/core'
import { error, powerOfAttorney } from '../../../lib/messages'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../../constants'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../../utils/constants'
import { isUploadNow } from '../../../utils/isUploadNow'

export const powerOfAttorneyUploadSubSection = buildSubSection({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
buildSubmitField,
} from '@island.is/application/core'
import { DefaultEvents, FormValue } from '@island.is/application/types'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../constants'
import { FILE_SIZE_LIMIT, UPLOAD_ACCEPT } from '../../utils/constants'
import { addDocuments, error } from '../../lib/messages'
import {
hasReceivedInjuryCertificate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import set from 'lodash/set'
import { assign } from 'xstate'
import { AccidentTypeEnum, ReviewApprovalEnum } from '..'
import { States } from '../constants'
import { States } from '../utils/constants'
import { ApiActions } from '../shared'
import { WhoIsTheNotificationForEnum } from '../types'
import { AccidentNotificationSchema } from './dataSchema'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { applicantInformationSchema } from '@island.is/application/ui-forms'
import * as kennitala from 'kennitala'
import { z } from 'zod'
import { YES } from '../constants'
import { YES } from '../utils/constants'
import {
AccidentTypeEnum,
AgricultureAccidentLocationEnum,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NO, YES } from './../constants'
import { NO, YES } from '../utils/constants'

export type CompanyInfo = {
nationalRegistrationId: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormValue } from '@island.is/application/types'
import { YES } from '../constants'
import { YES } from './constants'
import { AccidentTypeEnum, WorkAccidentTypeEnum } from '../types'
import { getWorkplaceData } from './getWorkplaceData'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
hasReceivedAllDocuments,
} from './hasMissingDocuments'
import { WhoIsTheNotificationForEnum, AttachmentsEnum } from '../types'
import { NO, YES } from '../constants'
import { NO, YES } from './constants'
import { FormatMessage } from '@island.is/localization'
import { FormValue } from '@island.is/application/types'
import { AccidentNotification } from '../lib/dataSchema'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getValueViaPath } from '@island.is/application/core'
import { FormValue } from '@island.is/application/types'
import { FormatMessage } from '@island.is/localization'
import { AttachmentsEnum, FileType, WhoIsTheNotificationForEnum } from '..'
import { YES } from '../constants'
import { YES } from './constants'
import { attachments } from '../lib/messages'
import {
AccidentNotificationAttachmentStatus,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormatMessage } from '@island.is/localization'
import { YES } from '../constants'
import { YES } from './constants'
import { AccidentNotification } from '../lib/dataSchema'
import { AttachmentsEnum, WhoIsTheNotificationForEnum } from '../types'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AttachmentsEnum, FileType, WhoIsTheNotificationForEnum } from '..'
import { getValueViaPath } from '@island.is/application/core'
import { YES } from '../constants'
import { YES } from './constants'
import { AccidentNotification } from '../lib/dataSchema'
import { attachments, overview } from '../lib/messages'
import { FormatMessage } from '@island.is/localization'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FormValue } from '@island.is/application/types'
import { isFatalAccident } from './isFatalAccident'
import { NO, YES } from '../constants'
import { NO, YES } from './constants'

describe('isFatalAccident', () => {
const fatal: FormValue = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getValueViaPath } from '@island.is/application/core'
import { FormValue } from '@island.is/application/types'
import { YES } from '../constants'
import { YES } from './constants'
import { YesOrNo } from '../types'

export const isFatalAccident = (formValue: FormValue) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormValue } from '@island.is/application/types'
import { NO, YES } from '../constants'
import { NO, YES } from './constants'
import { AccidentTypeEnum, WorkAccidentTypeEnum } from '../types'
import { isMachineRelatedAccident } from './isMachineRelatedAccident'
describe('isMachineRelatedAccident', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getValueViaPath } from '@island.is/application/core'
import { FormValue } from '@island.is/application/types'
import { YES } from '../constants'
import { YES } from './constants'
import { YesOrNo } from '../types'
import { isGeneralWorkplaceAccident } from './isGeneralWorkplaceAccident'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
isInjuredAndRepresentativeOfCompanyOrInstitute,
isRepresentativeOfCompanyOrInstitute,
} from './isRepresentativeOfCompanyOrInstitute'
import { NO, YES } from '../constants'
import { NO, YES } from './constants'

const emptyObject = {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getValueViaPath } from '@island.is/application/core'
import { FormValue } from '@island.is/application/types'
import { YES } from '../constants'
import { YES } from './constants'
import { WhoIsTheNotificationForEnum } from '../types'

export const isRepresentativeOfCompanyOrInstitute = (formValue: FormValue) => {
Expand Down

0 comments on commit 42fa271

Please sign in to comment.