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(application-system): Refactoring half of divider field into a new field #17273

Merged
merged 21 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
47fa079
Creating new shared field from extra stuff in divider field
HjorturJ Dec 17, 2024
611a057
chore: nx format:write update dirty files
andes-it Dec 17, 2024
5529f91
Updating default value of title form field
HjorturJ Dec 18, 2024
6594d2b
Merge branch 'fix/divider-field-refactor' of github.com:island-is/isl…
HjorturJ Dec 18, 2024
abff642
chore: nx format:write update dirty files
andes-it Dec 18, 2024
83ead82
Removing most of the empty title title form fields
HjorturJ Dec 18, 2024
d781040
Merge branch 'fix/divider-field-refactor' of github.com:island-is/isl…
HjorturJ Dec 18, 2024
5a3e748
chore: nx format:write update dirty files
andes-it Dec 18, 2024
11b56cf
Extending divider form field usability
HjorturJ Dec 18, 2024
a9e87c4
removing dark400 since its the default value
HjorturJ Dec 18, 2024
ff055fa
Create TitleFormField.stories.mdx
HjorturJ Dec 18, 2024
a1ddebc
Merge branch 'main' into fix/divider-field-refactor
HjorturJ Dec 18, 2024
378cfdc
chore: nx format:write update dirty files
andes-it Dec 18, 2024
9737d65
Adding info to the reference template
HjorturJ Dec 18, 2024
7b12566
Merge branch 'fix/divider-field-refactor' of github.com:island-is/isl…
HjorturJ Dec 18, 2024
8a48efd
chore: nx format:write update dirty files
andes-it Dec 18, 2024
e119ff6
Update DividerFormField.tsx
HjorturJ Dec 19, 2024
2c032ba
Merge branch 'fix/divider-field-refactor' of github.com:island-is/isl…
HjorturJ Dec 19, 2024
d1f6c9b
Merge branch 'main' into fix/divider-field-refactor
HjorturJ Dec 19, 2024
65e52e9
Merge branch 'main' into fix/divider-field-refactor
HjorturJ Jan 6, 2025
a5c2c82
Merge branch 'main' into fix/divider-field-refactor
kodiakhq[bot] Jan 6, 2025
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
38 changes: 35 additions & 3 deletions libs/application/core/src/lib/fieldBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import {
FieldsRepeaterField,
AccordionField,
BankAccountField,
TitleField,
TitleVariants,
} from '@island.is/application/types'
import { Locale } from '@island.is/shared/types'
import { Colors } from '@island.is/island-ui/theme'
Expand Down Expand Up @@ -397,19 +399,43 @@ export const buildFileUploadField = (

export const buildDividerField = (data: {
condition?: Condition
title?: FormText
color?: Colors
useDividerLine?: boolean
marginBottom?: BoxProps['marginBottom']
marginTop?: BoxProps['marginTop']
}): DividerField => {
const { title, color, condition, marginTop, marginBottom } = data
const { useDividerLine = true, condition, marginTop, marginBottom } = data
return {
id: '',
children: undefined,
type: FieldTypes.DIVIDER,
component: FieldComponents.DIVIDER,
doesNotRequireAnswer: true,
title: '',
useDividerLine,
condition,
marginTop,
marginBottom,
}
}

export const buildTitleField = (data: {
condition?: Condition
title?: FormText
titleVariant?: TitleVariants
color?: Colors
marginBottom?: BoxProps['marginBottom']
marginTop?: BoxProps['marginTop']
}): TitleField => {
const { title, titleVariant, color, condition, marginTop, marginBottom } =
data
return {
id: '',
children: undefined,
type: FieldTypes.TITLE,
component: FieldComponents.TITLE,
doesNotRequireAnswer: true,
title: title ?? '',
titleVariant: titleVariant,
color,
condition,
marginTop,
Expand All @@ -428,6 +454,8 @@ export const buildKeyValueField = (data: {
paddingX?: BoxProps['padding']
paddingY?: BoxProps['padding']
paddingBottom?: BoxProps['padding']
marginTop?: BoxProps['marginTop']
marginBottom?: BoxProps['marginBottom']
}): KeyValueField => {
const {
label,
Expand All @@ -440,6 +468,8 @@ export const buildKeyValueField = (data: {
paddingX,
paddingY,
paddingBottom,
marginTop,
marginBottom,
} = data

return {
Expand All @@ -459,6 +489,8 @@ export const buildKeyValueField = (data: {
paddingX,
paddingY,
paddingBottom,
marginTop,
marginBottom,
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
buildCheckboxField,
buildDividerField,
buildMultiField,
buildNationalIdWithNameField,
buildPhoneField,
buildSubSection,
buildSubmitField,
buildTextField,
buildTitleField,
getValueViaPath,
} from '@island.is/application/core'
import { information } from '../../../lib/messages'
Expand Down Expand Up @@ -73,7 +73,7 @@ export const supervisorSubSection = buildSubSection({
},
required: true,
}),
buildDividerField({
buildTitleField({
title: location.general.title,
color: 'black',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
buildTextField,
buildDateField,
buildSubSection,
buildDividerField,
buildPhoneField,
buildTitleField,
} from '@island.is/application/core'
import { information } from '../../../lib/messages'
import { getSelectedMachine } from '../../../utils/getSelectedMachine'
Expand Down Expand Up @@ -117,8 +117,9 @@ export const machineSubSection = buildSubSection({
},
defaultValue: new Date().toISOString().substring(0, 10),
}),
buildDividerField({
buildTitleField({
title: information.general.dividerTitle,
color: 'blue400',
}),
HjorturJ marked this conversation as resolved.
Show resolved Hide resolved
buildTextField({
id: 'contact.name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
buildSection,
buildTextField,
buildSubmitField,
buildDividerField,
buildDescriptionField,
buildCheckboxField,
buildLinkField,
buildTitleField,
} from '@island.is/application/core'
import { Form, ApplicationTypes, FormModes } from '@island.is/application/types'
import { m } from '../lib/messages'
Expand Down Expand Up @@ -184,8 +184,7 @@ export const DocumentProviderOnboarding: Form = buildForm({
title: m.confirmationTitle,
description: m.confirmationSubTitle,
children: [
//Error in dev tools, missing keys on divider fields...
buildDividerField({
buildTitleField({
title: m.applicantSection,
color: 'currentColor',
HjorturJ marked this conversation as resolved.
Show resolved Hide resolved
}),
Expand Down Expand Up @@ -213,8 +212,7 @@ export const DocumentProviderOnboarding: Form = buildForm({
format: '###-####',
placeholder: m.applicantPhoneNumberPlaceholder,
}),
//Error in dev tools, missing keys on divider fields...
buildDividerField({
buildTitleField({
title: m.administrativeContactSection,
color: 'currentColor',
}),
Expand All @@ -236,8 +234,7 @@ export const DocumentProviderOnboarding: Form = buildForm({
format: '###-####',
placeholder: m.administrativeContactPhoneNumberPlaceholder,
}),
//Error in dev tools, missing keys on divider fields...
buildDividerField({
buildTitleField({
title: m.technicalContactSection,
color: 'currentColor',
}),
Expand All @@ -259,8 +256,7 @@ export const DocumentProviderOnboarding: Form = buildForm({
format: '###-####',
placeholder: m.technicalContactPhoneNumberPlaceHolder,
}),
//Error in dev tools, missing keys on divider fields...
buildDividerField({
buildTitleField({
title: m.helpDeskSection,
color: 'currentColor',
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
buildDividerField,
buildForm,
buildMultiField,
buildSection,
buildDescriptionField,
buildTextField,
buildSubmitField,
buildTitleField,
} from '@island.is/application/core'
import {
Form,
Expand All @@ -28,8 +28,7 @@ export const ReviewApplication: Form = buildForm({
id: 'review',
title: m.reviewTitle,
children: [
//Error in dev tools, missing keys on divider fields...
buildDividerField({ title: m.applicantTitle }),
buildTitleField({ title: m.applicantTitle, color: 'blue400' }),
buildTextField({
id: 'applicant.nationalId',
title: m.applicantNationalId,
Expand All @@ -52,9 +51,9 @@ export const ReviewApplication: Form = buildForm({
format: '###-####',
placeholder: '000-0000',
}),
//Error in dev tools, missing keys on divider fields...
buildDividerField({
buildTitleField({
title: m.administrativeContactTitle,
color: 'blue400',
}),
buildTextField({
id: 'administrativeContact.name',
Expand All @@ -73,8 +72,10 @@ export const ReviewApplication: Form = buildForm({
format: '###-####',
placeholder: '000-0000',
}),
//Error in dev tools, missing keys on divider fields...
buildDividerField({ title: m.technicalContactTitle }),
buildTitleField({
title: m.technicalContactTitle,
color: 'blue400',
}),
buildTextField({
id: 'technicalContact.name',
title: m.technicalContactName,
Expand All @@ -92,8 +93,7 @@ export const ReviewApplication: Form = buildForm({
format: '###-####',
placeholder: '000-0000',
}),
//Error in dev tools, missing keys on divider fields...
buildDividerField({ title: m.helpDeskTitle }),
buildTitleField({ title: m.helpDeskTitle, color: 'blue400' }),
buildTextField({
id: 'helpDesk.email',
title: m.helpDeskEmail,
Expand All @@ -106,7 +106,6 @@ export const ReviewApplication: Form = buildForm({
format: '###-####',
placeholder: '000-0000',
}),
//Error in dev tools, missing keys on radio controller...
buildSubmitField({
id: 'approvedByReviewer',
title: m.reviewQuestion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
buildTextField,
buildSubSection,
buildPhoneField,
buildTitleField,
} from '@island.is/application/core'
import {
Application,
Expand Down Expand Up @@ -46,8 +47,8 @@ export const subSectionTempInfo = buildSubSection({
condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65,
}),
buildDividerField({
title: '',
color: 'dark400',
marginTop: 5,
useDividerLine: false,
}),
buildKeyValueField({
label: m.informationFullName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
buildCheckboxField,
buildCustomField,
buildDividerField,
buildFileUploadField,
buildMultiField,
buildRadioField,
buildSection,
buildSubmitField,
buildTextField,
buildTitleField,
} from '@island.is/application/core'
import { m } from '../../lib/messages/messages'
import { FILE_SIZE_LIMIT, YES } from '../../utils/constants'
Expand Down Expand Up @@ -56,15 +56,7 @@ export const confirmSection = buildSection({
uploadHeader: m.fileUploadHeader,
uploadDescription: m.fileUploadDescription,
uploadButtonLabel: m.fileUploadButton,
condition: {
questionId: 'hasAdditionalInfo',
comparator: Comparators.EQUALS,
value: YES,
},
}),
buildDividerField({
title: ' ',
color: 'transparent',
marginBottom: 5,
condition: {
questionId: 'hasAdditionalInfo',
comparator: Comparators.EQUALS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
buildSection,
buildSelectField,
buildTextField,
getValueViaPath,
buildTitleField,
} from '@island.is/application/core'
import { m } from '../../lib/messages/messages'
import { FormValue } from '@island.is/application/types'
Expand Down Expand Up @@ -90,8 +90,8 @@ export const formerInsuranceSection = buildSection({
},
}),
buildDividerField({
title: ' ',
color: 'transparent',
marginTop: 5,
useDividerLine: false,
}),
buildDescriptionField({
id: 'formerInsurance.entitlementDescription',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {
buildCheckboxField,
buildCustomField,
buildDescriptionField,
buildDividerField,
buildFileUploadField,
buildForm,
buildMultiField,
buildSection,
buildSubmitField,
buildTitleField,
getValueViaPath,
} from '@island.is/application/core'
import { Application, Form, FormModes, YES } from '@island.is/application/types'
Expand Down Expand Up @@ -38,9 +38,8 @@ export const MissingInfoForm: Form = buildForm({
getValueViaPath<string>(application.answers, 'agentComments') ??
m.agentCommentsEmpty,
}),
buildDividerField({
buildTitleField({
title: m.missingInfoAnswersTitle,
color: 'dark400',
}),
buildCustomField({
id: 'missingInfo.date',
Expand All @@ -57,9 +56,8 @@ export const MissingInfoForm: Form = buildForm({
title: '',
introduction: '',
}),
buildDividerField({
buildTitleField({
title: m.previousAnswersTitle,
color: 'dark400',
}),
buildCustomField({
id: 'submittedData',
Expand Down
4 changes: 3 additions & 1 deletion libs/application/templates/passport/src/forms/ParentB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
buildMultiField,
buildSection,
buildSubmitField,
buildTitleField,
getValueViaPath,
} from '@island.is/application/core'
import {
Expand Down Expand Up @@ -52,7 +53,8 @@ export const ParentB: Form = buildForm({
}),
children: [
buildDividerField({
title: ' ',
marginTop: 5,
useDividerLine: false,
}),
],
}),
Expand Down
Loading
Loading