From 74f5c192e887efebcb03cfcedb58357ceb231b5e Mon Sep 17 00:00:00 2001 From: helgifr Date: Mon, 30 Dec 2024 14:27:32 +0000 Subject: [PATCH 01/25] fix(application-system): Error on removing uploaded documents (#17233) When documents are chosen for uploading and then removed right after it was causing an error because of manipulating a read only property Co-authored-by: hfhelgason Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/lib/FileUploadFormField/FileUploadFormField.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/application/ui-fields/src/lib/FileUploadFormField/FileUploadFormField.tsx b/libs/application/ui-fields/src/lib/FileUploadFormField/FileUploadFormField.tsx index a327c8a845d9..34326d2f31e9 100644 --- a/libs/application/ui-fields/src/lib/FileUploadFormField/FileUploadFormField.tsx +++ b/libs/application/ui-fields/src/lib/FileUploadFormField/FileUploadFormField.tsx @@ -36,8 +36,9 @@ export const FileUploadFormField = ({ const currentValue = watch(id) const onFileRemoveWhenInAnswers = (fileToRemove: UploadFile) => { + const answers = structuredClone(application.answers) const updatedAnswers = set( - application.answers, + answers, id, currentValue.filter((x: UploadFile) => x.key !== fileToRemove.key), ) From fb9b90419fd377057d2c6ac60fdf4ad60e521261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Thu, 2 Jan 2025 10:09:48 +0000 Subject: [PATCH 02/25] fix(social-insurance-administration): update model (#17302) * fix: update * fix: use asterisk * fix: add asterisk for some values* * chore: add message --- .../src/lib/models/payments/payment.model.ts | 3 + .../src/lib/socialInsurance.service.ts | 1 + .../src/clientConfig.json | 609 ++++++++---------- .../ScrollableMiddleTable.tsx | 6 +- .../PaymentGroupTable.graphql | 1 + .../PaymentGroupTableRow.tsx | 4 +- .../src/lib/messages.ts | 5 + .../src/screens/PaymentPlan/PaymentPlan.tsx | 62 +- 8 files changed, 285 insertions(+), 406 deletions(-) diff --git a/libs/api/domains/social-insurance/src/lib/models/payments/payment.model.ts b/libs/api/domains/social-insurance/src/lib/models/payments/payment.model.ts index 31c1d31bc3c3..075397b75eef 100644 --- a/libs/api/domains/social-insurance/src/lib/models/payments/payment.model.ts +++ b/libs/api/domains/social-insurance/src/lib/models/payments/payment.model.ts @@ -9,6 +9,9 @@ export class Payment { @Field(() => Int) totalYearCumulativeAmount!: number + @Field({ nullable: true }) + markWithAsterisk?: boolean + @Field(() => [PaymentMonth]) monthlyPaymentHistory!: Array } diff --git a/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts b/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts index 98dfe04d5166..f90ccb38e08c 100644 --- a/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts +++ b/libs/api/domains/social-insurance/src/lib/socialInsurance.service.ts @@ -98,6 +98,7 @@ export class SocialInsuranceService { return { name: r.name, totalYearCumulativeAmount: r.total ?? 0, + markWithAsterisk: r.markWithAsterisk ?? undefined, monthlyPaymentHistory: r.months ?.map((m) => { diff --git a/libs/clients/social-insurance-administration/src/clientConfig.json b/libs/clients/social-insurance-administration/src/clientConfig.json index 3ff113caa47a..6ec989b3b369 100644 --- a/libs/clients/social-insurance-administration/src/clientConfig.json +++ b/libs/clients/social-insurance-administration/src/clientConfig.json @@ -1,9 +1,6 @@ { "openapi": "3.0.1", - "info": { - "title": "TR Portal API", - "version": "v1.0" - }, + "info": { "title": "TR Portal API", "version": "v1.0" }, "paths": { "/api/protected/v1/Applicant/{applicationType}/eligible": { "get": { @@ -15,10 +12,7 @@ "in": "path", "description": "The type of application (e.g. old age pension) to check for eligibility", "required": true, - "style": "simple", - "schema": { - "type": "string" - } + "schema": { "type": "string" } } ], "responses": { @@ -83,7 +77,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -103,7 +97,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -191,7 +185,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -211,7 +205,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -233,26 +227,24 @@ } } }, - "/api/protected/v1/Applicant/balance": { + "/api/protected/v1/Applicant/onetimepayment": { "post": { "tags": ["Applicant"], - "summary": "This endpoint provides the balance of the estate.", "requestBody": { - "description": "Input model for national id and reference date", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.Applicant.BalanceOfEstateInputModel" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.Application" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.Applicant.BalanceOfEstateInputModel" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.Application" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.Applicant.BalanceOfEstateInputModel" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.Application" } } } @@ -319,7 +311,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -339,24 +331,21 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.ResultSets.ApplicationResultSet" } }, "application/json": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.ResultSets.ApplicationResultSet" } }, "text/json": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.ResultSets.ApplicationResultSet" } } } @@ -364,41 +353,148 @@ } } }, - "/api/protected/v1/Application/{applicationType}": { + "/api/protected/v1/Applicant/balance": { "post": { - "tags": ["Application"], - "summary": "Creates applications of various types, depending on the input.applicationType parameter", - "parameters": [ - { - "name": "applicationType", - "in": "path", - "description": "The application type, e.g. \"oldagepension\"", - "required": true, - "style": "simple", - "schema": { - "type": "string" - } - } - ], + "tags": ["Applicant"], + "summary": "This endpoint provides the balance of the estate.", "requestBody": { - "description": "Input for application, varies by type", + "description": "Input model for national id and reference date", "content": { "application/json": { "schema": { - "type": "object" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.Applicant.BalanceOfEstateInputModel" } }, "text/json": { "schema": { - "type": "object" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.Applicant.BalanceOfEstateInputModel" } }, "application/*+json": { "schema": { - "type": "object" + "$ref": "#/components/schemas/TrWeb.Commons.ExternalPortals.Api.Models.Applicant.BalanceOfEstateInputModel" + } + } + } + }, + "responses": { + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TrWeb.Applications.ExternalPortals.Error" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { "type": "integer", "format": "int32" } + }, + "application/json": { + "schema": { "type": "integer", "format": "int32" } + }, + "text/json": { + "schema": { "type": "integer", "format": "int32" } } } } + } + } + }, + "/api/protected/v1/Application/{applicationType}": { + "post": { + "tags": ["Application"], + "summary": "Creates applications of various types, depending on the input.applicationType parameter", + "parameters": [ + { + "name": "applicationType", + "in": "path", + "description": "The application type, e.g. \"oldagepension\"", + "required": true, + "schema": { "type": "string" } + } + ], + "requestBody": { + "description": "Input for application, varies by type", + "content": { + "application/json": { "schema": { "type": "object" } }, + "text/json": { "schema": { "type": "object" } }, + "application/*+json": { "schema": { "type": "object" } } + } }, "responses": { "400": { @@ -462,7 +558,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -482,7 +578,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -514,10 +610,7 @@ "in": "path", "description": "The application GUID for the application in Island.is", "required": true, - "style": "simple", - "schema": { - "type": "string" - } + "schema": { "type": "string" } } ], "requestBody": { @@ -612,7 +705,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -631,9 +724,7 @@ } } }, - "204": { - "description": "No Content" - } + "204": { "description": "No Content" } } } }, @@ -702,7 +793,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -722,7 +813,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -752,18 +843,12 @@ "name": "documentId", "in": "path", "required": true, - "style": "simple", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "authenticationType", "in": "query", - "style": "form", - "schema": { - "type": "string" - } + "schema": { "type": "string" } } ], "responses": { @@ -828,7 +913,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -848,7 +933,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -936,7 +1021,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -956,31 +1041,16 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } + "schema": { "type": "array", "items": { "type": "string" } } }, "application/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } + "schema": { "type": "array", "items": { "type": "string" } } }, "text/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } + "schema": { "type": "array", "items": { "type": "string" } } } } } @@ -1053,7 +1123,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1073,7 +1143,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1170,7 +1240,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1190,7 +1260,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1229,11 +1299,7 @@ { "name": "year", "in": "query", - "style": "form", - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } ], "responses": { @@ -1298,7 +1364,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1318,7 +1384,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1406,7 +1472,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1426,7 +1492,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1534,7 +1600,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1554,7 +1620,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1642,7 +1708,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1662,7 +1728,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1693,10 +1759,7 @@ "name": "year", "in": "query", "description": "", - "style": "form", - "schema": { - "type": "string" - } + "schema": { "type": "string" } } ], "responses": { @@ -1761,7 +1824,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1781,7 +1844,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1869,7 +1932,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1889,7 +1952,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1977,7 +2040,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -1997,33 +2060,24 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { "type": "array", - "items": { - "type": "integer", - "format": "int32" - } + "items": { "type": "integer", "format": "int32" } } }, "application/json": { "schema": { "type": "array", - "items": { - "type": "integer", - "format": "int32" - } + "items": { "type": "integer", "format": "int32" } } }, "text/json": { "schema": { "type": "array", - "items": { - "type": "integer", - "format": "int32" - } + "items": { "type": "integer", "format": "int32" } } } } @@ -2117,7 +2171,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -2137,7 +2191,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2234,7 +2288,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -2254,23 +2308,11 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "type": "string" - } - }, - "text/json": { - "schema": { - "type": "string" - } - } + "text/plain": { "schema": { "type": "string" } }, + "application/json": { "schema": { "type": "string" } }, + "text/json": { "schema": { "type": "string" } } } } } @@ -2342,7 +2384,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -2362,23 +2404,11 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "type": "string" - } - }, - "text/json": { - "schema": { - "type": "string" - } - } + "text/plain": { "schema": { "type": "string" } }, + "application/json": { "schema": { "type": "string" } }, + "text/json": { "schema": { "type": "string" } } } } } @@ -2449,7 +2479,7 @@ } }, "500": { - "description": "Server Error", + "description": "Internal Server Error", "content": { "text/plain": { "schema": { @@ -2469,7 +2499,7 @@ } }, "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2497,75 +2527,36 @@ "TrWeb.Api.Services.Common.Clients.Models.GetBankInformationReturn": { "type": "object", "properties": { - "bank": { - "type": "string", - "nullable": true - }, - "ledger": { - "type": "string", - "nullable": true - }, - "accountNumber": { - "type": "string", - "nullable": true - }, - "iban": { - "type": "string", - "nullable": true - }, - "swift": { - "type": "string", - "nullable": true - }, - "foreignBankName": { - "type": "string", - "nullable": true - }, - "foreignBankAddress": { - "type": "string", - "nullable": true - }, - "currency": { - "type": "string", - "nullable": true - } + "bank": { "type": "string", "nullable": true }, + "ledger": { "type": "string", "nullable": true }, + "accountNumber": { "type": "string", "nullable": true }, + "iban": { "type": "string", "nullable": true }, + "swift": { "type": "string", "nullable": true }, + "foreignBankName": { "type": "string", "nullable": true }, + "foreignBankAddress": { "type": "string", "nullable": true }, + "currency": { "type": "string", "nullable": true } }, "additionalProperties": false }, "TrWeb.Api.Services.Domain.Applications.Models.CreateApplicationFromPaperReturn": { "type": "object", "properties": { - "applicationLineId": { - "type": "integer", - "format": "int32" - } + "applicationLineId": { "type": "integer", "format": "int32" } }, "additionalProperties": false }, "TrWeb.Api.Services.Domain.DigitalMailbox.Models.Document": { "type": "object", "properties": { - "type": { - "type": "string", - "nullable": true - }, - "content": { - "type": "string", - "nullable": true - } + "type": { "type": "string", "nullable": true }, + "content": { "type": "string", "nullable": true } }, "additionalProperties": false }, "TrWeb.Api.Services.Domain.Finance.Models.IslandIsIncomePlanDto": { "type": "object", "properties": { - "incomeYear": { - "type": "integer", - "format": "int32" - }, - "splitIncomeByMonth": { - "type": "boolean" - }, + "incomeYear": { "type": "integer", "format": "int32" }, "incomeTypes": { "type": "array", "items": { @@ -2579,88 +2570,72 @@ "TrWeb.Api.Services.Domain.Finance.Models.IslandIsIncomeTypeDto": { "type": "object", "properties": { - "incomeTypeNumber": { - "type": "integer", - "format": "int32" - }, - "incomeTypeCode": { - "type": "string", - "nullable": true - }, - "incomeTypeName": { - "type": "string", - "nullable": true - }, - "changesAllowed": { - "type": "boolean" - }, - "currencyNumber": { - "type": "integer", - "format": "int32" - }, - "currencyCode": { - "type": "string", - "nullable": true - }, - "incomeCategoryNumber": { - "type": "integer", - "format": "int32" - }, - "incomeCategoryCode": { - "type": "string", - "nullable": true - }, - "incomeCategoryName": { - "type": "string", - "nullable": true - }, + "incomeTypeNumber": { "type": "integer", "format": "int32" }, + "incomeTypeCode": { "type": "string", "nullable": true }, + "incomeTypeName": { "type": "string", "nullable": true }, + "currencyCode": { "type": "string", "nullable": true }, + "incomeCategoryNumber": { "type": "integer", "format": "int32" }, + "incomeCategoryCode": { "type": "string", "nullable": true }, + "incomeCategoryName": { "type": "string", "nullable": true }, "amountJan": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountFeb": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountMar": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountApr": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountMay": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountJun": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountJul": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountAug": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountSep": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountOct": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountNov": { "type": "number", - "format": "double" + "format": "double", + "nullable": true }, "amountDec": { "type": "number", - "format": "double" + "format": "double", + "nullable": true } }, "additionalProperties": false @@ -2668,29 +2643,16 @@ "TrWeb.Api.Services.Domain.Finance.Models.RknMonthDto": { "type": "object", "properties": { - "month": { - "type": "integer", - "format": "int32" - }, - "amount": { - "type": "number", - "format": "double", - "nullable": true - } + "month": { "type": "integer", "format": "int32" }, + "amount": { "type": "number", "format": "double", "nullable": true } }, "additionalProperties": false }, "TrWeb.Api.Services.UseCase.DeathBenefits.Models.ExternalSpousalInfo": { "type": "object", "properties": { - "name": { - "type": "string", - "nullable": true - }, - "nationalId": { - "type": "string", - "nullable": true - }, + "name": { "type": "string", "nullable": true }, + "nationalId": { "type": "string", "nullable": true }, "dateOfDeath": { "type": "string", "format": "date-time", @@ -3285,56 +3247,24 @@ "description": "Income type category code", "nullable": true }, - "january": { - "type": "number", - "format": "double", - "nullable": true - }, + "january": { "type": "number", "format": "double", "nullable": true }, "february": { "type": "number", "format": "double", "nullable": true }, - "march": { - "type": "number", - "format": "double", - "nullable": true - }, - "april": { - "type": "number", - "format": "double", - "nullable": true - }, - "may": { - "type": "number", - "format": "double", - "nullable": true - }, - "june": { - "type": "number", - "format": "double", - "nullable": true - }, - "july": { - "type": "number", - "format": "double", - "nullable": true - }, - "august": { - "type": "number", - "format": "double", - "nullable": true - }, + "march": { "type": "number", "format": "double", "nullable": true }, + "april": { "type": "number", "format": "double", "nullable": true }, + "may": { "type": "number", "format": "double", "nullable": true }, + "june": { "type": "number", "format": "double", "nullable": true }, + "july": { "type": "number", "format": "double", "nullable": true }, + "august": { "type": "number", "format": "double", "nullable": true }, "september": { "type": "number", "format": "double", "nullable": true }, - "october": { - "type": "number", - "format": "double", - "nullable": true - }, + "october": { "type": "number", "format": "double", "nullable": true }, "november": { "type": "number", "format": "double", @@ -3345,11 +3275,7 @@ "format": "double", "nullable": true }, - "total": { - "type": "number", - "format": "double", - "nullable": true - } + "total": { "type": "number", "format": "double", "nullable": true } }, "additionalProperties": false }, @@ -3454,6 +3380,11 @@ "format": "double", "nullable": true }, + "markWithAsterisk": { + "type": "boolean", + "description": "Whether to mark this row with an asterisk", + "nullable": true + }, "months": { "type": "array", "items": { @@ -3473,10 +3404,7 @@ "description": "Ellilífeyrir 1\r\nEllilífeyrir sjómanna 2\r\nÖrorkulífeyrir 3\r\nEndurhæfingarlífeyrir 4\r\nHálfur ellilífeyrir 5", "format": "int32" }, - "hasSpouse": { - "type": "boolean", - "description": "Hjúskaparstaða" - }, + "hasSpouse": { "type": "boolean", "description": "Hjúskaparstaða" }, "livingCondition": { "type": "integer", "description": "Heimilisaðstæður, býr ein(n) ?\r\nBýr ein(n) = 1\r\nBýr ekki ein(n) = 2", @@ -3566,10 +3494,7 @@ "description": "Séreignarlífeyrisgreiðslur", "format": "int32" }, - "otherIncome": { - "type": "integer", - "format": "int32" - }, + "otherIncome": { "type": "integer", "format": "int32" }, "capitalIncome": { "type": "integer", "description": "Fjármagnstekjur", @@ -3624,18 +3549,10 @@ }, "additionalProperties": false }, - "ProblemDetails": { - "additionalProperties": false - }, - "ValidationProblemDetails": { - "additionalProperties": false - }, + "ProblemDetails": { "additionalProperties": false }, + "ValidationProblemDetails": { "additionalProperties": false }, "TrWeb.Commons.ExternalPortals.Api.Models.FormBuilder.Ruleset": { - "properties": { - "gildi": { - "type": "string" - } - } + "properties": { "gildi": { "type": "string" } } } }, "securitySchemes": { @@ -3646,9 +3563,5 @@ } } }, - "security": [ - { - "Bearer": ["Bearer"] - } - ] + "security": [{ "Bearer": ["Bearer"] }] } diff --git a/libs/portals/my-pages/core/src/components/ScrollableMiddleTable/ScrollableMiddleTable.tsx b/libs/portals/my-pages/core/src/components/ScrollableMiddleTable/ScrollableMiddleTable.tsx index 984b59c374db..8e9eb65649e5 100644 --- a/libs/portals/my-pages/core/src/components/ScrollableMiddleTable/ScrollableMiddleTable.tsx +++ b/libs/portals/my-pages/core/src/components/ScrollableMiddleTable/ScrollableMiddleTable.tsx @@ -40,8 +40,10 @@ const getBreakpointWidth = (width: number) => { } return '200%' } -const FIRST_COLUMN_WIDTH = theme.spacing[23] -const LAST_COLUMN_WIDTH = theme.spacing[15] + +//Magic numbers +const FIRST_COLUMN_WIDTH = 130 +const LAST_COLUMN_WIDTH = 144 const ICON_WIDTH = theme.spacing[6] export const ScrollableMiddleTable = ({ diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTable.graphql b/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTable.graphql index 2615b5312e34..fe5c4e09d771 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTable.graphql +++ b/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTable.graphql @@ -11,6 +11,7 @@ query getPaymentPlan { payments { name totalYearCumulativeAmount + markWithAsterisk monthlyPaymentHistory { monthIndex amount diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTableRow.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTableRow.tsx index bc302192d166..cd4e39e0d5ab 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTableRow.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/components/PaymentGroupTable/PaymentGroupTableRow.tsx @@ -61,7 +61,9 @@ export const PaymentGroupTableRow = ({ data, formatMessage }: Props) => ( return monthlyAmount ? amountFormat(monthlyAmount) : '-' }), - last: amountFormat(p.totalYearCumulativeAmount), + last: `${amountFormat(p.totalYearCumulativeAmount)}${ + p.markWithAsterisk ? ' *' : '' + }`, }))} /> diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts index 233106923711..28d41e3f6257 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts +++ b/libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts @@ -18,6 +18,11 @@ export const m = defineMessages({ id: 'sp.social-insurance-maintenance:maintenance-footer-link', defaultMessage: ' Fara á mínar síður TR', }, + maintenanceFooterTemporaryWarning: { + id: 'sp.social-insurance-maintenance:maintenance-footer-temporary-warning', + defaultMessage: + '* Vinsamlega athugið að nýtt örorku- og endurhæfingargreiðslukerfi tekur gildi 1. september 2025. Fjárhæðir vegna tímabilsins september til desember munu breytast. TR vinnur að breytingum á kerfum stofnunarinnar og mun uppfæra greiðsluáætlunina að þeim loknum, á vormánuðum 2025.', + }, paymentPlan: { id: 'sp.social-insurance-maintenance:payment-plan', defaultMessage: 'Greiðsluáætlun', diff --git a/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx b/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx index 54414a12a609..5f2545392fa3 100644 --- a/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx +++ b/libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx @@ -1,10 +1,4 @@ -import { - AlertMessage, - Box, - Divider, - Stack, - Text, -} from '@island.is/island-ui/core' +import { Box, Divider, Stack, Text } from '@island.is/island-ui/core' import { useLocale, useNamespaces } from '@island.is/localization' import { Problem } from '@island.is/react-spa/shared' import { @@ -16,58 +10,13 @@ import { } from '@island.is/portals/my-pages/core' import { m } from '../../lib/messages' import { PaymentGroupTable } from '../../components' -import { useEffect, useState } from 'react' -import { useFeatureFlagClient } from '@island.is/react/feature-flags' -import { useGetPreviousPaymentsLazyQuery } from './PaymentPlan.generated' +import { useGetPreviousPaymentsQuery } from './PaymentPlan.generated' const PaymentPlan = () => { useNamespaces('sp.social-insurance-maintenance') const { formatMessage } = useLocale() - const [displayPaymentPlan, setDisplayPaymentPlan] = useState(false) - const [query, { data, loading, error }] = useGetPreviousPaymentsLazyQuery() - - const featureFlagClient = useFeatureFlagClient() - - useEffect(() => { - const isFlagEnabled = async () => { - const ffEnabled = await featureFlagClient.getValue( - `isServicePortalPaymentPlan2025Enabled`, - false, - ) - if (ffEnabled) { - setDisplayPaymentPlan(ffEnabled as boolean) - } - } - isFlagEnabled() - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) - - useEffect(() => { - if (displayPaymentPlan) { - query() - } - }, [displayPaymentPlan]) - - if (!displayPaymentPlan) { - return ( - - - - ) - } + const { data, loading, error } = useGetPreviousPaymentsQuery() return ( @@ -127,7 +76,7 @@ const PaymentPlan = () => { - {formatMessage(m.maintenanceFooter)} + {formatMessage(m.maintenanceFooter)}{' '} {formatMessage(m.maintenanceFooterLink, { // eslint-disable-next-line @typescript-eslint/no-explicit-any link: (str: any) => ( @@ -138,6 +87,9 @@ const PaymentPlan = () => { ), })} + + {formatMessage(m.maintenanceFooterTemporaryWarning)} + )} From 54ae154f845228ef840b9216f12bdb2ff2f4abba Mon Sep 17 00:00:00 2001 From: valurefugl <65780958+valurefugl@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:23:03 +0000 Subject: [PATCH 03/25] fix(ids-api): Filter delegated national registry scopes by delegation types. (#17354) * Filter delegated national registry scopes by delegation types. * Fix tests. --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../delegations/test/delegations-scopes.spec.ts | 17 +++++++++++++++++ .../actorDelegations.controller.spec.ts | 5 ++++- .../lib/delegations/delegation-scope.service.ts | 13 ++++++++----- .../testing/src/fixtures/fixture-factory.ts | 1 + 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts b/apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts index 61367667d5c2..b6c3085c7bc3 100644 --- a/apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts +++ b/apps/services/auth/ids-api/src/app/delegations/test/delegations-scopes.spec.ts @@ -19,6 +19,7 @@ const domainName = faker.random.word() const identityResources = ['id1', 'id2'] const legalGuardianScopes = ['lg1', 'lg2'] +const legalGuardianMinorScopes = ['lgm1', 'lgm2'] const procurationHolderScopes = ['ph1', 'ph2'] const customScopes1 = ['cu1', 'cu2'] const customScopes2 = ['cu3', 'cu4'] @@ -26,6 +27,7 @@ const legalRepresentativeScopes = ['lr1', 'lr2'] const apiScopes = [ ...legalGuardianScopes, + ...legalGuardianMinorScopes, ...procurationHolderScopes, ...customScopes1, ...customScopes2, @@ -44,6 +46,9 @@ const supportedDelegationTypes = (scopeName: string): AuthDelegationType[] => { if (legalGuardianScopes.includes(scopeName)) { result.push(AuthDelegationType.LegalGuardian) } + if (legalGuardianMinorScopes.includes(scopeName)) { + result.push(AuthDelegationType.LegalGuardianMinor) + } if (procurationHolderScopes.includes(scopeName)) { result.push(AuthDelegationType.ProcurationHolder) } @@ -108,6 +113,18 @@ const testCases: Record = { delegationType: [AuthDelegationType.LegalRepresentative], expected: [...legalRepresentativeScopes, ...identityResources], }, + '8': { + fromNationalId: createNationalId('person'), + delegationType: [ + AuthDelegationType.LegalGuardian, + AuthDelegationType.LegalGuardianMinor, + ], + expected: [ + ...legalGuardianScopes, + ...legalGuardianMinorScopes, + ...identityResources, + ], + }, } const user = createCurrentUser({ diff --git a/apps/services/auth/public-api/src/app/modules/delegations/actorDelegations.controller.spec.ts b/apps/services/auth/public-api/src/app/modules/delegations/actorDelegations.controller.spec.ts index a7ad9fb47b1e..194b027e3d61 100644 --- a/apps/services/auth/public-api/src/app/modules/delegations/actorDelegations.controller.spec.ts +++ b/apps/services/auth/public-api/src/app/modules/delegations/actorDelegations.controller.spec.ts @@ -793,7 +793,10 @@ describe('ActorDelegationsController', () => { await clientDelegationTypeModel.destroy({ where: { clientId: client.clientId, - delegationType: AuthDelegationType.LegalGuardian, + delegationType: [ + AuthDelegationType.LegalGuardian, + AuthDelegationType.LegalGuardianMinor, + ], }, }) diff --git a/libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts b/libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts index 701fa0785810..f21a9a2c7e0c 100644 --- a/libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts +++ b/libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts @@ -3,9 +3,9 @@ import { ConfigType } from '@nestjs/config' import { InjectModel } from '@nestjs/sequelize' import addDays from 'date-fns/addDays' import startOfDay from 'date-fns/startOfDay' +import * as kennitala from 'kennitala' import { Op, Transaction } from 'sequelize' import { uuid } from 'uuidv4' -import * as kennitala from 'kennitala' import { SyslumennService } from '@island.is/clients/syslumenn' import { logger } from '@island.is/logging' @@ -21,16 +21,16 @@ import { ApiScope } from '../resources/models/api-scope.model' import { IdentityResource } from '../resources/models/identity-resource.model' import { DelegationProviderService } from './delegation-provider.service' import { DelegationConfig } from './DelegationConfig' +import { ApiScopeInfo } from './delegations-incoming.service' import { DelegationsIndexService } from './delegations-index.service' import { UpdateDelegationScopeDTO } from './dto/delegation-scope.dto' import { DelegationDelegationType } from './models/delegation-delegation-type.model' import { DelegationScope } from './models/delegation-scope.model' import { DelegationTypeModel } from './models/delegation-type.model' import { Delegation } from './models/delegation.model' -import { ApiScopeInfo } from './delegations-incoming.service' +import filterByCustomScopeRule from './utils/filterByScopeCustomScopeRule' import type { User } from '@island.is/auth-nest-tools' -import filterByCustomScopeRule from './utils/filterByScopeCustomScopeRule' @Injectable() export class DelegationScopeService { @@ -238,7 +238,9 @@ export class DelegationScopeService { ) } - private async findAllNationalRegistryScopes(): Promise { + private async findAllNationalRegistryScopes( + delegationTypes: string[], + ): Promise { const apiScopes = await this.apiScopeModel.findAll({ include: [ { @@ -249,6 +251,7 @@ export class DelegationScopeService { model: DelegationTypeModel, where: { provider: AuthDelegationProvider.NationalRegistry, + id: delegationTypes, }, }, ], @@ -416,7 +419,7 @@ export class DelegationScopeService { await this.delegationProviderService.findProviders(delegationTypes) if (providers.includes(AuthDelegationProvider.NationalRegistry)) { - scopePromises.push(this.findAllNationalRegistryScopes()) + scopePromises.push(this.findAllNationalRegistryScopes(delegationTypes)) } if (providers.includes(AuthDelegationProvider.CompanyRegistry)) { diff --git a/libs/services/auth/testing/src/fixtures/fixture-factory.ts b/libs/services/auth/testing/src/fixtures/fixture-factory.ts index b6a37fbf32b5..700a5f0f0630 100644 --- a/libs/services/auth/testing/src/fixtures/fixture-factory.ts +++ b/libs/services/auth/testing/src/fixtures/fixture-factory.ts @@ -316,6 +316,7 @@ export class FixtureFactory { case AuthDelegationType.Custom: return AuthDelegationProvider.Custom case AuthDelegationType.LegalGuardian: + case AuthDelegationType.LegalGuardianMinor: return AuthDelegationProvider.NationalRegistry case AuthDelegationType.ProcurationHolder: return AuthDelegationProvider.CompanyRegistry From 029015c1e455943d28e98f66c889f5fd930cdf0f Mon Sep 17 00:00:00 2001 From: juni-haukur <158475136+juni-haukur@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:38:22 +0000 Subject: [PATCH 04/25] fix(inheritance-report): Fix bank account calculation (#17382) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../inheritance-report/src/fields/CalculateShare/index.tsx | 2 +- .../src/fields/Overview/OverviewAssets/rows.ts | 2 +- libs/application/templates/inheritance-report/src/types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx b/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx index c5737912c549..0518923f92a4 100644 --- a/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx +++ b/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx @@ -110,7 +110,7 @@ export const CalculateShare: FC> = ({ const bankAccounts: CalcShared = ( (answers.assets as unknown as EstateAssets)?.bankAccounts?.data ?? [] ).map((item) => { - const propertyValuation = valueToNumber(item.propertyValuation) + const propertyValuation = valueToNumber(item.amount) const exchangeRateOrInterest = valueToNumber(item.exchangeRateOrInterest) const deceasedShare = valueToNumber(item.deceasedShare) const value = propertyValuation + exchangeRateOrInterest diff --git a/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts b/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts index 7be77ebc83c2..3c3f95e507e3 100644 --- a/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts +++ b/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts @@ -190,7 +190,7 @@ export const getBankAccountsDataRow = (answers: FormValue): RowType[] => { )?.bankAccounts?.data.filter((item) => item.enabled) const data = (values ?? []).map((item) => { - const propertyValuation = roundedValueToNumber(item.propertyValuation) + const propertyValuation = roundedValueToNumber(item.amount) const isForeign = item.foreignBankAccount?.length diff --git a/libs/application/templates/inheritance-report/src/types.ts b/libs/application/templates/inheritance-report/src/types.ts index c23a10263a35..8eef0a622cf3 100644 --- a/libs/application/templates/inheritance-report/src/types.ts +++ b/libs/application/templates/inheritance-report/src/types.ts @@ -203,7 +203,7 @@ export interface BankAccountsData extends DeceasedShare { exchangeRateOrInterest: string propertyNumber: string assetNumber: string - propertyValuation: string + amount: string foreignBankAccount?: ('yes' | 'no')[] taxFreeInheritance: number enabled?: boolean From c222f7288dd7e0d07e0be505515e5e9fe93d03e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Thu, 2 Jan 2025 13:00:45 +0000 Subject: [PATCH 05/25] feat(j-s): Add functionality to enable revoking appeal (#17301) * Add revokeAppeal button * Add revoke appeal button * Refactor * Hide defendant appeal date picker when sent to prison admin --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../BlueBoxWithDate.strings.ts | 5 ++ .../BlueBoxWithIcon/BlueBoxWithDate.tsx | 76 +++++++++++++------ 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts index 282e98b4bb14..0abe703ed68f 100644 --- a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts +++ b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.strings.ts @@ -99,4 +99,9 @@ export const strings = defineMessages({ defaultMessage: 'Afturkalla', description: 'Notaður sem texti fyrir aðgerðina að afturkalla mál', }, + revokeAppeal: { + id: 'judicial.system.core:blue_box_with_date.revoke_appeal', + defaultMessage: 'Afturkalla áfrýjun', + description: 'Notaður sem texti fyrir aðgerðina að afturkalla áfrýjun', + }, }) diff --git a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx index 24e179704afe..b0b879a458ee 100644 --- a/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx +++ b/apps/judicial-system/web/src/components/BlueBoxWithIcon/BlueBoxWithDate.tsx @@ -61,6 +61,13 @@ const BlueBoxWithDate: FC = (props) => { const serviceRequired = defendant.serviceRequirement === ServiceRequirement.REQUIRED + const shouldHideDatePickers = Boolean( + defendant.verdictAppealDate || + defendant.isVerdictAppealDeadlineExpired || + defendant.isSentToPrisonAdmin || + isFine, + ) + const handleDateChange = ( date: Date | undefined, valid: boolean, @@ -119,6 +126,17 @@ const BlueBoxWithDate: FC = (props) => { setModalVisible(undefined) } + const handleRevokeAppeal = () => { + setAndSendDefendantToServer( + { + caseId: workingCase.id, + defendantId: defendant.id, + verdictAppealDate: null, + }, + setWorkingCase, + ) + } + const appealExpirationInfo = useMemo(() => { const deadline = defendant.verdictAppealDeadline || @@ -198,26 +216,27 @@ const BlueBoxWithDate: FC = (props) => { serviceRequired, ]) - const datePickerVariants = { - dpHidden: { opacity: 0, y: 15, marginTop: '16px' }, - dpVisible: { opacity: 1, y: 0 }, - dpExit: { + const verdictViewDateVariants = { + hidden: { opacity: 0, y: 15, marginTop: '16px' }, + visible: { opacity: 1, y: 0 }, + exit: { opacity: 0, y: 15, }, } - const datePicker2Variants = { - dpHidden: { opacity: 0, y: 15, marginTop: '16px' }, - dpVisible: { + const appealDateVariants = { + hidden: { opacity: 0, y: 15, marginTop: '16px' }, + visible: { opacity: 1, y: 0, height: 'auto', transition: { delay: triggerAnimation ? 0 : 0.4 }, }, - dpExit: { + exit: { opacity: 0, height: 0, + marginTop: 0, transition: { opacity: { duration: 0.2 } }, }, } @@ -246,13 +265,18 @@ const BlueBoxWithDate: FC = (props) => { = (props) => { ))} - {defendant.verdictAppealDate || - defendant.isVerdictAppealDeadlineExpired || - isFine ? null : !serviceRequired || defendant.verdictViewDate ? ( + {shouldHideDatePickers ? null : !serviceRequired || + defendant.verdictViewDate ? ( = (props) => { ) : ( @@ -338,7 +361,16 @@ const BlueBoxWithDate: FC = (props) => { - {defendant.isSentToPrisonAdmin ? ( + {defendant.verdictAppealDate ? ( + + ) : defendant.isSentToPrisonAdmin ? ( + ))} + + )} - {children} + {iconSrc && ( + + {iconAlt + + )} ) } diff --git a/libs/portals/my-pages/health/src/lib/messages.ts b/libs/portals/my-pages/health/src/lib/messages.ts index 67c32b9383c0..e1b62d73a58f 100644 --- a/libs/portals/my-pages/health/src/lib/messages.ts +++ b/libs/portals/my-pages/health/src/lib/messages.ts @@ -223,7 +223,7 @@ export const messages = defineMessages({ defaultMessage: 'Sæki skjal', }, healthInsuranceConfirmationTransferError: { - id: 'sp.health:health-center-registration-transfer-error-title', + id: 'sp.health:health-insurance-confirmation-transfer-error-title', defaultMessage: 'Villa kom upp þegar sótt var staðfesting á sjúkratryggingu', }, @@ -315,6 +315,11 @@ export const messages = defineMessages({ id: 'sp.health:dentist-register-forbidden', defaultMessage: 'Þú hefur ekki réttindi', }, + dentistRegistrationTransferErrorInfo: { + id: 'sp.health:dentist-registration-transfer-error-info', + defaultMessage: + 'Ekki tókst að skipta um tannlækni. Vinsamlegast reyndu aftur síðar.', + }, dentistModalTitle: { id: 'sp.health:dentist-modal-title', defaultMessage: 'Færa skráningu yfir á:', From be57698007eaff3f41dc760980f38075c6e975c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3hanna=20Magn=C3=BAsd=C3=B3ttir?= Date: Thu, 2 Jan 2025 16:53:33 -0500 Subject: [PATCH 13/25] fix(criminal record): Fix email to Syslumenn (#17341) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../criminal-record-submission.service.ts | 6 +----- .../emailGenerators/syslumennNotifyError.ts | 6 +----- .../templates/criminal-record/src/lib/messages.ts | 12 ------------ 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/criminal-record-submission.service.ts b/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/criminal-record-submission.service.ts index 11a090ad5105..430c5c7cc47b 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/criminal-record-submission.service.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/criminal-record-submission.service.ts @@ -2,11 +2,7 @@ import { Injectable } from '@nestjs/common' import { SharedTemplateApiService } from '../../shared' import { TemplateApiModuleActionProps } from '../../../types' import { CriminalRecordService } from '@island.is/api/domains/criminal-record' -import { - SyslumennService, - Person, - PersonType, -} from '@island.is/clients/syslumenn' +import { SyslumennService, PersonType } from '@island.is/clients/syslumenn' import { ApplicationTypes, ApplicationWithAttachments as Application, diff --git a/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/emailGenerators/syslumennNotifyError.ts b/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/emailGenerators/syslumennNotifyError.ts index b91aa0c7a01a..d22cdc6e094e 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/emailGenerators/syslumennNotifyError.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/criminal-record-submission/emailGenerators/syslumennNotifyError.ts @@ -1,5 +1,4 @@ import { EmailTemplateGenerator } from '../../../../types' -import { NationalRegistry } from '../types' export const generateSyslumennNotifyErrorEmail: EmailTemplateGenerator = ( props, @@ -11,12 +10,9 @@ export const generateSyslumennNotifyErrorEmail: EmailTemplateGenerator = ( const syslumennEmail = 'vefur@syslumenn.is' - const nationalRegistryData = application.externalData.nationalRegistry - ?.data as NationalRegistry - const subject = 'Umsókn um sakavottorð' const body = ` - Villa hefur komið upp í samskiptum milli island.is og sýslumanna, vegna kaupa á sakavottorði fyrir ${nationalRegistryData.nationalId}. + Villa hefur komið upp í samskiptum milli island.is og sýslumanna, vegna kaupa á sakavottorði fyrir ${application.applicant}. ` return { diff --git a/libs/application/templates/criminal-record/src/lib/messages.ts b/libs/application/templates/criminal-record/src/lib/messages.ts index 8ae494dbfdb7..f35e8e3b606c 100644 --- a/libs/application/templates/criminal-record/src/lib/messages.ts +++ b/libs/application/templates/criminal-record/src/lib/messages.ts @@ -31,18 +31,6 @@ export const m = defineMessages({ defaultMessage: 'Ég hef kynnt mér ofangreint', description: 'I understand', }, - nationalRegistryTitle: { - id: 'cr.application:nationalRegistry.title', - defaultMessage: 'Persónuupplýsingar úr Þjóðskrá', - description: 'Personal information from the National Registry', - }, - nationalRegistrySubTitle: { - id: 'cr.application:nationalRegistry.subTitle', - defaultMessage: - 'Til þess að auðvelda fyrir sækjum við persónuupplýsingar úr Þjóðskrá til þess að fylla út umsóknina', - description: - 'Information from the National Registry will be used to prefill the data in the application', - }, userProfileInformationTitle: { id: 'cr.application:userprofile.title', defaultMessage: 'Netfang og símanúmer úr þínum stillingum', From 07cbc1d81be79c4a2b696493f1a2901ad52525f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:08:25 +0000 Subject: [PATCH 14/25] fix(web): Organizations page - truncate tag label (#17349) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/screens/Organizations/Organizations.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/screens/Organizations/Organizations.tsx b/apps/web/screens/Organizations/Organizations.tsx index 1e5d12c879da..ebf952be1855 100644 --- a/apps/web/screens/Organizations/Organizations.tsx +++ b/apps/web/screens/Organizations/Organizations.tsx @@ -273,6 +273,7 @@ const OrganizationPage: Screen = ({ tagOptions={{ hyphenate: true, textLeft: true, + truncate: true, }} {...(organization?.logo?.url && { src: organization.logo.url, From 1382905568a8bca044edcaf75e2d7835dcf38ff1 Mon Sep 17 00:00:00 2001 From: juni-haukur <158475136+juni-haukur@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:29:58 +0000 Subject: [PATCH 15/25] fix(inheritance-report): Revert bank account name change (#17394) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../lib/modules/templates/inheritance-report/utils/mappers.ts | 2 +- .../inheritance-report/src/fields/CalculateShare/index.tsx | 2 +- .../src/fields/Overview/OverviewAssets/rows.ts | 2 +- .../templates/inheritance-report/src/forms/sections/assets.ts | 4 ++-- .../templates/inheritance-report/src/lib/dataSchema.ts | 2 +- libs/application/templates/inheritance-report/src/types.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts b/libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts index 6d1e0229f4f0..b85a2c4a9810 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts @@ -125,7 +125,7 @@ export const expandAnswers = ( data: (answers.assets.bankAccounts?.data ?? []).map((account) => { return { assetNumber: account.assetNumber ?? '', - amount: account.amount ?? '', + propertyValuation: account.propertyValuation ?? '', exchangeRateOrInterest: account.exchangeRateOrInterest ?? '', foreignBankAccount: account?.foreignBankAccount ?? [], deceasedShare: account.deceasedShare ?? '', diff --git a/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx b/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx index 0518923f92a4..c5737912c549 100644 --- a/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx +++ b/libs/application/templates/inheritance-report/src/fields/CalculateShare/index.tsx @@ -110,7 +110,7 @@ export const CalculateShare: FC> = ({ const bankAccounts: CalcShared = ( (answers.assets as unknown as EstateAssets)?.bankAccounts?.data ?? [] ).map((item) => { - const propertyValuation = valueToNumber(item.amount) + const propertyValuation = valueToNumber(item.propertyValuation) const exchangeRateOrInterest = valueToNumber(item.exchangeRateOrInterest) const deceasedShare = valueToNumber(item.deceasedShare) const value = propertyValuation + exchangeRateOrInterest diff --git a/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts b/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts index 3c3f95e507e3..7be77ebc83c2 100644 --- a/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts +++ b/libs/application/templates/inheritance-report/src/fields/Overview/OverviewAssets/rows.ts @@ -190,7 +190,7 @@ export const getBankAccountsDataRow = (answers: FormValue): RowType[] => { )?.bankAccounts?.data.filter((item) => item.enabled) const data = (values ?? []).map((item) => { - const propertyValuation = roundedValueToNumber(item.amount) + const propertyValuation = roundedValueToNumber(item.propertyValuation) const isForeign = item.foreignBankAccount?.length diff --git a/libs/application/templates/inheritance-report/src/forms/sections/assets.ts b/libs/application/templates/inheritance-report/src/forms/sections/assets.ts index b2c3d8b511ab..77c632a533ac 100644 --- a/libs/application/templates/inheritance-report/src/forms/sections/assets.ts +++ b/libs/application/templates/inheritance-report/src/forms/sections/assets.ts @@ -345,7 +345,7 @@ export const assets = buildSection({ [ESTATE_INHERITANCE]: m.bankAccountCapital, [PREPAID_INHERITANCE]: m.bankAccountCapitalPrePaid, }, - id: 'amount', + id: 'propertyValuation', required: true, currency: true, }, @@ -376,7 +376,7 @@ export const assets = buildSection({ fromExternalData: 'bankAccounts', skipPushRight: true, repeaterButtonText: m.bankAccountRepeaterButton, - sumField: 'amount', + sumField: 'propertyValuation', sumField2: 'exchangeRateOrInterest', }, ), diff --git a/libs/application/templates/inheritance-report/src/lib/dataSchema.ts b/libs/application/templates/inheritance-report/src/lib/dataSchema.ts index 054423f72638..5367d8ab67a3 100644 --- a/libs/application/templates/inheritance-report/src/lib/dataSchema.ts +++ b/libs/application/templates/inheritance-report/src/lib/dataSchema.ts @@ -221,7 +221,7 @@ export const inheritanceReportSchema = z.object({ .object({ foreignBankAccount: z.array(z.enum([YES])).optional(), assetNumber: z.string().refine((v) => v), - amount: z.string().refine((v) => v), + propertyValuation: z.string().refine((v) => v), exchangeRateOrInterest: z.string().refine((v) => v), enabled: z.boolean(), ...deceasedShare, diff --git a/libs/application/templates/inheritance-report/src/types.ts b/libs/application/templates/inheritance-report/src/types.ts index 8eef0a622cf3..c23a10263a35 100644 --- a/libs/application/templates/inheritance-report/src/types.ts +++ b/libs/application/templates/inheritance-report/src/types.ts @@ -203,7 +203,7 @@ export interface BankAccountsData extends DeceasedShare { exchangeRateOrInterest: string propertyNumber: string assetNumber: string - amount: string + propertyValuation: string foreignBankAccount?: ('yes' | 'no')[] taxFreeInheritance: number enabled?: boolean From dd1b22374ffc612dbb7f07e8675748613369ba11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Fri, 3 Jan 2025 10:37:00 +0000 Subject: [PATCH 16/25] chore(j-s): Remove unused cf strings (#17390) * Remove unused cf strings * Add defineMessages --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../web/messages/Core/commentsInput.ts | 8 ++++-- .../RestrictionCases/Prosecutor/reportForm.ts | 28 ------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/apps/judicial-system/web/messages/Core/commentsInput.ts b/apps/judicial-system/web/messages/Core/commentsInput.ts index 0ee33f9f6af7..77c580db2a73 100644 --- a/apps/judicial-system/web/messages/Core/commentsInput.ts +++ b/apps/judicial-system/web/messages/Core/commentsInput.ts @@ -1,4 +1,6 @@ -export const commentsInput = { +import { defineMessages } from 'react-intl' + +export const commentsInput = defineMessages({ heading: { id: 'judicial.system.core:comments_input.heading', defaultMessage: 'Athugasemdir vegna málsmeðferðar', @@ -8,7 +10,7 @@ export const commentsInput = { tooltip: { id: 'judicial.system.core:comments_input.tooltip', defaultMessage: - 'Hér er hægt að skrá athugasemdir til dómara og dómritara um hagnýt atriði sem tengjast fyrirtökunni eða málsmeðferðinni, og eru ekki hluti af sjálfri kröfunni.', + 'Hér er hægt að skrá athugasemdir til dómara og dómritara um hagnýt atriði sem tengjast fyrirtökunni eða málsmeðferðinni.', description: 'Notaður sem upplýsingatexti í upplýsingasvæði við "athugasemdir vegna málsmeðferðar" titlinn í öllum málategundum', }, @@ -25,4 +27,4 @@ export const commentsInput = { description: 'Notaður sem skýritexti í textaboxi fyrir "athugasemdir vegna málsmeðferðar" í öllum málategundum.', }, -} +}) diff --git a/apps/judicial-system/web/messages/RestrictionCases/Prosecutor/reportForm.ts b/apps/judicial-system/web/messages/RestrictionCases/Prosecutor/reportForm.ts index 728abcb47061..cc990bd298b9 100644 --- a/apps/judicial-system/web/messages/RestrictionCases/Prosecutor/reportForm.ts +++ b/apps/judicial-system/web/messages/RestrictionCases/Prosecutor/reportForm.ts @@ -99,33 +99,5 @@ export const rcReportForm = { 'Notaður sem skýritexti í textaboxi fyrir "lagarök" á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.', }, }), - comments: defineMessages({ - heading: { - id: 'judicial.system.restriction_cases:report_form.comments.heading', - defaultMessage: 'Athugasemdir vegna málsmeðferðar', - description: - 'Notaður sem titill fyrir "athugasemdir vegna málsmeðferðar" hlutann á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.', - }, - tooltip: { - id: 'judicial.system.restriction_cases:report_form.comments.tooltip', - defaultMessage: - 'Hér er hægt að skrá athugasemdir til dómara og dómritara um hagnýt atriði sem tengjast fyrirtökunni eða málsmeðferðinni, og eru ekki hluti af sjálfri kröfunni.', - description: - 'Notaður sem upplýsingatexti í upplýsingasvæði við "athugasemdir vegna málsmeðferðar" titlinn á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.', - }, - label: { - id: 'judicial.system.restriction_cases:report_form.comments.label', - defaultMessage: 'Athugasemdir', - description: - 'Notaður sem titill í textaboxi fyrir "athugasemdir vegna málsmeðferðar" á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.', - }, - placeholder: { - id: 'judicial.system.restriction_cases:report_form.comments.placeholder', - defaultMessage: - 'Er eitthvað sem þú vilt koma á framfæri við dómstólinn varðandi fyrirtökuna eða málsmeðferðina?', - description: - 'Notaður sem skýritexti í textaboxi fyrir "athugasemdir vegna málsmeðferðar" á greinargerðar skrefi í gæsluvarðhalds- og farbannsmálum.', - }, - }), }, } From e2bfea708c02c63c02cc591cf7128153b062367f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Sat, 4 Jan 2025 06:09:21 +0000 Subject: [PATCH 17/25] chore(web): Stop importing GraphQL types from api/schema (#17356) * Import grapql types from web * Change types for journeyman list * Reorder imports --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/components/Charts/v2/hooks/chart.ts | 2 +- .../OJOIAdvertCards.tsx | 2 +- .../Forms/StandardForm/StandardForm.tsx | 3 +- .../TableOfContents/TableOfContents.tsx | 2 +- .../MonthlyStatistics/MonthlyStatistics.tsx | 5 +- .../fiskistofa/ShipSearch/ShipSearch.tsx | 10 +-- .../CatchQuotaCalculator.tsx | 2 +- .../CatchQuotaCalculator/machine.ts | 21 +++--- .../StraddlingStockCalculator.tsx | 2 +- .../StraddlingStockCalculator/machine.ts | 16 +++-- .../TableLists/BrokersList/BrokersList.tsx | 2 +- .../JourneymanList/JourneymanList.tsx | 7 +- .../TableLists/MasterList/MasterList.tsx | 2 +- .../connected/syslumenn/utils/search.ts | 10 +-- apps/web/screens/Adgerdir/Article.tsx | 43 ++++++------ apps/web/screens/Adgerdir/Home.tsx | 69 +++++++++---------- .../AdgerdirArticles/AdgerdirArticles.tsx | 33 ++++----- .../components/CardsSlider/CardsSlider.tsx | 18 ++--- .../components/FeaturedNews/FeaturedNews.tsx | 13 ++-- .../components/LatestNews/LatestNews.tsx | 6 +- apps/web/screens/Home/Home.tsx | 40 ++++++----- apps/web/screens/LifeEvents/LifeEvents.tsx | 6 +- apps/web/screens/Login/Login.tsx | 22 +++--- .../hooks/useAdverts.ts | 2 +- .../PensionCalculator.tsx | 2 +- .../StafraentIsland/ApiCatalogue.tsx | 58 ++++++++-------- 26 files changed, 206 insertions(+), 192 deletions(-) diff --git a/apps/web/components/Charts/v2/hooks/chart.ts b/apps/web/components/Charts/v2/hooks/chart.ts index ed78a60d15c0..803624015e87 100644 --- a/apps/web/components/Charts/v2/hooks/chart.ts +++ b/apps/web/components/Charts/v2/hooks/chart.ts @@ -7,7 +7,7 @@ import { PieChart, } from 'recharts' -import { Chart } from '@island.is/api/schema' +import { Chart } from '@island.is/web/graphql/schema' import { ChartComponentWithRenderProps, ChartType } from '../types' import { decideChartBase } from '../utils' diff --git a/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx b/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx index 6d1992a3ac6d..8390420abb98 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx +++ b/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx @@ -1,6 +1,6 @@ -import { OfficialJournalOfIcelandAdvertsResponse } from '@island.is/api/schema' import { Stack } from '@island.is/island-ui/core' import { Locale } from '@island.is/shared/types' +import { OfficialJournalOfIcelandAdvertsResponse } from '@island.is/web/graphql/schema' import { linkResolver } from '@island.is/web/hooks' import { OJOIAdvertCard } from './OJOIAdvertCard' diff --git a/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx b/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx index 3054bbc88e70..ffbb0de1e941 100644 --- a/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx +++ b/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx @@ -10,7 +10,6 @@ import { useDebounce } from 'react-use' import { useLazyQuery } from '@apollo/client' import slugify from '@sindresorhus/slugify' -import { Organizations, SupportCategory } from '@island.is/api/schema' import { Box, Button, @@ -35,7 +34,9 @@ import { ContentLanguage, GetSupportSearchResultsQuery, GetSupportSearchResultsQueryVariables, + Organizations, SearchableContentTypes, + SupportCategory, SupportQna, } from '@island.is/web/graphql/schema' import { useNamespace } from '@island.is/web/hooks' diff --git a/apps/web/components/TableOfContents/TableOfContents.tsx b/apps/web/components/TableOfContents/TableOfContents.tsx index ca369e5327a4..0a2c3a607cf6 100644 --- a/apps/web/components/TableOfContents/TableOfContents.tsx +++ b/apps/web/components/TableOfContents/TableOfContents.tsx @@ -1,7 +1,7 @@ import { FC, useMemo } from 'react' -import { Slice } from '@island.is/api/schema' import { TableOfContents } from '@island.is/island-ui/core' +import { Slice } from '@island.is/web/graphql/schema' import { scrollTo } from '@island.is/web/hooks/useScrollSpy' export const TOC: FC< diff --git a/apps/web/components/connected/electronicRegistrationStatistics/MonthlyStatistics/MonthlyStatistics.tsx b/apps/web/components/connected/electronicRegistrationStatistics/MonthlyStatistics/MonthlyStatistics.tsx index d908a790f705..4c7774129788 100644 --- a/apps/web/components/connected/electronicRegistrationStatistics/MonthlyStatistics/MonthlyStatistics.tsx +++ b/apps/web/components/connected/electronicRegistrationStatistics/MonthlyStatistics/MonthlyStatistics.tsx @@ -3,7 +3,6 @@ import { Bar, BarChart, Legend, Tooltip, XAxis, YAxis } from 'recharts' import { useQuery } from '@apollo/client' import { BrokenDownRegistrationStatisticResponse } from '@island.is/api/domains/electronic-registration-statistics' -import { ConnectedComponent } from '@island.is/api/schema' import { Box, GridColumn, @@ -12,13 +11,13 @@ import { LoadingDots, Select, } from '@island.is/island-ui/core' +import { ConnectedComponent } from '@island.is/web/graphql/schema' import { useNamespace } from '@island.is/web/hooks' import { GET_BROKEN_DOWN_ELECTRONIC_REGISTRATION_STATISTICS_QUERY } from '../queries' +import { CustomLegend } from './CustomLegend' import { CustomTooltip } from './CustomTooltip' import { extractRegistrationTypesFromData } from './utils' -import { CustomLegend } from './CustomLegend' - import * as styles from './MonthlyStatistics.css' type QueryType = { diff --git a/apps/web/components/connected/fiskistofa/ShipSearch/ShipSearch.tsx b/apps/web/components/connected/fiskistofa/ShipSearch/ShipSearch.tsx index 1b0b913f9bd7..01c60d44f4fc 100644 --- a/apps/web/components/connected/fiskistofa/ShipSearch/ShipSearch.tsx +++ b/apps/web/components/connected/fiskistofa/ShipSearch/ShipSearch.tsx @@ -3,11 +3,6 @@ import { useIntl } from 'react-intl' import { useRouter } from 'next/router' import { useLazyQuery } from '@apollo/client' -import { - FiskistofaShipBasicInfo as ShipBasicInfo, - FiskistofaShipBasicInfoResponse, - QueryFiskistofaGetShipsArgs as QueryGetShipsArgs, -} from '@island.is/api/schema' import { Box, Button, @@ -17,6 +12,11 @@ import { Text, } from '@island.is/island-ui/core' import { shouldLinkOpenInNewWindow } from '@island.is/shared/utils' +import { + FiskistofaShipBasicInfo as ShipBasicInfo, + FiskistofaShipBasicInfoResponse, + QueryFiskistofaGetShipsArgs as QueryGetShipsArgs, +} from '@island.is/web/graphql/schema' import { GET_SHIPS_QUERY } from './queries' import { translation as translationStrings } from './translation.strings' diff --git a/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/CatchQuotaCalculator.tsx b/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/CatchQuotaCalculator.tsx index 9908a6482890..0ee7127ceaef 100644 --- a/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/CatchQuotaCalculator.tsx +++ b/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/CatchQuotaCalculator.tsx @@ -4,7 +4,6 @@ import cn from 'classnames' import { useRouter } from 'next/router' import { useMachine } from '@xstate/react' -import { FiskistofaExtendedCatchQuotaCategory as ExtendedCatchQuotaCategory } from '@island.is/api/schema' import { Box, Button, @@ -14,6 +13,7 @@ import { Tag, Text, } from '@island.is/island-ui/core' +import { FiskistofaExtendedCatchQuotaCategory as ExtendedCatchQuotaCategory } from '@island.is/web/graphql/schema' import { formattedNumberStringToNumber, diff --git a/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/machine.ts b/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/machine.ts index 37a303719bc7..128ab7f88c19 100644 --- a/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/machine.ts +++ b/apps/web/components/connected/fiskistofa/calculators/CatchQuotaCalculator/machine.ts @@ -1,19 +1,21 @@ +import { assign, createMachine } from 'xstate' import { ApolloClient } from '@apollo/client' -import { createMachine, assign } from 'xstate' + +import { sortAlpha } from '@island.is/shared/utils' +import initApollo from '@island.is/web/graphql/client' import { FiskistofaCatchQuotaCategory as CatchQuotaCategory, FiskistofaExtendedCatchQuotaCategory as ExtendedCatchQuotaCategory, - QueryFiskistofaUpdateShipStatusForTimePeriodArgs as QueryUpdateShipStatusForTimePeriodArgs, - QueryFiskistofaGetShipStatusForTimePeriodArgs as QueryGetShipStatusForTimePeriodArgs, - FiskistofaQuotaType as QuotaType, - FiskistofaShip as Ship, - QueryFiskistofaUpdateShipQuotaStatusForTimePeriodArgs as QueryUpdateShipQuotaStatusForTimePeriodArgs, FiskistofaExtendedShipStatusInformationResponse, - FiskistofaQuotaTypeResponse, FiskistofaExtendedShipStatusInformationUpdateResponse, FiskistofaQuotaStatusResponse, -} from '@island.is/api/schema' -import { sortAlpha } from '@island.is/shared/utils' + FiskistofaQuotaType as QuotaType, + FiskistofaQuotaTypeResponse, + FiskistofaShip as Ship, + QueryFiskistofaGetShipStatusForTimePeriodArgs as QueryGetShipStatusForTimePeriodArgs, + QueryFiskistofaUpdateShipQuotaStatusForTimePeriodArgs as QueryUpdateShipQuotaStatusForTimePeriodArgs, + QueryFiskistofaUpdateShipStatusForTimePeriodArgs as QueryUpdateShipStatusForTimePeriodArgs, +} from '@island.is/web/graphql/schema' import { GET_QUOTA_TYPES_FOR_TIME_PERIOD, @@ -21,7 +23,6 @@ import { UPDATE_SHIP_QUOTA_STATUS_FOR_TIME_PERIOD, UPDATE_SHIP_STATUS_FOR_TIME_PERIOD, } from '../queries' -import initApollo from '@island.is/web/graphql/client' type ContextData = { shipInformation?: Ship diff --git a/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/StraddlingStockCalculator.tsx b/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/StraddlingStockCalculator.tsx index c9645a528052..3c1b664de956 100644 --- a/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/StraddlingStockCalculator.tsx +++ b/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/StraddlingStockCalculator.tsx @@ -4,7 +4,6 @@ import cn from 'classnames' import { useRouter } from 'next/router' import { useMachine } from '@xstate/react' -import { FiskistofaCatchQuotaCategory as CatchQuotaCategory } from '@island.is/api/schema' import { Box, Button, @@ -14,6 +13,7 @@ import { Tag, Text, } from '@island.is/island-ui/core' +import { FiskistofaCatchQuotaCategory as CatchQuotaCategory } from '@island.is/web/graphql/schema' import { getYearOptions, diff --git a/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/machine.ts b/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/machine.ts index de2824bdd3f2..8aa16c587930 100644 --- a/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/machine.ts +++ b/apps/web/components/connected/fiskistofa/calculators/StraddlingStockCalculator/machine.ts @@ -1,16 +1,18 @@ +import { assign, createMachine } from 'xstate' import { ApolloClient } from '@apollo/client' + +import { sortAlpha } from '@island.is/shared/utils' +import initApollo from '@island.is/web/graphql/client' import { FiskistofaCatchQuotaCategory as CatchQuotaCategory, - QueryFiskistofaUpdateShipStatusForCalendarYearArgs as QueryUpdateShipStatusForCalendarYearArgs, - QueryFiskistofaGetShipStatusForCalendarYearArgs as QueryGetShipStatusForCalendarYearArgs, FiskistofaQuotaType as QuotaType, + FiskistofaQuotaTypeResponse, FiskistofaShip as Ship, FiskistofaShipStatusInformationResponse, - FiskistofaQuotaTypeResponse, -} from '@island.is/api/schema' -import { sortAlpha } from '@island.is/shared/utils' -import initApollo from '@island.is/web/graphql/client' -import { createMachine, assign } from 'xstate' + QueryFiskistofaGetShipStatusForCalendarYearArgs as QueryGetShipStatusForCalendarYearArgs, + QueryFiskistofaUpdateShipStatusForCalendarYearArgs as QueryUpdateShipStatusForCalendarYearArgs, +} from '@island.is/web/graphql/schema' + import { GET_QUOTA_TYPES_FOR_CALENDAR_YEAR, GET_SHIP_STATUS_FOR_CALENDAR_YEAR, diff --git a/apps/web/components/connected/syslumenn/TableLists/BrokersList/BrokersList.tsx b/apps/web/components/connected/syslumenn/TableLists/BrokersList/BrokersList.tsx index e8a12bb7bc0f..2e31ca599676 100644 --- a/apps/web/components/connected/syslumenn/TableLists/BrokersList/BrokersList.tsx +++ b/apps/web/components/connected/syslumenn/TableLists/BrokersList/BrokersList.tsx @@ -2,7 +2,6 @@ import { CSSProperties, FC, useState } from 'react' import { useIntl } from 'react-intl' import { useQuery } from '@apollo/client/react' -import { ConnectedComponent, Query } from '@island.is/api/schema' import { AlertMessage, Box, @@ -13,6 +12,7 @@ import { Text, } from '@island.is/island-ui/core' import { sortAlpha } from '@island.is/shared/utils' +import { ConnectedComponent, Query } from '@island.is/web/graphql/schema' import { GET_BROKERS_QUERY } from './queries' import { translation as t } from './translation.strings' diff --git a/apps/web/components/connected/syslumenn/TableLists/JourneymanList/JourneymanList.tsx b/apps/web/components/connected/syslumenn/TableLists/JourneymanList/JourneymanList.tsx index 23162b629e9b..d9c09ee629ee 100644 --- a/apps/web/components/connected/syslumenn/TableLists/JourneymanList/JourneymanList.tsx +++ b/apps/web/components/connected/syslumenn/TableLists/JourneymanList/JourneymanList.tsx @@ -3,7 +3,6 @@ import { useIntl } from 'react-intl' import { useQueryState } from 'next-usequerystate' import { useQuery } from '@apollo/client/react' -import { ConnectedComponent, Query } from '@island.is/api/schema' import { AlertMessage, Box, @@ -19,7 +18,11 @@ import { } from '@island.is/island-ui/core' import { sortAlpha } from '@island.is/shared/utils' import { SyslumennListCsvExport } from '@island.is/web/components' -import { JourneymanLicence } from '@island.is/web/graphql/schema' +import { + ConnectedComponent, + JourneymanLicence, + Query, +} from '@island.is/web/graphql/schema' import { useDateUtils } from '@island.is/web/i18n/useDateUtils' import { diff --git a/apps/web/components/connected/syslumenn/TableLists/MasterList/MasterList.tsx b/apps/web/components/connected/syslumenn/TableLists/MasterList/MasterList.tsx index 6977134bfa54..bd7a11b81aea 100644 --- a/apps/web/components/connected/syslumenn/TableLists/MasterList/MasterList.tsx +++ b/apps/web/components/connected/syslumenn/TableLists/MasterList/MasterList.tsx @@ -3,7 +3,6 @@ import { useIntl } from 'react-intl' import { useQueryState } from 'next-usequerystate' import { useQuery } from '@apollo/client/react' -import { ConnectedComponent, Query } from '@island.is/api/schema' import { AlertMessage, Box, @@ -19,6 +18,7 @@ import { } from '@island.is/island-ui/core' import { sortAlpha } from '@island.is/shared/utils' import { SyslumennListCsvExport } from '@island.is/web/components' +import { ConnectedComponent, Query } from '@island.is/web/graphql/schema' import { MasterLicence } from '@island.is/web/graphql/schema' import { useDateUtils } from '@island.is/web/i18n/useDateUtils' diff --git a/apps/web/components/connected/syslumenn/utils/search.ts b/apps/web/components/connected/syslumenn/utils/search.ts index 835f4f63c8f5..0e7c0b50d9b5 100644 --- a/apps/web/components/connected/syslumenn/utils/search.ts +++ b/apps/web/components/connected/syslumenn/utils/search.ts @@ -19,9 +19,7 @@ export const textSearch = ( ) } -export const getSortedAndFilteredList = < - T extends Record, ->( +export const getSortedAndFilteredList = ( list: T[], searchTerms: string[], keys: (keyof T)[], @@ -30,13 +28,15 @@ export const getSortedAndFilteredList = < const startsWithFullSearchString = (item: T): boolean => { return keys.some((key) => - item[key]?.trim().toLowerCase().startsWith(fullSearchString), + (item[key] as string)?.trim().toLowerCase().startsWith(fullSearchString), ) } const containsAllTerms = (item: T): boolean => { return searchTerms.every((searchTerm) => - keys.some((key) => item[key]?.trim().toLowerCase().includes(searchTerm)), + keys.some((key) => + (item[key] as string)?.trim().toLowerCase().includes(searchTerm), + ), ) } diff --git a/apps/web/screens/Adgerdir/Article.tsx b/apps/web/screens/Adgerdir/Article.tsx index 7ed5c8ae8f8b..d714ab838c9f 100644 --- a/apps/web/screens/Adgerdir/Article.tsx +++ b/apps/web/screens/Adgerdir/Article.tsx @@ -1,43 +1,44 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ -import React, { useRef, useState, useEffect } from 'react' +import React, { useEffect, useRef, useState } from 'react' import { createPortal } from 'react-dom' import NextLink from 'next/link' + +import { richText, Slice as SliceType } from '@island.is/island-ui/contentful' import { - ContentBlock, Box, - Stack, + ContentBlock, Inline, + Stack, Text, } from '@island.is/island-ui/core' -import { richText, Slice as SliceType } from '@island.is/island-ui/contentful' +import { HeadWithSocialSharing } from '@island.is/web/components' import { - Query, - QueryGetNamespaceArgs, ContentLanguage, + Query, QueryGetAdgerdirPageArgs, QueryGetAdgerdirPagesArgs, QueryGetAdgerdirTagsArgs, -} from '@island.is/api/schema' + QueryGetNamespaceArgs, +} from '@island.is/web/graphql/schema' +import { useNamespace } from '@island.is/web/hooks' +import { useI18n } from '@island.is/web/i18n' import { withMainLayout } from '@island.is/web/layouts/main' -import { HeadWithSocialSharing } from '@island.is/web/components' -import AdgerdirArticles from './components/AdgerdirArticles/AdgerdirArticles' -import { Tag } from './components/UI/Tag/Tag' -import { ProcessEntry } from './components/UI/ProcessEntry/ProcessEntry' -import { Breadcrumbs } from './components/UI/Breadcrumbs/Breadcrumbs' -import { ColorSchemeContext } from './components/UI/ColorSchemeContext/ColorSchemeContext' +import { SidebarLayout } from '@island.is/web/screens/Layouts/SidebarLayout' +import { Screen } from '@island.is/web/types' +import { CustomNextError } from '@island.is/web/units/errors' + +import { LinkType, useLinkResolver } from '../../hooks/useLinkResolver' import { GET_ADGERDIR_PAGE_QUERY, - GET_NAMESPACE_QUERY, GET_ADGERDIR_PAGES_QUERY, GET_ADGERDIR_TAGS_QUERY, + GET_NAMESPACE_QUERY, } from '../queries' -import { SidebarLayout } from '@island.is/web/screens/Layouts/SidebarLayout' -import { Screen } from '@island.is/web/types' -import { useI18n } from '@island.is/web/i18n' -import { CustomNextError } from '@island.is/web/units/errors' -import { useNamespace } from '@island.is/web/hooks' -import { LinkType, useLinkResolver } from '../../hooks/useLinkResolver' - +import AdgerdirArticles from './components/AdgerdirArticles/AdgerdirArticles' +import { Breadcrumbs } from './components/UI/Breadcrumbs/Breadcrumbs' +import { ColorSchemeContext } from './components/UI/ColorSchemeContext/ColorSchemeContext' +import { ProcessEntry } from './components/UI/ProcessEntry/ProcessEntry' +import { Tag } from './components/UI/Tag/Tag' import * as covidStyles from './components/UI/styles/styles.css' interface AdgerdirArticleProps { diff --git a/apps/web/screens/Adgerdir/Home.tsx b/apps/web/screens/Adgerdir/Home.tsx index a997a093eab5..753f584f4722 100644 --- a/apps/web/screens/Adgerdir/Home.tsx +++ b/apps/web/screens/Adgerdir/Home.tsx @@ -1,62 +1,61 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import React from 'react' import NextLink from 'next/link' + +import { Slice as SliceType } from '@island.is/island-ui/contentful' import { Box, + ColorSchemeContext, ContentBlock, - Text, - Stack, GridColumn, - Hidden, - GridRow, GridContainer, - ColorSchemeContext, + GridRow, + Hidden, + Stack, + Text, } from '@island.is/island-ui/core' -import { withMainLayout } from '@island.is/web/layouts/main' -import { Slice as SliceType } from '@island.is/island-ui/contentful' +import { Locale } from '@island.is/shared/types' import { - RichText, - HeadWithSocialSharing, Header, + HeadWithSocialSharing, Main, + RichText, } from '@island.is/web/components' -import AdgerdirArticles from './components/AdgerdirArticles/AdgerdirArticles' -import GroupedPages from './components/GroupedPages/GroupedPages' -import CardsSlider from './components/CardsSlider/CardsSlider' -import FeaturedNews from './components/FeaturedNews/FeaturedNews' -import { ColorSchemeContext as CovidColorSchemeContext } from './components/UI/ColorSchemeContext/ColorSchemeContext' -import { useI18n } from '@island.is/web/i18n' import { - Query, - QueryGetNamespaceArgs, ContentLanguage, - QueryGetAdgerdirPagesArgs, - QueryGetAdgerdirTagsArgs, - QueryGetGroupedMenuArgs, -} from '@island.is/api/schema' -import { - GET_ADGERDIR_TAGS_QUERY, - GET_NAMESPACE_QUERY, - GET_ADGERDIR_PAGES_QUERY, - GET_ADGERDIR_FRONTPAGE_QUERY, - GET_CATEGORIES_QUERY, -} from '../queries' -import { Screen } from '../../types' -import { useNamespace } from '@island.is/web/hooks' -import { Breadcrumbs } from './components/UI/Breadcrumbs/Breadcrumbs' -import { GetArticleCategoriesQuery, GetGroupedMenuQuery, + Query, + QueryGetAdgerdirPagesArgs, + QueryGetAdgerdirTagsArgs, QueryGetArticleCategoriesArgs, + QueryGetGroupedMenuArgs, + QueryGetNamespaceArgs, } from '@island.is/web/graphql/schema' -import { GET_GROUPED_MENU_QUERY } from '../queries/Menu' -import { Locale } from '@island.is/shared/types' +import { useNamespace } from '@island.is/web/hooks' +import { LinkType, useLinkResolver } from '@island.is/web/hooks/useLinkResolver' +import { useI18n } from '@island.is/web/i18n' +import { withMainLayout } from '@island.is/web/layouts/main' import { formatMegaMenuCategoryLinks, formatMegaMenuLinks, } from '@island.is/web/utils/processMenuData' -import { useLinkResolver, LinkType } from '@island.is/web/hooks/useLinkResolver' +import { Screen } from '../../types' +import { + GET_ADGERDIR_FRONTPAGE_QUERY, + GET_ADGERDIR_PAGES_QUERY, + GET_ADGERDIR_TAGS_QUERY, + GET_CATEGORIES_QUERY, + GET_NAMESPACE_QUERY, +} from '../queries' +import { GET_GROUPED_MENU_QUERY } from '../queries/Menu' +import AdgerdirArticles from './components/AdgerdirArticles/AdgerdirArticles' +import CardsSlider from './components/CardsSlider/CardsSlider' +import FeaturedNews from './components/FeaturedNews/FeaturedNews' +import GroupedPages from './components/GroupedPages/GroupedPages' +import { Breadcrumbs } from './components/UI/Breadcrumbs/Breadcrumbs' +import { ColorSchemeContext as CovidColorSchemeContext } from './components/UI/ColorSchemeContext/ColorSchemeContext' import * as covidStyles from './components/UI/styles/styles.css' interface HomeProps { diff --git a/apps/web/screens/Adgerdir/components/AdgerdirArticles/AdgerdirArticles.tsx b/apps/web/screens/Adgerdir/components/AdgerdirArticles/AdgerdirArticles.tsx index e4de43c24734..c2d100eda6a4 100644 --- a/apps/web/screens/Adgerdir/components/AdgerdirArticles/AdgerdirArticles.tsx +++ b/apps/web/screens/Adgerdir/components/AdgerdirArticles/AdgerdirArticles.tsx @@ -1,36 +1,37 @@ import React, { FC, - useState, - useContext, useCallback, + useContext, useEffect, useRef, + useState, } from 'react' -import uniq from 'lodash/uniq' import intersection from 'lodash/intersection' +import uniq from 'lodash/uniq' + import { Box, - Tiles, - Stack, - Text, - Inline, Icon, + Inline, LoadingDots, + Stack, + Text, + Tiles, } from '@island.is/island-ui/core' -import { AdgerdirPage, AdgerdirTag } from '@island.is/api/schema' -import { useNamespace } from '@island.is/web/hooks' -import { Card } from '../UI/Card/Card' -import { Button } from '../UI/Button/Button' -import { Tag } from '../UI/Tag/Tag' -import { ColorSchemeContext } from '../UI/ColorSchemeContext/ColorSchemeContext' import { - ADGERDIR_INDIVIDUALS_TAG_ID, ADGERDIR_COMPANIES_TAG_ID, + ADGERDIR_INDIVIDUALS_TAG_ID, } from '@island.is/web/constants' +import { AdgerdirPage, AdgerdirTag } from '@island.is/web/graphql/schema' +import { useNamespace } from '@island.is/web/hooks' +import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' -import * as styles from './AdgerdirArticles.css' +import { Button } from '../UI/Button/Button' +import { Card } from '../UI/Card/Card' +import { ColorSchemeContext } from '../UI/ColorSchemeContext/ColorSchemeContext' +import { Tag } from '../UI/Tag/Tag' import * as covidStyles from '../UI/styles/styles.css' -import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' +import * as styles from './AdgerdirArticles.css' const FILTER_TIMER = 300 const ITEMS_PER_SHOW = 9 diff --git a/apps/web/screens/Adgerdir/components/CardsSlider/CardsSlider.tsx b/apps/web/screens/Adgerdir/components/CardsSlider/CardsSlider.tsx index d9bf856ba838..b1b0cebc776e 100644 --- a/apps/web/screens/Adgerdir/components/CardsSlider/CardsSlider.tsx +++ b/apps/web/screens/Adgerdir/components/CardsSlider/CardsSlider.tsx @@ -1,23 +1,25 @@ import React, { FC, - useState, - useEffect, - useRef, useCallback, useContext, + useEffect, + useRef, + useState, } from 'react' -import cn from 'classnames' import AliceCarousel, { EventObject } from 'react-alice-carousel' -import { Icon, Inline, Hidden } from '@island.is/island-ui/core' -import { AdgerdirPage } from '@island.is/api/schema' +import cn from 'classnames' + +import { Hidden, Icon, Inline } from '@island.is/island-ui/core' +import { AdgerdirPage } from '@island.is/web/graphql/schema' +import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' + +import { Card } from '../UI/Card/Card' import { ColorSchemeContext, ColorSchemes, } from '../UI/ColorSchemeContext/ColorSchemeContext' -import { Card } from '../UI/Card/Card' import 'react-alice-carousel/lib/alice-carousel.css' import * as styles from './CardsSlider.css' -import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' interface StagePaddingProps { paddingLeft: number diff --git a/apps/web/screens/Adgerdir/components/FeaturedNews/FeaturedNews.tsx b/apps/web/screens/Adgerdir/components/FeaturedNews/FeaturedNews.tsx index 08cef8518b28..b521a73659a5 100644 --- a/apps/web/screens/Adgerdir/components/FeaturedNews/FeaturedNews.tsx +++ b/apps/web/screens/Adgerdir/components/FeaturedNews/FeaturedNews.tsx @@ -1,21 +1,22 @@ import React, { FC } from 'react' import format from 'date-fns/format' import is from 'date-fns/locale/is' + import { Box, + Button, + GridColumn, GridContainer, GridRow, - GridColumn, - Stack, - Button, Link, + Stack, } from '@island.is/island-ui/core' -import { News } from '@island.is/api/schema' import { BackgroundImage } from '@island.is/web/components' -import AdgerdirHeading from '../AdgerdirHeading/AdgerdirHeading' +import { News } from '@island.is/web/graphql/schema' +import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' +import AdgerdirHeading from '../AdgerdirHeading/AdgerdirHeading' import * as styles from './FeaturedNews.css' -import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' interface FeaturedNewsProps { items: Array diff --git a/apps/web/screens/Adgerdir/components/LatestNews/LatestNews.tsx b/apps/web/screens/Adgerdir/components/LatestNews/LatestNews.tsx index 91cc3f50b757..75e627b127e6 100644 --- a/apps/web/screens/Adgerdir/components/LatestNews/LatestNews.tsx +++ b/apps/web/screens/Adgerdir/components/LatestNews/LatestNews.tsx @@ -1,7 +1,9 @@ import React, { FC } from 'react' -import { Text, Box, Stack, Tiles } from '@island.is/island-ui/core' + +import { Box, Stack, Text, Tiles } from '@island.is/island-ui/core' +import { Image } from '@island.is/web/graphql/schema' import { useDateUtils } from '@island.is/web/i18n/useDateUtils' -import { Image } from '@island.is/api/schema' + import * as styles from './LatestNews.css' export interface LatestNewsItem { diff --git a/apps/web/screens/Home/Home.tsx b/apps/web/screens/Home/Home.tsx index 98bd37bb102a..a6b9087537ea 100644 --- a/apps/web/screens/Home/Home.tsx +++ b/apps/web/screens/Home/Home.tsx @@ -1,34 +1,36 @@ import React, { useContext } from 'react' -import { Box, GridContainer } from '@island.is/island-ui/core' -import { useI18n } from '@island.is/web/i18n' -import { Screen } from '@island.is/web/types' -import { useNamespace } from '@island.is/web/hooks' + +import { Box } from '@island.is/island-ui/core' +import { Locale } from '@island.is/shared/types' +import { + CategoryItems, + LifeEventsSection, + NewsItems, + SearchSection, + WatsonChatPanel, +} from '@island.is/web/components' +import { FRONTPAGE_NEWS_TAG_ID } from '@island.is/web/constants' +import { GlobalContext } from '@island.is/web/context' import { ContentLanguage, - QueryGetArticleCategoriesArgs, GetArticleCategoriesQuery, GetFrontpageQuery, - QueryGetFrontpageArgs, GetNewsQuery, + LifeEventPage, + QueryGetArticleCategoriesArgs, + QueryGetFrontpageArgs, + QueryGetNewsArgs, } from '@island.is/web/graphql/schema' +import { useNamespace } from '@island.is/web/hooks' +import { useI18n } from '@island.is/web/i18n' +import { withMainLayout } from '@island.is/web/layouts/main' import { GET_CATEGORIES_QUERY, GET_FRONTPAGE_QUERY, GET_NEWS_QUERY, } from '@island.is/web/screens/queries' -import { - SearchSection, - CategoryItems, - NewLinks, - NewsItems, - LifeEventsSection, - WatsonChatPanel, -} from '@island.is/web/components' -import { withMainLayout } from '@island.is/web/layouts/main' -import { GlobalContext } from '@island.is/web/context' -import { LifeEventPage, QueryGetNewsArgs } from '@island.is/api/schema' -import { FRONTPAGE_NEWS_TAG_ID } from '@island.is/web/constants' -import { Locale } from '@island.is/shared/types' +import { Screen } from '@island.is/web/types' + import { watsonConfig } from './config' interface HomeProps { diff --git a/apps/web/screens/LifeEvents/LifeEvents.tsx b/apps/web/screens/LifeEvents/LifeEvents.tsx index addb8d04ed0e..3a09ba86d373 100644 --- a/apps/web/screens/LifeEvents/LifeEvents.tsx +++ b/apps/web/screens/LifeEvents/LifeEvents.tsx @@ -1,9 +1,5 @@ import Head from 'next/head' -import { - ContentLanguage, - QueryGetLifeEventsForOverviewArgs, -} from '@island.is/api/schema' import { Breadcrumbs, GridColumn, @@ -13,8 +9,10 @@ import { } from '@island.is/island-ui/core' import { CardWithFeaturedItems, GridItems } from '@island.is/web/components' import { + ContentLanguage, type GetLifeEventsForOverviewQuery, type GetNamespaceQuery, + QueryGetLifeEventsForOverviewArgs, type QueryGetNamespaceArgs, } from '@island.is/web/graphql/schema' import { diff --git a/apps/web/screens/Login/Login.tsx b/apps/web/screens/Login/Login.tsx index 67801a360987..40bbe2f4dd2e 100644 --- a/apps/web/screens/Login/Login.tsx +++ b/apps/web/screens/Login/Login.tsx @@ -1,23 +1,25 @@ import React from 'react' + import { - GridContainer, Box, + Bullet, + BulletList, + Button, + ContentBlock, GridColumn, + GridContainer, GridRow, - Text, - ContentBlock, - Button, Hidden, - BulletList, - Bullet, + Text, } from '@island.is/island-ui/core' +import { webLoginButtonSelect } from '@island.is/plausible' import { SvgLogin } from '@island.is/web/components' import { LoginPageTexts } from '@island.is/web/components' -import { Screen } from '@island.is/web/types' -import { withMainLayout } from '@island.is/web/layouts/main' +import { Query, QueryGetNamespaceArgs } from '@island.is/web/graphql/schema' import { useNamespaceStrict as useNamespace } from '@island.is/web/hooks' -import { Query, QueryGetNamespaceArgs } from '@island.is/api/schema' -import { webLoginButtonSelect } from '@island.is/plausible' +import { withMainLayout } from '@island.is/web/layouts/main' +import { Screen } from '@island.is/web/types' + import { GET_NAMESPACE_QUERY } from '../queries' import * as styles from './Login.css' diff --git a/apps/web/screens/OfficialJournalOfIceland/hooks/useAdverts.ts b/apps/web/screens/OfficialJournalOfIceland/hooks/useAdverts.ts index 235c26397441..97b20131365b 100644 --- a/apps/web/screens/OfficialJournalOfIceland/hooks/useAdverts.ts +++ b/apps/web/screens/OfficialJournalOfIceland/hooks/useAdverts.ts @@ -3,7 +3,7 @@ import { useQuery } from '@apollo/client' import { OfficialJournalOfIcelandAdvert, OfficialJournalOfIcelandAdvertsResponse, -} from '@island.is/api/schema' +} from '@island.is/web/graphql/schema' import { ADVERTS_QUERY } from '../../queries/OfficialJournalOfIceland' import { getAdvertParams } from '../lib/advert-params.mapper' diff --git a/apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculator.tsx b/apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculator.tsx index 2dfab0c78d4e..b22fcf8e8255 100644 --- a/apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculator.tsx +++ b/apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculator.tsx @@ -6,7 +6,6 @@ import differenceInMonths from 'date-fns/differenceInMonths' import { useRouter } from 'next/router' import { useQueryState } from 'next-usequerystate' -import { CustomPageUniqueIdentifier } from '@island.is/api/schema' import { Box, Button, @@ -26,6 +25,7 @@ import { import { sortAlpha } from '@island.is/shared/utils' import { getThemeConfig, MarkdownText } from '@island.is/web/components' import { + CustomPageUniqueIdentifier, Organization, OrganizationPage, Query, diff --git a/apps/web/screens/Organization/StafraentIsland/ApiCatalogue.tsx b/apps/web/screens/Organization/StafraentIsland/ApiCatalogue.tsx index fd68e393a59a..7373d5adb7e6 100644 --- a/apps/web/screens/Organization/StafraentIsland/ApiCatalogue.tsx +++ b/apps/web/screens/Organization/StafraentIsland/ApiCatalogue.tsx @@ -1,5 +1,17 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import { ReactNode, useEffect, useState } from 'react' +import { useWindowSize } from 'react-use' +import { useRouter } from 'next/router' +import { useQuery } from '@apollo/client' +import { INLINES } from '@contentful/rich-text-types' + +import { + AccessCategory, + DataCategory, + PricingCategory, + TypeCategory, +} from '@island.is/api-catalogue/consts' +import { SliceType } from '@island.is/island-ui/contentful' import { ArrowLink, Box, @@ -10,49 +22,37 @@ import { NavigationItem, Text, } from '@island.is/island-ui/core' -import { withMainLayout } from '@island.is/web/layouts/main' +import { theme } from '@island.is/island-ui/theme' +import { + ApiCatalogueFilter, + OrganizationWrapper, + ServiceList, + Webreader, +} from '@island.is/web/components' import { ContentLanguage, + GetApiCatalogueInput, GetNamespaceQuery, Query, + QueryGetApiCatalogueArgs, QueryGetNamespaceArgs, QueryGetOrganizationPageArgs, QueryGetOrganizationSubpageArgs, } from '@island.is/web/graphql/schema' +import { useNamespace } from '@island.is/web/hooks' +import useContentfulId from '@island.is/web/hooks/useContentfulId' +import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' +import { withMainLayout } from '@island.is/web/layouts/main' +import { CustomNextError } from '@island.is/web/units/errors' +import { webRichText } from '@island.is/web/utils/richText' + +import { Screen } from '../../../types' import { GET_CATALOGUE_QUERY, GET_NAMESPACE_QUERY, GET_ORGANIZATION_PAGE_QUERY, GET_ORGANIZATION_SUBPAGE_QUERY, } from '../../queries' -import { Screen } from '../../../types' -import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' -import { - ApiCatalogueFilter, - OrganizationWrapper, - ServiceList, - Webreader, -} from '@island.is/web/components' -import { CustomNextError } from '@island.is/web/units/errors' -import { SliceType } from '@island.is/island-ui/contentful' -import { useNamespace } from '@island.is/web/hooks' -import { - GetApiCatalogueInput, - QueryGetApiCatalogueArgs, -} from '@island.is/api/schema' -import { useQuery } from '@apollo/client' -import { - AccessCategory, - DataCategory, - PricingCategory, - TypeCategory, -} from '@island.is/api-catalogue/consts' -import { useRouter } from 'next/router' -import { INLINES } from '@contentful/rich-text-types' -import { useWindowSize } from 'react-use' -import { theme } from '@island.is/island-ui/theme' -import useContentfulId from '@island.is/web/hooks/useContentfulId' -import { webRichText } from '@island.is/web/utils/richText' const LIMIT = 20 From a66c284110810a1cdb2bb292e63962be6f35a8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Sat, 4 Jan 2025 06:20:22 +0000 Subject: [PATCH 18/25] feat(web): Service web - Disable contact form for some organizations (#17362) * Disable contact form for some organizations * Add way to change what is in default footer for service web pages --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../ServiceWeb/DynamicFooter/DynamicFooter.tsx | 6 +++++- .../components/ServiceWeb/Footer/Footer.tsx | 18 +++++++++++------- apps/web/screens/ServiceWeb/Forms/Forms.tsx | 11 ++++++++++- apps/web/screens/ServiceWeb/Home/Home.tsx | 10 ++++------ .../ServiceWeb/Search/ServiceSearch.tsx | 14 ++++++++------ .../web/screens/ServiceWeb/SubPage/SubPage.tsx | 8 +++----- apps/web/screens/ServiceWeb/utils/index.ts | 10 ++++++++++ 7 files changed, 51 insertions(+), 26 deletions(-) diff --git a/apps/web/components/ServiceWeb/DynamicFooter/DynamicFooter.tsx b/apps/web/components/ServiceWeb/DynamicFooter/DynamicFooter.tsx index a266c901f291..ec4e0132c0fa 100644 --- a/apps/web/components/ServiceWeb/DynamicFooter/DynamicFooter.tsx +++ b/apps/web/components/ServiceWeb/DynamicFooter/DynamicFooter.tsx @@ -1,6 +1,7 @@ import { OrganizationFooter, ServiceWebFooter } from '@island.is/web/components' import { Organization } from '@island.is/web/graphql/schema' import { useLinkResolver } from '@island.is/web/hooks/useLinkResolver' +import { shouldShowInstitutionContactBanner } from '@island.is/web/screens/ServiceWeb/utils' interface DynamicFooterProps { organization: Organization @@ -21,7 +22,9 @@ export const DynamicFooter = ({ return null } - const contactLink = linkResolver('servicewebcontact', [slug]).href + const contactLink = shouldShowInstitutionContactBanner(slug) + ? linkResolver('servicewebcontact', [slug]).href + : namespace?.serviceWebContactLink return organization?.footerItems?.length > 0 ? ( @@ -31,6 +34,7 @@ export const DynamicFooter = ({ logoSrc={organization?.logo?.url} phone={organization?.phone} contactLink={contactLink} + contactLinkLabel={namespace?.serviceWebContactLinkLabel} namespace={namespace} /> ) diff --git a/apps/web/components/ServiceWeb/Footer/Footer.tsx b/apps/web/components/ServiceWeb/Footer/Footer.tsx index 404c31d6535c..d528e378e6ab 100644 --- a/apps/web/components/ServiceWeb/Footer/Footer.tsx +++ b/apps/web/components/ServiceWeb/Footer/Footer.tsx @@ -1,23 +1,24 @@ import { FC } from 'react' + import { Box, GridColumn, GridContainer, GridRow, Hidden, - Text, + Hyphen, + Inline, + Link, + LinkContext, Logo, Stack, - LinkContext, - Link, - Inline, - Hyphen, + Text, } from '@island.is/island-ui/core' -import Illustration from './Illustration' import { Locale } from '@island.is/shared/types' import { shouldLinkOpenInNewWindow } from '@island.is/shared/utils' import { useNamespace } from '@island.is/web/hooks' +import Illustration from './Illustration' import * as styles from './Footer.css' interface Props { @@ -25,6 +26,7 @@ interface Props { locale?: Locale logoSrc?: string contactLink?: string + contactLinkLabel?: string phone?: string namespace: Record } @@ -34,6 +36,7 @@ export const Footer: FC> = ({ locale = 'is', logoSrc, contactLink, + contactLinkLabel, phone, namespace, }) => { @@ -130,7 +133,8 @@ export const Footer: FC> = ({ > - {n('sendUsALine', 'Sendu okkur línu')} + {contactLinkLabel || + n('sendUsALine', 'Sendu okkur línu')} diff --git a/apps/web/screens/ServiceWeb/Forms/Forms.tsx b/apps/web/screens/ServiceWeb/Forms/Forms.tsx index 0c85d558e9d0..7dd5a4a2c638 100644 --- a/apps/web/screens/ServiceWeb/Forms/Forms.tsx +++ b/apps/web/screens/ServiceWeb/Forms/Forms.tsx @@ -1,5 +1,4 @@ import { ReactNode, useEffect, useMemo } from 'react' -import { Locale } from '@island.is/shared/types' import NextLink from 'next/link' import { useMutation } from '@apollo/client' import { BLOCKS, INLINES } from '@contentful/rich-text-types' @@ -19,6 +18,7 @@ import { toast, ToastContainer, } from '@island.is/island-ui/core' +import { Locale } from '@island.is/shared/types' import { ServiceWebStandardForm, ServiceWebWrapper, @@ -42,6 +42,7 @@ import useContentfulId from '@island.is/web/hooks/useContentfulId' import useLocalLinkTypeResolver from '@island.is/web/hooks/useLocalLinkTypeResolver' import { useI18n } from '@island.is/web/i18n' import { withMainLayout } from '@island.is/web/layouts/main' +import { CustomNextError } from '@island.is/web/units/errors' import { webRichText } from '@island.is/web/utils/richText' import { Screen } from '../../../types' @@ -53,6 +54,7 @@ import { GET_SUPPORT_CATEGORIES_IN_ORGANIZATION, SERVICE_WEB_FORMS_MUTATION, } from '../../queries' +import { shouldShowInstitutionContactBanner } from '../utils' import { filterSupportCategories } from './utils' type FormNamespace = Record< @@ -461,6 +463,13 @@ ServiceWebFormsPage.getProps = async ({ apolloClient, locale, query }) => { }), ]) + if (!shouldShowInstitutionContactBanner(slug)) { + throw new CustomNextError( + 404, + `Service web contact form has been disabled for slug: ${slug}`, + ) + } + const filteredSupportCategories = filterSupportCategories( supportCategories?.data?.getSupportCategoriesInOrganization, slug, diff --git a/apps/web/screens/ServiceWeb/Home/Home.tsx b/apps/web/screens/ServiceWeb/Home/Home.tsx index 5fffeee97032..0035c070174b 100644 --- a/apps/web/screens/ServiceWeb/Home/Home.tsx +++ b/apps/web/screens/ServiceWeb/Home/Home.tsx @@ -1,4 +1,3 @@ -import { Locale } from '@island.is/shared/types' import { useRouter } from 'next/router' import { @@ -11,6 +10,7 @@ import { TopicCard, } from '@island.is/island-ui/core' import { Colors } from '@island.is/island-ui/theme' +import { Locale } from '@island.is/shared/types' import { sortAlpha } from '@island.is/shared/utils' import { Card, @@ -52,7 +52,7 @@ import { GET_SUPPORT_CATEGORIES_IN_ORGANIZATION, } from '../../queries' import ContactBanner from '../ContactBanner/ContactBanner' -import { getSlugPart } from '../utils' +import { getSlugPart, shouldShowInstitutionContactBanner } from '../utils' import * as styles from './Home.css' interface HomeProps { @@ -92,9 +92,7 @@ const Home: Screen = ({ const institutionSlugBelongsToMannaudstorg = institutionSlug.includes('mannaudstorg') - const institutionSlugBelongsToTryggingastofnun = - institutionSlug.includes('tryggingastofnun') || - institutionSlug.includes('social-insurance-administration') + const showContactBanner = shouldShowInstitutionContactBanner(institutionSlug) const organizationTitle = (organization && organization.title) || 'Ísland.is' const headerTitle = institutionSlugBelongsToMannaudstorg @@ -277,7 +275,7 @@ const Home: Screen = ({ - {!institutionSlugBelongsToTryggingastofnun && ( + {showContactBanner && ( diff --git a/apps/web/screens/ServiceWeb/Search/ServiceSearch.tsx b/apps/web/screens/ServiceWeb/Search/ServiceSearch.tsx index 7816369352ea..d9b0e5c14fde 100644 --- a/apps/web/screens/ServiceWeb/Search/ServiceSearch.tsx +++ b/apps/web/screens/ServiceWeb/Search/ServiceSearch.tsx @@ -1,5 +1,4 @@ import { useMemo } from 'react' -import { Locale } from '@island.is/shared/types' import NextLink from 'next/link' import { useRouter } from 'next/router' @@ -16,6 +15,7 @@ import { Stack, Text, } from '@island.is/island-ui/core' +import { Locale } from '@island.is/shared/types' import { Card, CardTagsProps, @@ -51,7 +51,11 @@ import { GET_SUPPORT_SEARCH_RESULTS_QUERY, } from '../../queries' import ContactBanner from '../ContactBanner/ContactBanner' -import { getServiceWebSearchTagQuery, getSlugPart } from '../utils' +import { + getServiceWebSearchTagQuery, + getSlugPart, + shouldShowInstitutionContactBanner, +} from '../utils' const PERPAGE = 10 @@ -95,9 +99,7 @@ const ServiceSearch: Screen = ({ const institutionSlugBelongsToMannaudstorg = institutionSlug.includes('mannaudstorg') - const institutionSlugBelongsToTryggingastofnun = - institutionSlug.includes('tryggingastofnun') || - institutionSlug.includes('social-insurance-administration') + const showContactBanner = shouldShowInstitutionContactBanner(institutionSlug) const searchResultsItems = (searchResults.items as Array) .filter( @@ -335,7 +337,7 @@ const ServiceSearch: Screen = ({ )} - {!institutionSlugBelongsToTryggingastofnun && ( + {showContactBanner && ( { [index: string]: T @@ -105,9 +105,7 @@ const SubPage: Screen = ({ const institutionSlugBelongsToMannaudstorg = institutionSlug.includes('mannaudstorg') - const institutionSlugBelongsToTryggingastofnun = - institutionSlug.includes('tryggingastofnun') || - institutionSlug.includes('social-insurance-administration') + const showContactBanner = shouldShowInstitutionContactBanner(institutionSlug) // Already filtered by category, simply const categoryDescription = supportQNAs[0]?.category?.description ?? '' @@ -394,7 +392,7 @@ const SubPage: Screen = ({ - {!institutionSlugBelongsToTryggingastofnun && ( + {showContactBanner && ( { + return ( + institutionSlug && + !institutionSlug.includes('tryggingastofnun') && + !institutionSlug.includes('social-insurance-administration') && + !institutionSlug.includes('stafraent-island') && + !institutionSlug.includes('digital-iceland') + ) +} From 3f3cfe5d5f4056373f1ba54a99b021b31c3b2cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Sat, 4 Jan 2025 06:31:20 +0000 Subject: [PATCH 19/25] fix(web): Organization parent subpage - Double footer (#17365) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/screens/Organization/ParentSubpage.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/web/screens/Organization/ParentSubpage.tsx b/apps/web/screens/Organization/ParentSubpage.tsx index 3ae364be44fb..ca63c7f97f55 100644 --- a/apps/web/screens/Organization/ParentSubpage.tsx +++ b/apps/web/screens/Organization/ParentSubpage.tsx @@ -9,7 +9,7 @@ import { TableOfContents, Text, } from '@island.is/island-ui/core' -import { OrganizationWrapper } from '@island.is/web/components' +import { getThemeConfig, OrganizationWrapper } from '@island.is/web/components' import { Query } from '@island.is/web/graphql/schema' import { useLinkResolver, useNamespace } from '@island.is/web/hooks' import useContentfulId from '@island.is/web/hooks/useContentfulId' @@ -118,6 +118,15 @@ const OrganizationParentSubpage: Screen< ) } -OrganizationParentSubpage.getProps = getProps +OrganizationParentSubpage.getProps = async (context) => { + const props = await getProps(context) + return { + ...props, + ...getThemeConfig( + props.organizationPage.theme, + props.organizationPage.organization, + ), + } +} export default withMainLayout(OrganizationParentSubpage) From 1f091a00c95c4f43d31d64cff9082b64433fe0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Sat, 4 Jan 2025 06:41:45 +0000 Subject: [PATCH 20/25] fix(web): Organization parent subpage - Link highlighting in sidebar (#17367) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../screens/Organization/ParentSubpage.tsx | 2 +- apps/web/screens/Organization/SubPage.tsx | 49 +++++++++++++------ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/apps/web/screens/Organization/ParentSubpage.tsx b/apps/web/screens/Organization/ParentSubpage.tsx index ca63c7f97f55..e49946141a26 100644 --- a/apps/web/screens/Organization/ParentSubpage.tsx +++ b/apps/web/screens/Organization/ParentSubpage.tsx @@ -68,7 +68,7 @@ const OrganizationParentSubpage: Screen< ]} navigationData={{ title: n('navigationTitle', 'Efnisyfirlit'), - items: getSubpageNavList(organizationPage, router), + items: getSubpageNavList(organizationPage, router, 3), }} > diff --git a/apps/web/screens/Organization/SubPage.tsx b/apps/web/screens/Organization/SubPage.tsx index dd2850892088..1365e372dd61 100644 --- a/apps/web/screens/Organization/SubPage.tsx +++ b/apps/web/screens/Organization/SubPage.tsx @@ -215,25 +215,46 @@ export const SubPageContent = ({ ) } +const generateNavigationItems = ( + organizationPage: OrganizationPage | null | undefined, + pathname: string, +): NavigationItem[] => { + const links = (organizationPage?.menuLinks ?? []).map( + ({ primaryLink, childrenLinks }) => ({ + title: primaryLink?.text ?? '', + href: primaryLink?.url, + active: + primaryLink?.url === pathname || + childrenLinks.some((link) => link.url === pathname), + items: childrenLinks.map(({ text, url }) => ({ + title: text, + href: url, + active: url === pathname, + })), + }), + ) + return links +} + export const getSubpageNavList = ( organizationPage: OrganizationPage | null | undefined, router: NextRouter, + depthOfMatch: number | null = null, ): NavigationItem[] => { const pathname = new URL(router.asPath, 'https://island.is').pathname - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore make web strict - return organizationPage?.menuLinks.map(({ primaryLink, childrenLinks }) => ({ - title: primaryLink?.text, - href: primaryLink?.url, - active: - primaryLink?.url === pathname || - childrenLinks.some((link) => link.url === pathname), - items: childrenLinks.map(({ text, url }) => ({ - title: text, - href: url, - active: url === pathname, - })), - })) + if (!depthOfMatch) { + return generateNavigationItems(organizationPage, pathname) + } + + const items = generateNavigationItems( + organizationPage, + pathname + .split('/') + .slice(0, depthOfMatch + 1) // Add one to account for the starting '/' + .join('/'), + ) + + return items } type SubPageScreenContext = ScreenContext & { From 9f4dbf0e6ffd893bead0997a799a0a4b581585ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Sat, 4 Jan 2025 06:53:17 +0000 Subject: [PATCH 21/25] fix(contentful-apps): Handle org subpage and parent subpage preview link routing (#17369) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../pages/sidebars/preview-link.tsx | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/apps/contentful-apps/pages/sidebars/preview-link.tsx b/apps/contentful-apps/pages/sidebars/preview-link.tsx index df1a1c8c6333..b6ef9d0c3cf2 100644 --- a/apps/contentful-apps/pages/sidebars/preview-link.tsx +++ b/apps/contentful-apps/pages/sidebars/preview-link.tsx @@ -3,6 +3,7 @@ import { EntryProps, KeyValueMap } from 'contentful-management' import { CMAClient, SidebarExtensionSDK } from '@contentful/app-sdk' import { Button, Text } from '@contentful/f36-components' import { useCMA, useSDK } from '@contentful/react-apps-toolkit' + import { CONTENTFUL_ENVIRONMENT, CONTENTFUL_SPACE, @@ -40,12 +41,30 @@ const previewLinkHandler = { ) => { const organizationPageId = entry.fields.organizationPage?.[DEFAULT_LOCALE]?.sys?.id - const organizationPage = await cma.entry.get({ - entryId: organizationPageId, - environmentId: CONTENTFUL_ENVIRONMENT, - spaceId: CONTENTFUL_SPACE, - }) - return `${DEV_WEB_BASE_URL}/s/${organizationPage?.fields?.slug?.[DEFAULT_LOCALE]}/${entry.fields.slug[DEFAULT_LOCALE]}` + const [organizationPage, organizationParentSubpageResponse] = + await Promise.all([ + cma.entry.get({ + entryId: organizationPageId, + environmentId: CONTENTFUL_ENVIRONMENT, + spaceId: CONTENTFUL_SPACE, + }), + cma.entry.getMany({ + query: { + content_type: 'organizationParentSubpage', + include: 1, + links_to_entry: entry.sys.id, + 'sys.archivedAt[exists]': false, + }, + }), + ]) + + const orgPageSlug = organizationPage?.fields?.slug?.[DEFAULT_LOCALE] + const slug = entry.fields.slug[DEFAULT_LOCALE] + + if (!organizationParentSubpageResponse?.items?.length) { + return `${DEV_WEB_BASE_URL}/s/${orgPageSlug}/${slug}` + } + return `${DEV_WEB_BASE_URL}/s/${orgPageSlug}/${organizationParentSubpageResponse.items[0].fields.slug[DEFAULT_LOCALE]}/${slug}` }, anchorPage: (entry: EntryProps) => { const middlePart = @@ -64,6 +83,21 @@ const previewLinkHandler = { manual: (entry: EntryProps) => { return `${DEV_WEB_BASE_URL}/handbaekur/${entry.fields.slug[DEFAULT_LOCALE]}` }, + organizationParentSubpage: async ( + entry: EntryProps, + cma: CMAClient, + ) => { + const organizationPageId = + entry.fields.organizationPage?.[DEFAULT_LOCALE]?.sys?.id + const organizationPage = await cma.entry.get({ + entryId: organizationPageId, + environmentId: CONTENTFUL_ENVIRONMENT, + spaceId: CONTENTFUL_SPACE, + }) + const orgPageSlug = organizationPage?.fields?.slug?.[DEFAULT_LOCALE] + + return `${DEV_WEB_BASE_URL}/s/${orgPageSlug}/${entry.fields.slug[DEFAULT_LOCALE]}` + }, } const PreviewLinkSidebar = () => { From 9e9b475d2ab79449bc1119e73ffc83a463d60cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Bjarni=20=C3=93lafsson?= <92530555+jonbjarnio@users.noreply.github.com> Date: Sat, 4 Jan 2025 07:06:07 +0000 Subject: [PATCH 22/25] fix(ojoi): Updated type selector and submitted screen (#17398) * Updated data schema to make less api calls, fixed bug when user selected a previous advert the inputs fields were not updating. Switched out controller components since we have our own. * Revert "Updated data schema to make less api calls, fixed bug when user selected a previous advert the inputs fields were not updating. Switched out controller components since we have our own." This reverts commit 081223e2598294e838d230e8829010af4c791e52. * Fixed the advert main type functionality and updated the submitted screen --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../components/input/OJOISelectController.tsx | 7 +- .../src/fields/Advert.tsx | 12 +-- .../src/fields/Submitted.tsx | 85 +++++++++++-------- .../src/lib/messages/submitted.tsx | 20 +++++ 4 files changed, 83 insertions(+), 41 deletions(-) diff --git a/libs/application/templates/official-journal-of-iceland/src/components/input/OJOISelectController.tsx b/libs/application/templates/official-journal-of-iceland/src/components/input/OJOISelectController.tsx index 799ed40704d8..8891499b716b 100644 --- a/libs/application/templates/official-journal-of-iceland/src/components/input/OJOISelectController.tsx +++ b/libs/application/templates/official-journal-of-iceland/src/components/input/OJOISelectController.tsx @@ -20,6 +20,7 @@ type SelectOption = { } type Props = { + controller?: boolean name: string label: string | MessageDescriptor placeholder: string | MessageDescriptor @@ -34,6 +35,7 @@ type Props = { } export const OJOISelectController = ({ + controller = true, name, label, placeholder, @@ -101,7 +103,10 @@ export const OJOISelectController = ({ defaultValue={defaultOpt} onChange={(opt) => { if (!opt?.value) return - return handleChange(opt.value) + if (controller) { + return handleChange(opt.value) + } + onChange && onChange(opt.value) }} /> )} diff --git a/libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx b/libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx index fcaa5cfdb6fc..2eb069c897d9 100644 --- a/libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx +++ b/libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx @@ -85,6 +85,7 @@ export const Advert = ({ application }: OJOIFieldBaseProps) => { /> { loading={mainTypeLoading} options={mainTypeOptions} onBeforeChange={(answers, value) => { - if (value.types.length === 1) { - const cleaned = cleanTypename(value.types[0]) - set(answers, InputFields.advert.type, cleaned) - } else { - set(answers, InputFields.advert.type, null) - } + const typeValue = + value.types.length === 1 ? cleanTypename(value.types[0]) : null + set(answers, InputFields.advert.type, typeValue) + setValue(InputFields.advert.type, typeValue) }} /> @@ -136,6 +135,7 @@ export const Advert = ({ application }: OJOIFieldBaseProps) => { { applicationId: props.application.id, }) - const { caseData, loading } = useApplicationCase({ + const { + caseData, + loading, + error: caseError, + } = useApplicationCase({ applicationId: props.application.id, }) @@ -98,43 +104,54 @@ export const Submitted = (props: OJOIFieldBaseProps) => { repeat={1} height={OJOI_INPUT_HEIGHT / 2} /> + ) : caseError ? ( + + + + + + ) : ( - - - {caseData?.status} - - - {caseData?.department} - - - {caseData?.type} - - {caseData?.categories?.map((category, i) => ( - - {category} + + + + {caseData?.status} - ))} - + + {caseData?.department} + + + {caseData?.type} + + {caseData?.categories?.map((category, i) => ( + + {category} + + ))} + + + + + )} - {loading ? ( - - ) : ( - - - - )}