diff --git a/apps/web/components/OfficialJournalOfIceland/OJOIHomeIntro.tsx b/apps/web/components/OfficialJournalOfIceland/OJOIHomeIntro.tsx index 2a1ac7bdffb46..a6bb2a4199497 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOIHomeIntro.tsx +++ b/apps/web/components/OfficialJournalOfIceland/OJOIHomeIntro.tsx @@ -1,5 +1,3 @@ -import { ReactNode } from 'react' - import { Box, GridColumn, @@ -17,7 +15,7 @@ import * as s from './OJOIHomeIntro.css' export type OJOIHomeIntroProps = { organization?: Organization - breadCrumbs: ReactNode + breadCrumbs: React.ReactNode searchPlaceholder: string quickLinks: Array<{ title: string; href: string; variant?: TagVariant }> searchUrl: string diff --git a/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx b/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx index 8c850f1985155..2f4e0d1dd2db4 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx +++ b/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx @@ -1,11 +1,10 @@ -import format from 'date-fns/format' -import is from 'date-fns/locale/is' - import { LinkV2, Table as T, Text } from '@island.is/island-ui/core' import { Locale } from '@island.is/shared/types' import { OfficialJournalOfIcelandAdvertsResponse } from '@island.is/web/graphql/schema' import { useLinkResolver } from '@island.is/web/hooks' +import { formatDate } from './OJOIUtils' + export const OJOISearchListView = ({ adverts, locale, @@ -31,9 +30,7 @@ export const OJOISearchListView = ({ - {format(new Date(ad.publicationDate), 'dd.MM.yyyy', { - locale: is, - })} + {formatDate(ad.publicationDate)} diff --git a/apps/web/components/OfficialJournalOfIceland/OJOIUtils.ts b/apps/web/components/OfficialJournalOfIceland/OJOIUtils.ts index e731a8059ea32..253bf509e4b05 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOIUtils.ts +++ b/apps/web/components/OfficialJournalOfIceland/OJOIUtils.ts @@ -81,7 +81,10 @@ export const sortCategories = (cats: EntityOption[]) => { }) } -export const formatDate = (date: string, df = 'dd.MM.yyyy') => { +export const formatDate = (date?: string, df = 'dd.MM.yyyy') => { + if (!date) { + return '-' + } try { return format(new Date(date), df, { locale: is }) } catch (e) { diff --git a/apps/web/components/OfficialJournalOfIceland/OJOIWrapper.tsx b/apps/web/components/OfficialJournalOfIceland/OJOIWrapper.tsx index 3c4a0918b5009..274f25b1a5fbb 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOIWrapper.tsx +++ b/apps/web/components/OfficialJournalOfIceland/OJOIWrapper.tsx @@ -7,6 +7,9 @@ import { BreadCrumbItem, Breadcrumbs, Button, + GridColumn, + GridContainer, + GridRow, LinkV2, Text, } from '@island.is/island-ui/core' @@ -28,6 +31,7 @@ type WrapperProps = { sidebarContent?: ReactNode goBackUrl?: string hideTitle?: boolean + isHomePage?: boolean } export const OJOIWrapper = ({ @@ -40,6 +44,7 @@ export const OJOIWrapper = ({ sidebarContent, goBackUrl, hideTitle, + isHomePage, }: WrapperProps) => { const { width } = useWindowSize() const [isMobile, setIsMobile] = useState() @@ -133,7 +138,46 @@ export const OJOIWrapper = ({ )} - {!sidebarContent && children} + {!sidebarContent && !isHomePage && ( + + + + {breadcrumbItems && ( + { + return item?.href ? ( + + {link} + + ) : ( + link + ) + }} + /> + )} + + {!hideTitle && ( + + {pageTitle} + + )} + + {pageDescription && ( + + {pageDescription} + + )} + + + {children} + + + + + )} + + {!sidebarContent && isHomePage && children} = ({ const breadcrumbItems = [ { - title: 'Ísland.is', + title: formatMessage(m.breadcrumb.frontpage), href: linkResolver('homepage', [], locale).href, }, { diff --git a/apps/web/screens/OfficialJournalOfIceland/OJOICasesInProgress.tsx b/apps/web/screens/OfficialJournalOfIceland/OJOICasesInProgress.tsx new file mode 100644 index 0000000000000..f61759c85eb78 --- /dev/null +++ b/apps/web/screens/OfficialJournalOfIceland/OJOICasesInProgress.tsx @@ -0,0 +1,174 @@ +import { useIntl } from 'react-intl' + +import { Table as T } from '@island.is/island-ui/core' +import { Locale } from '@island.is/shared/types' +import { + ContentLanguage, + CustomPageUniqueIdentifier, + OfficialJournalOfIcelandCaseInProgress, + Query, + QueryGetOrganizationArgs, + QueryOfficialJournalOfIcelandCasesInProgressArgs, +} from '@island.is/web/graphql/schema' +import { useLinkResolver } from '@island.is/web/hooks' +import { withMainLayout } from '@island.is/web/layouts/main' +import { CustomNextError } from '@island.is/web/units/errors' + +import { + formatDate, + OJOIWrapper, +} from '../../components/OfficialJournalOfIceland' +import { + CustomScreen, + withCustomPageWrapper, +} from '../CustomPage/CustomPageWrapper' +import { GET_ORGANIZATION_QUERY } from '../queries' +import { CASES_IN_PROGRESS_QUERY } from '../queries/OfficialJournalOfIceland' +import { m } from './messages' + +const OJOICasesInProgressPage: CustomScreen = ({ + cases, + organization, + locale, +}) => { + const { formatMessage } = useIntl() + const { linkResolver } = useLinkResolver() + + const baseUrl = linkResolver('ojoihome', [], locale).href + + const breadcrumbItems = [ + { + title: formatMessage(m.breadcrumb.frontpage), + href: linkResolver('homepage', [], locale).href, + }, + { + title: organization?.title ?? '', + href: baseUrl, + }, + { + title: formatMessage(m.casesInProgress.title), + }, + ] + + return ( + + {!cases || cases.length === 0 ? ( +

{formatMessage(m.casesInProgress.notFoundMessage)}

+ ) : ( + + + + + {formatMessage(m.casesInProgress.createdAt)} + + + {formatMessage(m.casesInProgress.requestedPublicationDate)} + + {formatMessage(m.casesInProgress.status)} + + {formatMessage(m.casesInProgress.advertTitle)} + + + {formatMessage(m.casesInProgress.involvedParty)} + + + + + {cases.map((c) => ( + + {formatDate(c.createdAt ?? '')} + {formatDate(c.requestedPublicationDate ?? '')} + {c.status ?? '-'} + {c.title ?? '-'} + {c.involvedParty ?? '-'} + + ))} + + + )} +
+ ) +} + +interface OJOICasesInProgressProps { + cases?: Array + organization?: Query['getOrganization'] + locale: Locale +} + +const OJOICasesInProgress: CustomScreen = ({ + cases, + organization, + customPageData, + locale, +}) => { + return ( + + ) +} + +OJOICasesInProgress.getProps = async ({ apolloClient, locale }) => { + const organizationSlug = 'stjornartidindi' + + const [ + { + data: { officialJournalOfIcelandCasesInProgress }, + }, + { + data: { getOrganization }, + }, + ] = await Promise.all([ + apolloClient.query( + { + query: CASES_IN_PROGRESS_QUERY, + variables: { + params: { + pageSize: 30, + }, + }, + }, + ), + apolloClient.query({ + query: GET_ORGANIZATION_QUERY, + variables: { + input: { + slug: organizationSlug, + lang: locale as ContentLanguage, + }, + }, + }), + ]) + + if (!getOrganization?.hasALandingPage) { + throw new CustomNextError(404, 'Organization page not found') + } + + return { + cases: officialJournalOfIcelandCasesInProgress?.cases, + organization: getOrganization, + locale: locale as Locale, + showSearchInHeader: false, + themeConfig: { + footerVersion: 'organization', + }, + } +} + +export default withMainLayout( + withCustomPageWrapper( + CustomPageUniqueIdentifier.OfficialJournalOfIceland, + OJOICasesInProgress, + ), +) diff --git a/apps/web/screens/OfficialJournalOfIceland/OJOICategories.tsx b/apps/web/screens/OfficialJournalOfIceland/OJOICategories.tsx index 519fbbc80e873..92dfb3cc75bc3 100644 --- a/apps/web/screens/OfficialJournalOfIceland/OJOICategories.tsx +++ b/apps/web/screens/OfficialJournalOfIceland/OJOICategories.tsx @@ -162,7 +162,7 @@ const OJOICategoriesPage: CustomScreen = ({ const breadcrumbItems = [ { - title: 'Ísland.is', + title: formatMessage(m.breadcrumb.frontpage), href: linkResolver('homepage', [], locale).href, }, { @@ -170,7 +170,7 @@ const OJOICategoriesPage: CustomScreen = ({ href: baseUrl, }, { - title: 'Málaflokkar', + title: formatMessage(m.categories.breadcrumbTitle), }, ] diff --git a/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx b/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx index 6af57b49482b6..834bc15547b19 100644 --- a/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx +++ b/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx @@ -61,7 +61,7 @@ const OJOIHomePage: CustomScreen = ({ const breadcrumbItems = [ { - title: 'Ísland.is', + title: formatMessage(m.breadcrumb.frontpage), href: linkResolver('homepage', [], locale).href, }, { @@ -93,6 +93,7 @@ const OJOIHomePage: CustomScreen = ({ pageDescription={formatMessage(m.home.description)} organization={organization ?? undefined} pageFeaturedImage={formatMessage(m.home.featuredImage)} + isHomePage > = ({ const breadcrumbItems = [ { - title: 'Ísland.is', + title: formatMessage(m.breadcrumb.frontpage), href: linkResolver('homepage', [], locale).href, }, { @@ -240,7 +240,7 @@ const OJOISearchPage: CustomScreen = ({ href: baseUrl, }, { - title: 'Leitarniðurstöður', + title: formatMessage(m.search.breadcrumbTitle), }, ] diff --git a/apps/web/screens/OfficialJournalOfIceland/messages.ts b/apps/web/screens/OfficialJournalOfIceland/messages.ts index 079b2ea3edf5f..cbff4061836b6 100644 --- a/apps/web/screens/OfficialJournalOfIceland/messages.ts +++ b/apps/web/screens/OfficialJournalOfIceland/messages.ts @@ -1,6 +1,12 @@ import { defineMessages } from 'react-intl' export const m = { + breadcrumb: defineMessages({ + frontpage: { + id: 'web.ojoi.breadcrumb.frontpage', + defaultMessage: 'Ísland.is', + }, + }), general: defineMessages({ seeMore: { id: 'web.ojoi:general.seeMore', @@ -59,6 +65,10 @@ export const m = { defaultMessage: 'Ekki náðist samband við vefþjónustur Stjórnartíðinda, reynið aftur síðar.', }, + breadcrumbTitle: { + id: 'web.ojoi:search.breadcrumbTitle', + defaultMessage: 'Leitarniðurstöður', + }, title: { id: 'web.ojoi:search.title', defaultMessage: 'Leit í Stjórnartíðindum', @@ -167,6 +177,10 @@ export const m = { }), categories: defineMessages({ + breadcrumbTitle: { + id: 'web.ojoi:categories.breadcrumbTitle', + defaultMessage: 'Málaflokkar', + }, title: { id: 'web.ojoi:categories.title', defaultMessage: 'Málaflokkar Stjórnartíðinda', @@ -262,4 +276,39 @@ export const m = { defaultMessage: 'Sækja PDF', }, }), + + casesInProgress: defineMessages({ + title: { + id: 'web.ojoi:casesInProgress.title', + defaultMessage: 'Mál í vinnslu', + }, + description: { + id: 'web.ojoi:casesInProgress.description', + defaultMessage: 'Listi yfir mál sem hafa ekki verið gefin út.', + }, + notFoundMessage: { + id: 'web.ojoi:casesInProgress.notFoundMessage', + defaultMessage: 'Engin mál í vinnslu', + }, + createdAt: { + id: 'web.ojoi:casesInProgress.createdAt', + defaultMessage: 'Innsending', + }, + status: { + id: 'web.ojoi:casesInProgress.status', + defaultMessage: 'Staða', + }, + requestedPublicationDate: { + id: 'web.ojoi:casesInProgress.requestedPublicationDate', + defaultMessage: 'Áætl. útgáfud.', + }, + advertTitle: { + id: 'web.ojoi:casesInProgress.advertTitle', + defaultMessage: 'Heiti', + }, + involvedParty: { + id: 'web.ojoi:casesInProgress.involvedParty', + defaultMessage: 'Stofnun', + }, + }), } diff --git a/apps/web/screens/queries/OfficialJournalOfIceland.ts b/apps/web/screens/queries/OfficialJournalOfIceland.ts index 5bdc141332179..0decb8258d4d2 100644 --- a/apps/web/screens/queries/OfficialJournalOfIceland.ts +++ b/apps/web/screens/queries/OfficialJournalOfIceland.ts @@ -188,3 +188,29 @@ export const MAIN_CATEGORIES_QUERY = gql` } } ` + +export const CASES_IN_PROGRESS_QUERY = gql` + query CasesInProgress($params: OfficialJournalOfIcelandQueryInput!) { + officialJournalOfIcelandCasesInProgress(params: $params) { + cases { + id + title + status + involvedParty + createdAt + fastTrack + requestedPublicationDate + } + paging { + page + pageSize + totalPages + totalItems + hasNextPage + hasPreviousPage + nextPage + previousPage + } + } + } +` diff --git a/libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts b/libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts index 14d782567e88e..c00db538679f5 100644 --- a/libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts +++ b/libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts @@ -29,10 +29,10 @@ export class AdvertsInput { involvedParty?: string[] @Field(() => Date, { nullable: true }) - dateFrom?: Date + dateFrom?: string @Field(() => Date, { nullable: true }) - dateTo?: Date + dateTo?: string } @InputType('OfficialJournalOfIcelandTypesInput') diff --git a/libs/api/domains/official-journal-of-iceland/src/lib/models/case.model.ts b/libs/api/domains/official-journal-of-iceland/src/lib/models/case.model.ts new file mode 100644 index 0000000000000..59bcaade3cb69 --- /dev/null +++ b/libs/api/domains/official-journal-of-iceland/src/lib/models/case.model.ts @@ -0,0 +1,25 @@ +import { Field, ID, ObjectType } from '@nestjs/graphql' + +@ObjectType('OfficialJournalOfIcelandCaseInProgress') +export class CaseInProgress { + @Field(() => ID) + id!: string + + @Field(() => String) + title!: string | null + + @Field(() => String) + involvedParty!: string | null + + @Field(() => String) + status!: string | null + + @Field(() => String) + createdAt!: string | null + + @Field(() => String) + requestedPublicationDate!: string | null + + @Field(() => Boolean) + fastTrack!: boolean | null +} diff --git a/libs/api/domains/official-journal-of-iceland/src/lib/models/cases.response.ts b/libs/api/domains/official-journal-of-iceland/src/lib/models/cases.response.ts new file mode 100644 index 0000000000000..5d715b7c2a2ac --- /dev/null +++ b/libs/api/domains/official-journal-of-iceland/src/lib/models/cases.response.ts @@ -0,0 +1,13 @@ +import { Field, ObjectType } from '@nestjs/graphql' + +import { AdvertPaging } from './advert-paging.model' +import { CaseInProgress } from './case.model' + +@ObjectType('OfficialJournalOfIcelandCasesInProgressResponse') +export class CasesInProgressResponse { + @Field(() => [CaseInProgress]) + cases!: CaseInProgress[] + + @Field(() => AdvertPaging) + paging!: AdvertPaging +} diff --git a/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts b/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts index e96092c25c66d..cde591d90f876 100644 --- a/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts +++ b/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts @@ -22,6 +22,7 @@ import { } from './models/advert.response' import { Features } from '@island.is/feature-flags' import { FeatureFlag } from '@island.is/nest/feature-flags' +import { CasesInProgressResponse } from './models/cases.response' @Scopes(ApiScope.internal) @FeatureFlag(Features.officialJournalOfIceland) @@ -91,4 +92,11 @@ export class OfficialJournalOfIcelandResolver { getInstitutions(@Args('params') params: QueryParams) { return this.ojoiService.getInstitutions(params) } + + @Query(() => CasesInProgressResponse, { + name: 'officialJournalOfIcelandCasesInProgress', + }) + getCasesInProgress(@Args('params') params: QueryParams) { + return this.ojoiService.getCasesInProgress(params) + } } diff --git a/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts b/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts index bf825bdc72ebb..954a7ab1d8ad8 100644 --- a/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts +++ b/libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts @@ -1,5 +1,6 @@ import { GetAdvertsRequest, + GetCasesInProgressRequest, OfficialJournalOfIcelandClientService, } from '@island.is/clients/official-journal-of-iceland' import { Injectable } from '@nestjs/common' @@ -17,6 +18,7 @@ import { AdvertsResponse, AdvertTypesResponse, } from './models/advert.response' +import { CasesInProgressResponse } from './models/cases.response' @Injectable() export class OfficialJournalOfIcelandService { @@ -65,4 +67,10 @@ export class OfficialJournalOfIcelandService { async getAdverts(input: GetAdvertsRequest): Promise { return await this.ojoiService.getAdverts(input) } + + async getCasesInProgress( + input: GetCasesInProgressRequest, + ): Promise { + return await this.ojoiService.getCasesInProgress(input) + } } diff --git a/libs/clients/official-journal-of-iceland/public/src/clientConfig.json b/libs/clients/official-journal-of-iceland/public/src/clientConfig.json index d69a08b031b3b..cb9d9592cef7d 100644 --- a/libs/clients/official-journal-of-iceland/public/src/clientConfig.json +++ b/libs/clients/official-journal-of-iceland/public/src/clientConfig.json @@ -82,14 +82,14 @@ "description": "Date from which to filter adverts on, inclusive, takes into account `createdDate`, `updatedDate` and `signatureDate`.", "required": false, "in": "query", - "schema": { "format": "date-time", "type": "string" } + "schema": { "type": "string" } }, { "name": "dateTo", "description": "Date to which to filter adverts on, inclusive, takes into account `createdDate`, `updatedDate` and `signatureDate`.", "required": false, "in": "query", - "schema": { "format": "date-time", "type": "string" } + "schema": { "type": "string" } } ], "responses": { @@ -410,6 +410,46 @@ } } }, + "/api/v1/cases": { + "get": { + "operationId": "getCasesInProgress", + "parameters": [ + { + "name": "search", + "description": "String to search for", + "required": false, + "in": "query", + "schema": { "type": "string" } + }, + { + "name": "page", + "description": "Page number to return.", + "required": false, + "in": "query", + "schema": { "type": "number" } + }, + { + "name": "pageSize", + "description": "Page size number to return.", + "required": false, + "in": "query", + "schema": { "type": "number" } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetCasesInProgressReponse" + } + } + } + } + } + } + }, "/api/v1/error": { "get": { "operationId": "error", @@ -1017,6 +1057,77 @@ }, "required": ["items", "paging"] }, + "CaseInProgress": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "d290f1ee-6c54-4b01-90e6-d701748f0851" + }, + "status": { + "type": "string", + "enum": [ + "Innsent", + "Grunnvinnsla", + "Yfirlestur", + "Tilbúið", + "Útgefið", + "Tekið úr birtingu", + "Birtingu hafnað" + ], + "example": "Innsent", + "description": "Status of the case" + }, + "involvedParty": { + "type": "string", + "description": "Title of the institution", + "example": "Dómsmálaráðuneytið" + }, + "createdAt": { + "type": "string", + "example": "2024-01-01T09:00:00Z", + "description": "Date the case was created. ISO 8601 date and time format in UTC." + }, + "fastTrack": { + "type": "boolean", + "example": false, + "description": "Requested fast track" + }, + "requestedPublicationDate": { + "type": "string", + "example": "2024-01-01T09:00:00Z", + "description": "Requested advert publication date. ISO 8601 date and time format in UTC." + }, + "title": { + "type": "string", + "example": "TITILL á máli", + "description": "Advert title with type" + } + }, + "required": [ + "id", + "status", + "involvedParty", + "createdAt", + "fastTrack", + "requestedPublicationDate", + "title" + ] + }, + "GetCasesInProgressReponse": { + "type": "object", + "properties": { + "cases": { + "type": "array", + "items": { "$ref": "#/components/schemas/CaseInProgress" } + }, + "paging": { + "description": "Paging info", + "allOf": [{ "$ref": "#/components/schemas/Paging" }] + } + }, + "required": ["cases", "paging"] + }, "ValidationResponse": { "type": "object", "properties": { diff --git a/libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts b/libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts index 9e89700364314..1ab4b33951c9f 100644 --- a/libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts +++ b/libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts @@ -10,6 +10,7 @@ import { GetAdvertTypesRequest, GetDepartmentByIdRequest, GetAdvertTypeByIdRequest, + GetCasesInProgressRequest, } from '../../gen/fetch/apis' @Injectable() @@ -51,4 +52,8 @@ export class OfficialJournalOfIcelandClientService { public async getInstitutions(params: GetInstitutionsRequest) { return this.api.getInstitutions(params) } + + public async getCasesInProgress(params: GetCasesInProgressRequest) { + return this.api.getCasesInProgress(params) + } }