From bdf9895027036e82ed7ebd61179b7fa564def09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Thu, 4 Jul 2024 16:12:57 +0000 Subject: [PATCH 1/8] fix(j-s): Case file drag fixes (#15429) Co-authored-by: unakb Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../IndictmentsCaseFilesAccordionItem.tsx | 53 ++++++++++++------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/apps/judicial-system/web/src/components/AccordionItems/IndictmentsCaseFilesAccordionItem/IndictmentsCaseFilesAccordionItem.tsx b/apps/judicial-system/web/src/components/AccordionItems/IndictmentsCaseFilesAccordionItem/IndictmentsCaseFilesAccordionItem.tsx index 5103461b38d6..7616581dfdf7 100644 --- a/apps/judicial-system/web/src/components/AccordionItems/IndictmentsCaseFilesAccordionItem/IndictmentsCaseFilesAccordionItem.tsx +++ b/apps/judicial-system/web/src/components/AccordionItems/IndictmentsCaseFilesAccordionItem/IndictmentsCaseFilesAccordionItem.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect, useMemo, useState } from 'react' +import React, { FC, PointerEvent, useEffect, useMemo, useState } from 'react' import InputMask from 'react-input-mask' import { useIntl } from 'react-intl' import { useMeasure } from 'react-use' @@ -209,6 +209,33 @@ const CaseFile: FC = (props) => { return formatDate(caseFile.displayDate ?? caseFile.created, DDMMYYYY) }, [caseFile.displayDate, caseFile.created]) + const getCursorStyle = () => { + if (caseFile.isDivider || caseFile.isHeading) { + return 'default' + } + + return isDragging ? 'grabbing' : 'grab' + } + + const handlePointerDown = (evt: PointerEvent) => { + if (caseFile.isDivider || caseFile.isHeading) { + return + } + + // Prevents text selection when dragging + evt.preventDefault() + + setIsDragging(true) + controls.start(evt) + } + + const handlePointerUp = () => { + if (isDragging) { + onReorder(caseFile.id) + } + setIsDragging(false) + } + return ( = (props) => { style={{ y, boxShadow, + cursor: getCursorStyle(), }} className={styles.reorderItem} dragListener={false} dragControls={controls} - onPointerDown={(evt) => { - controls.start(evt) - // Prevents text selection when dragging - evt.preventDefault() - }} + onPointerDown={handlePointerDown} + onPointerUp={handlePointerUp} + drag > {caseFile.isHeading && caseFile.chapter !== undefined && @@ -238,25 +264,12 @@ const CaseFile: FC = (props) => { {caseFile.displayText?.split('|')[1]} ) : ( -
{ - if (isDragging) { - onReorder(caseFile.id) - } - setIsDragging(false) - }} - > +
{ - setIsDragging(true) - controls.start(e) - }} > From 48e406eb6d62a01ecbb7f64bc4185c158bce8373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Thu, 4 Jul 2024 16:18:49 +0000 Subject: [PATCH 2/8] fix(service-portal): empty table heading for finance (#15273) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/components/ExpandableTable/Header.tsx | 44 ++++++++++--------- libs/service-portal/core/src/utils/utils.ts | 4 ++ .../FinanceLoans/FinanceLoansTable.tsx | 2 +- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/libs/service-portal/core/src/components/ExpandableTable/Header.tsx b/libs/service-portal/core/src/components/ExpandableTable/Header.tsx index a6f419490a89..8408a2559252 100644 --- a/libs/service-portal/core/src/components/ExpandableTable/Header.tsx +++ b/libs/service-portal/core/src/components/ExpandableTable/Header.tsx @@ -2,7 +2,7 @@ import React, { FC } from 'react' import { Text } from '@island.is/island-ui/core' import { Table as T } from '@island.is/island-ui/core' -import { tableStyles } from '../../utils/utils' +import { headingTableStyles, tableStyles } from '../../utils/utils' interface Props { data: Array<{ value: string | React.ReactElement @@ -17,26 +17,30 @@ const ExpandableLine: FC> = ({ data }) => { return ( - {data.map((item, i) => ( - - + item.value ? ( + - {item.value} - - - ))} + + {item.value} + + + ) : ( + + ), + )} ) diff --git a/libs/service-portal/core/src/utils/utils.ts b/libs/service-portal/core/src/utils/utils.ts index 361570fe61d1..826628f8e405 100644 --- a/libs/service-portal/core/src/utils/utils.ts +++ b/libs/service-portal/core/src/utils/utils.ts @@ -1,3 +1,4 @@ +import { theme } from '@island.is/island-ui/theme' import get from 'lodash/get' export { formatNationalId } from '@island.is/portals/core' @@ -15,6 +16,9 @@ export const getNameAbbreviation = (name: string) => { export const tableStyles = { padding: '16px', } +export const headingTableStyles = { + background: theme.color.blue100, +} type DrivingLicenseSuspended = { /* ANY because response was null */ dagsFra?: any diff --git a/libs/service-portal/finance/src/components/FinanceLoans/FinanceLoansTable.tsx b/libs/service-portal/finance/src/components/FinanceLoans/FinanceLoansTable.tsx index c05bdf6433fa..9c816e4da9d7 100644 --- a/libs/service-portal/finance/src/components/FinanceLoans/FinanceLoansTable.tsx +++ b/libs/service-portal/finance/src/components/FinanceLoans/FinanceLoansTable.tsx @@ -71,7 +71,7 @@ export const FinanceLoansTable = ({ loanOverview }: Props) => { Date: Thu, 4 Jul 2024 16:33:55 +0000 Subject: [PATCH 3/8] fix(service-portal): Headings structure fixed (#15268) * frontpage * documents * update functions style * fix changes and add variable instead --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/service-portal/src/screens/Dashboard/Dashboard.tsx | 7 ++++--- .../lib/Filter/FilterMultiChoice/FilterMultiChoice.tsx | 4 +++- .../src/components/DocumentFilter/DocumentsFilter.tsx | 2 +- .../src/components/DocumentFilter/DocumentsFilterV2.tsx | 2 +- .../screens/FinanceTransactions/FinanceTransactions.tsx | 8 ++++---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/service-portal/src/screens/Dashboard/Dashboard.tsx b/apps/service-portal/src/screens/Dashboard/Dashboard.tsx index 90ebbddac338..769d19644e4d 100644 --- a/apps/service-portal/src/screens/Dashboard/Dashboard.tsx +++ b/apps/service-portal/src/screens/Dashboard/Dashboard.tsx @@ -80,8 +80,8 @@ export const Dashboard: FC> = () => { navRoot.path && ( > = () => { component={Link} to={navRoot.path} headingVariant="h4" + headingAs="h2" icon={ isMobile && navRoot.icon ? ( > = () => { ) )} - + {formatMessage(m.documents)} diff --git a/libs/island-ui/core/src/lib/Filter/FilterMultiChoice/FilterMultiChoice.tsx b/libs/island-ui/core/src/lib/Filter/FilterMultiChoice/FilterMultiChoice.tsx index 47ae13d60aef..f64388b71509 100644 --- a/libs/island-ui/core/src/lib/Filter/FilterMultiChoice/FilterMultiChoice.tsx +++ b/libs/island-ui/core/src/lib/Filter/FilterMultiChoice/FilterMultiChoice.tsx @@ -17,6 +17,8 @@ type FilterCategory = { id: string /** The category label to display on screen. */ label: string | ReactNode + /** The heading size of the label */ + labelAs?: 'h2' | 'h3' | 'h4' | 'h5' /** The array of currently selected active filters. */ selected: Array /** Array of available filters in this category. */ @@ -147,7 +149,7 @@ export const FilterMultiChoice: FC< key={`${category.id}-${index}}`} id={category.id} label={category.label} - labelUse="h5" + labelUse={category.labelAs || 'h5'} labelVariant="h5" labelColor={ category.selected.length > 0 ? 'blue400' : 'currentColor' diff --git a/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilter.tsx b/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilter.tsx index 34167ab8bf22..da2790aab08e 100644 --- a/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilter.tsx +++ b/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilter.tsx @@ -195,7 +195,7 @@ const DocumentsFilter = ({ key="date-accordion-item" id="date-accordion-item" label={formatMessage(m.datesLabel)} - labelUse="h5" + labelUse="h2" labelVariant="h5" iconVariant="small" > diff --git a/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilterV2.tsx b/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilterV2.tsx index f08b41bbe8d5..ebbfafccb77b 100644 --- a/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilterV2.tsx +++ b/libs/service-portal/documents/src/components/DocumentFilter/DocumentsFilterV2.tsx @@ -197,7 +197,7 @@ const DocumentsFilter = ({ key="date-accordion-item" id="date-accordion-item" label={formatMessage(m.datesLabel)} - labelUse="h5" + labelUse="h2" labelVariant="h5" iconVariant="small" > diff --git a/libs/service-portal/finance/src/screens/FinanceTransactions/FinanceTransactions.tsx b/libs/service-portal/finance/src/screens/FinanceTransactions/FinanceTransactions.tsx index 2f33d2660e43..4bf42e43932a 100644 --- a/libs/service-portal/finance/src/screens/FinanceTransactions/FinanceTransactions.tsx +++ b/libs/service-portal/finance/src/screens/FinanceTransactions/FinanceTransactions.tsx @@ -94,17 +94,16 @@ const FinanceTransactions = () => { setToDate(new Date()) // eslint-disable-next-line react-hooks/exhaustive-deps }, []) - - function getAllChargeTypes() { + const getAllChargeTypes = () => { const allChargeTypeValues = chargeTypeData?.chargeType?.map((ct) => ct.id) return allChargeTypeValues ?? [] } - function setEmptyChargeTypes() { + const setEmptyChargeTypes = () => { setDropdownSelect([]) } - function clearAllFilters() { + const clearAllFilters = () => { setEmptyChargeTypes() setFromDate(backInTheDay) setToDate(new Date()) @@ -180,6 +179,7 @@ const FinanceTransactions = () => { { id: 'flokkur', label: formatMessage(messages.transactionsLabel), + labelAs: 'h2', selected: dropdownSelect ? [...dropdownSelect] : [], filters: chargeTypeSelect, inline: false, From d2f5c579cea04417e64a6c95a0fee18098d782da Mon Sep 17 00:00:00 2001 From: unakb Date: Thu, 4 Jul 2024 16:50:58 +0000 Subject: [PATCH 4/8] fix(j-s): Handle empty string (#15435) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/components/InfoCard/DefendantInfo/DefendantInfo.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx index af6f711370f4..9eeaededde45 100644 --- a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx +++ b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx @@ -88,8 +88,9 @@ export const DefendantInfo: FC = ({ {displayDefenderInfo && ( {`${formatMessage(strings.defender)}: ${ - defendant.defenderName ?? - formatMessage(strings.noDefenderAssigned) + defendant.defenderName + ? defendant.defenderName + : formatMessage(strings.noDefenderAssigned) }`} {defendant.defenderEmail && ( <> From 6d7e3fcdc0797209b1ef1df1fa7a27c6091c2941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A6ring=20Gunnar=20Stein=C3=BE=C3=B3rsson?= Date: Thu, 4 Jul 2024 17:13:20 +0000 Subject: [PATCH 5/8] fix(application-system-api): Use withNx plugin in application-system-api webpack config (#15448) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/application-system/api/webpack.config.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/application-system/api/webpack.config.js b/apps/application-system/api/webpack.config.js index 7afb1dcb96ed..80865762804f 100644 --- a/apps/application-system/api/webpack.config.js +++ b/apps/application-system/api/webpack.config.js @@ -1,10 +1,14 @@ const { composePlugins, withNx } = require('@nx/webpack') const { withReact } = require('@nx/react') -module.exports = composePlugins(withReact({ ssr: true }), (config) => { - // App specific config - config.stats.chunks = false - config.stats.modules = false +module.exports = composePlugins( + withNx(), + withReact({ ssr: true }), + (config) => { + // App specific config + config.stats.chunks = false + config.stats.modules = false - return config -}) + return config + }, +) From 545de44c3e40669d682b749b6242a7eedea2e9b4 Mon Sep 17 00:00:00 2001 From: unakb Date: Thu, 4 Jul 2024 17:20:20 +0000 Subject: [PATCH 6/8] feat(j-s): Subpoena type decision on court overview screen (#15432) * feat(j-s): Subpoena type decision on court overview screen * Update Subpoena.tsx --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: lommi --- .../Court/Indictments/Overview/Overview.tsx | 39 ++++++- .../Court/Indictments/Subpoena/Subpoena.tsx | 80 +++----------- .../SubpoenaType/SubpoenaType.strings.ts | 22 ++++ .../components/SubpoenaType/SubpoenaType.tsx | 101 ++++++++++++++++++ .../web/src/routes/Court/components/index.ts | 1 + 5 files changed, 176 insertions(+), 67 deletions(-) create mode 100644 apps/judicial-system/web/src/routes/Court/components/SubpoenaType/SubpoenaType.strings.ts create mode 100644 apps/judicial-system/web/src/routes/Court/components/SubpoenaType/SubpoenaType.tsx diff --git a/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx b/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx index 85a35c96cafb..46d32529317a 100644 --- a/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx +++ b/apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx @@ -23,7 +23,9 @@ import { CaseState, IndictmentDecision, } from '@island.is/judicial-system-web/src/graphql/schema' +import { useDefendants } from '@island.is/judicial-system-web/src/utils/hooks' +import { SubpoenaType } from '../../components' import ReturnIndictmentModal from '../ReturnIndictmentCaseModal/ReturnIndictmentCaseModal' import { strings } from './Overview.strings' @@ -31,6 +33,8 @@ const IndictmentOverview = () => { const router = useRouter() const { workingCase, isLoadingWorkingCase, caseNotFound, setWorkingCase } = useContext(FormContext) + const { updateDefendantState, updateDefendant } = useDefendants() + const { formatMessage } = useIntl() const lawsBroken = useIndictmentsLawsBroken(workingCase) const [modalVisible, setModalVisible] = useState<'RETURN_INDICTMENT'>() @@ -39,8 +43,26 @@ const IndictmentOverview = () => { const caseHasBeenReceivedByCourt = workingCase.state === CaseState.RECEIVED const handleNavigationTo = useCallback( - (destination: string) => router.push(`${destination}/${workingCase.id}`), - [router, workingCase.id], + async (destination: string) => { + if (workingCase.defendants) { + const promises = workingCase.defendants.map((defendant) => + updateDefendant({ + caseId: workingCase.id, + defendantId: defendant.id, + subpoenaType: defendant.subpoenaType, + }), + ) + + const allDataSentToServer = await Promise.all(promises) + + if (!allDataSentToServer.every(Boolean)) { + return + } + } + + router.push(`${destination}/${workingCase.id}`) + }, + [router, updateDefendant, workingCase.defendants, workingCase.id], ) return ( @@ -86,6 +108,19 @@ const IndictmentOverview = () => { )} + {workingCase.defendants && ( + + { + + } + + )} { const { workingCase, setWorkingCase, isLoadingWorkingCase, caseNotFound } = @@ -114,64 +110,18 @@ const Subpoena: FC = () => { {formatMessage(strings.title)} - - - {workingCase.defendants?.map((defendant, index) => ( - - - - {defendant.name} - - - { - updateDefendantState( - { - caseId: workingCase.id, - defendantId: defendant.id, - subpoenaType: SubpoenaType.ABSENCE, - }, - setWorkingCase, - ) - }} - disabled={isArraignmentDone} - /> - { - updateDefendantState( - { - caseId: workingCase.id, - defendantId: defendant.id, - subpoenaType: SubpoenaType.ARREST, - }, - setWorkingCase, - ) - }} - disabled={isArraignmentDone} - /> - - - - ))} - + {workingCase.defendants && ( + + { + + } + + )} > + updateDefendantState: ( + update: UpdateDefendantInput, + setWorkingCase: React.Dispatch>, + ) => void + required?: boolean +} + +const SubpoenaType: FC = ({ + defendants, + workingCase, + setWorkingCase, + updateDefendantState, + required = true, +}) => { + const { formatMessage } = useIntl() + const isArraignmentDone = Boolean(workingCase.indictmentDecision) + return ( + <> + + {defendants.map((defendant, index) => ( + + + + {defendant.name} + + + { + updateDefendantState( + { + caseId: workingCase.id, + defendantId: defendant.id, + subpoenaType: SubpoenaTypeEnum.ABSENCE, + }, + setWorkingCase, + ) + }} + disabled={isArraignmentDone} + /> + { + updateDefendantState( + { + caseId: workingCase.id, + defendantId: defendant.id, + subpoenaType: SubpoenaTypeEnum.ARREST, + }, + setWorkingCase, + ) + }} + disabled={isArraignmentDone} + /> + + + + ))} + + ) +} + +export default SubpoenaType diff --git a/apps/judicial-system/web/src/routes/Court/components/index.ts b/apps/judicial-system/web/src/routes/Court/components/index.ts index 7eb21ae65d86..972124be06a9 100644 --- a/apps/judicial-system/web/src/routes/Court/components/index.ts +++ b/apps/judicial-system/web/src/routes/Court/components/index.ts @@ -6,3 +6,4 @@ export { default as ReceptionAndAssignment } from './ReceptionAndAssignment/Rece export { default as RulingModifiedModal } from './RulingModifiedModal/RulingModifiedModal' export { default as RegistrarRequestRulingSignatureModal } from './RulingModifiedModal/RegistrarRequestRulingSignatureModal' export { default as JudgeRequestRulingSignatureModal } from './RulingModifiedModal/JudgeRequestRulingSignatureModal' +export { default as SubpoenaType } from './SubpoenaType/SubpoenaType' From dc0be280dc13cf0cf720d8fea9a2887fa224cd01 Mon Sep 17 00:00:00 2001 From: lommi Date: Thu, 4 Jul 2024 17:53:10 +0000 Subject: [PATCH 7/8] fix: generated files (#15450) --- package.json | 1 + yarn.lock | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/package.json b/package.json index 42347671de0d..214622f18a95 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,7 @@ "@sindresorhus/slugify": "1.0.0", "@statoscope/webpack-plugin": "5.20.1", "@storybook/core-server": "7.6.9", + "@types/archiver": "6.0.2", "@types/faker": "5.5.3", "@types/nodemailer": "6.4.1", "@types/pdfkit": "0.11.2", diff --git a/yarn.lock b/yarn.lock index 772817908b22..57a87eeaf986 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18468,6 +18468,15 @@ __metadata: languageName: node linkType: hard +"@types/archiver@npm:6.0.2": + version: 6.0.2 + resolution: "@types/archiver@npm:6.0.2" + dependencies: + "@types/readdir-glob": "*" + checksum: 4bef71e5b95863be9880339275ad92c2513dd78d56587653614dc5a74af1d078f5f5926ec996de06e7071a1003e0c2764d0e9d2bb0893a2ffb14ab1718eaf5ca + languageName: node + linkType: hard + "@types/archiver@npm:^5.1.1": version: 5.1.1 resolution: "@types/archiver@npm:5.1.1" @@ -19908,6 +19917,15 @@ __metadata: languageName: node linkType: hard +"@types/readdir-glob@npm:*": + version: 1.1.5 + resolution: "@types/readdir-glob@npm:1.1.5" + dependencies: + "@types/node": "*" + checksum: 58625586589a2cbcf19d7bff5a9b61e961b42e438e5a4f537633785efdcacfad15d3b32df3d27926696b36b43eb86eeb790fce9373fa357ab87720c64f86618b + languageName: node + linkType: hard + "@types/request@npm:2.48.5": version: 2.48.5 resolution: "@types/request@npm:2.48.5" @@ -36011,6 +36029,7 @@ __metadata: "@testing-library/jest-dom": 5.16.5 "@testing-library/react": 15.0.6 "@testing-library/user-event": 14.4.3 + "@types/archiver": 6.0.2 "@types/aws-sdk": 2.7.0 "@types/aws4": 1.5.1 "@types/classnames": 2.2.10 From 129bdd397168e580ba48066f5d2afe47f36d2ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3r=C3=B0ur=20H?= Date: Thu, 4 Jul 2024 20:29:23 +0000 Subject: [PATCH 8/8] fix(system-e2e): Load x road mock in sequence (#15446) Co-authored-by: lommi --- .../service-portal/acceptance/setup-xroad.mocks.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/system-e2e/src/tests/islandis/service-portal/acceptance/setup-xroad.mocks.ts b/apps/system-e2e/src/tests/islandis/service-portal/acceptance/setup-xroad.mocks.ts index 7fd2acb732f3..3f48d47a8bee 100644 --- a/apps/system-e2e/src/tests/islandis/service-portal/acceptance/setup-xroad.mocks.ts +++ b/apps/system-e2e/src/tests/islandis/service-portal/acceptance/setup-xroad.mocks.ts @@ -13,13 +13,11 @@ export const setupXroadMocks = async () => { await resetMocks() /** Xroad mocks */ - await Promise.all([ - loadAssetsXroadMocks().catch((error) => ({ error })), - loadHealthInsuranceXroadMocks().catch((error) => ({ error })), - loadSocialInsuranceXroadMocks().catch((error) => ({ error })), - loadLicensesXroadMocks().catch((error) => ({ error })), - loadOccupationalLicensesXroadMocks().catch((error) => ({ error })), - ]) + await loadAssetsXroadMocks() + await loadHealthInsuranceXroadMocks() + await loadSocialInsuranceXroadMocks() + await loadLicensesXroadMocks() + await loadOccupationalLicensesXroadMocks() const { envs } = getEnvVariables(Base.getEnv(), 'system-e2e', env) const xroadBasePath = envs['XROAD_BASE_PATH']