diff --git a/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCard.tsx b/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCard.tsx index 10b9a8959e02..fe375bbe25fa 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCard.tsx +++ b/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCard.tsx @@ -59,9 +59,15 @@ export const OJOIAdvertCard = ({ {title} )} - + {categories && categories.length && ( - + {categories.map((cat) => { return ( diff --git a/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx b/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx new file mode 100644 index 000000000000..6d1992a3ac6d --- /dev/null +++ b/apps/web/components/OfficialJournalOfIceland/OJOIAdvertCards.tsx @@ -0,0 +1,30 @@ +import { OfficialJournalOfIcelandAdvertsResponse } from '@island.is/api/schema' +import { Stack } from '@island.is/island-ui/core' +import { Locale } from '@island.is/shared/types' +import { linkResolver } from '@island.is/web/hooks' + +import { OJOIAdvertCard } from './OJOIAdvertCard' + +type Props = { + adverts?: OfficialJournalOfIcelandAdvertsResponse['adverts'] + locale: Locale +} + +export const OJOIAdvertCards = ({ adverts, locale }: Props) => { + return ( + + {adverts?.map((ad) => ( + cat.title)} + link={linkResolver('ojoiadvert', [ad.id], locale).href} + /> + ))} + + ) +} diff --git a/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx b/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx index 8cbcf8420a1e..8c850f198515 100644 --- a/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx +++ b/apps/web/components/OfficialJournalOfIceland/OJOISearchListView.tsx @@ -10,7 +10,7 @@ export const OJOISearchListView = ({ adverts, locale, }: { - adverts: OfficialJournalOfIcelandAdvertsResponse['adverts'] + adverts?: OfficialJournalOfIcelandAdvertsResponse['adverts'] locale: Locale }) => { const { linkResolver } = useLinkResolver() @@ -27,7 +27,7 @@ export const OJOISearchListView = ({ - {adverts.map((ad) => ( + {adverts?.map((ad) => ( diff --git a/apps/web/components/OfficialJournalOfIceland/index.ts b/apps/web/components/OfficialJournalOfIceland/index.ts index a158dddec859..086db5cea94b 100644 --- a/apps/web/components/OfficialJournalOfIceland/index.ts +++ b/apps/web/components/OfficialJournalOfIceland/index.ts @@ -4,4 +4,5 @@ export { OJOIAdvertDisplay } from './OJOIAdvertDisplay' export { OJOIAdvertCard } from './OJOIAdvertCard' export { OJOISearchListView } from './OJOISearchListView' export { OJOISearchGridView } from './OJOISearchGridView' +export { OJOIAdvertCards } from './OJOIAdvertCards' export * from './OJOIUtils' diff --git a/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx b/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx index bce39b678cce..83418431d798 100644 --- a/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx +++ b/apps/web/screens/OfficialJournalOfIceland/OJOIHome.tsx @@ -1,7 +1,9 @@ import { useIntl } from 'react-intl' import NextLink from 'next/link' +import { useQuery } from '@apollo/client' import { + AlertMessage, ArrowLink, Box, Breadcrumbs, @@ -9,6 +11,7 @@ import { GridColumn, GridContainer, GridRow, + SkeletonLoader, Stack, Text, } from '@island.is/island-ui/core' @@ -18,8 +21,10 @@ import { ContentLanguage, CustomPageUniqueIdentifier, OfficialJournalOfIcelandAdvertMainCategory, + OfficialJournalOfIcelandAdvertsResponse, Query, QueryGetOrganizationArgs, + QueryOfficialJournalOfIcelandAdvertsArgs, QueryOfficialJournalOfIcelandMainCategoriesArgs, } from '@island.is/web/graphql/schema' import { useLinkResolver } from '@island.is/web/hooks' @@ -27,7 +32,10 @@ import { withMainLayout } from '@island.is/web/layouts/main' import { CustomNextError } from '@island.is/web/units/errors' import { + OJOIAdvertCard, + OJOIAdvertCards, OJOIHomeIntro, + OJOISearchListView, OJOIWrapper, } from '../../components/OfficialJournalOfIceland' import { @@ -35,7 +43,10 @@ import { withCustomPageWrapper, } from '../CustomPage/CustomPageWrapper' import { GET_ORGANIZATION_QUERY } from '../queries' -import { MAIN_CATEGORIES_QUERY } from '../queries/OfficialJournalOfIceland' +import { + ADVERTS_QUERY, + MAIN_CATEGORIES_QUERY, +} from '../queries/OfficialJournalOfIceland' import { m } from './messages' const OJOIHomePage: CustomScreen = ({ @@ -61,6 +72,23 @@ const OJOIHomePage: CustomScreen = ({ }, ] + const { data, loading, error } = useQuery< + { + officialJournalOfIcelandAdverts: OfficialJournalOfIcelandAdvertsResponse + }, + QueryOfficialJournalOfIcelandAdvertsArgs + >(ADVERTS_QUERY, { + variables: { + input: { + page: 1, + pageSize: 5, + }, + }, + fetchPolicy: 'no-cache', + }) + + const adverts = data?.officialJournalOfIcelandAdverts.adverts + return ( = ({ - - {formatMessage(m.home.mainCategories)} - - {formatMessage(m.home.allCategories)} - - + + + + + {formatMessage(m.home.mainCategories)} + + + {formatMessage(m.home.allCategories)} + + + + + + + + + {formatMessage(m.home.latestAdverts)} + + + + {loading && } + {error && ( + + )} + {!error && !adverts?.length && ( + + )} + + {adverts && ( + + )} + + + {mainCategories?.map((y, i) => ( diff --git a/apps/web/screens/OfficialJournalOfIceland/messages.ts b/apps/web/screens/OfficialJournalOfIceland/messages.ts index 7e668a87a12b..079b2ea3edf5 100644 --- a/apps/web/screens/OfficialJournalOfIceland/messages.ts +++ b/apps/web/screens/OfficialJournalOfIceland/messages.ts @@ -35,6 +35,10 @@ export const m = { id: 'web.ojoi:home.mainCategories', defaultMessage: 'Yfirflokkar', }, + latestAdverts: { + id: 'web.ojoi:home.latestAdverts', + defaultMessage: 'Nýjustu auglýsingar', + }, allCategories: { id: 'web.ojoi:home.allCategories', defaultMessage: 'Málaflokkar A-Ö', @@ -42,6 +46,19 @@ export const m = { }), search: defineMessages({ + emptySearchResult: { + id: 'web.ojoi:search.emptySearchResult', + defaultMessage: 'Engin mál fundust', + }, + errorFetchingAdvertsTitle: { + id: 'web.ojoi:search.errorFetchingAdvertsTitle', + defaultMessage: 'Ekki tókst að sækja auglýsingar', + }, + errorFetchingAdvertsMessage: { + id: 'web.ojoi:search.errorFetchingAdvertsMessage', + defaultMessage: + 'Ekki náðist samband við vefþjónustur Stjórnartíðinda, reynið aftur síðar.', + }, title: { id: 'web.ojoi:search.title', defaultMessage: 'Leit í Stjórnartíðindum', diff --git a/libs/application/templates/official-journal-of-iceland/src/components/signatures/Chairman.tsx b/libs/application/templates/official-journal-of-iceland/src/components/signatures/Chairman.tsx index 3b0362ccb297..59e37bb1ccc4 100644 --- a/libs/application/templates/official-journal-of-iceland/src/components/signatures/Chairman.tsx +++ b/libs/application/templates/official-journal-of-iceland/src/components/signatures/Chairman.tsx @@ -90,24 +90,24 @@ export const Chairman = ({ applicationId, member }: Props) => { } /> debouncedOnUpdateApplicationHandler( - handleChairmanChange(e.target.value, 'after'), + handleChairmanChange(e.target.value, 'name'), ) } /> debouncedOnUpdateApplicationHandler( - handleChairmanChange(e.target.value, 'name'), + handleChairmanChange(e.target.value, 'after'), ) } /> diff --git a/libs/application/templates/official-journal-of-iceland/src/components/signatures/RegularMember.tsx b/libs/application/templates/official-journal-of-iceland/src/components/signatures/RegularMember.tsx index 443bdb010e7d..7c0d826f0cfe 100644 --- a/libs/application/templates/official-journal-of-iceland/src/components/signatures/RegularMember.tsx +++ b/libs/application/templates/official-journal-of-iceland/src/components/signatures/RegularMember.tsx @@ -118,14 +118,14 @@ export const RegularMember = ({ } /> debouncedOnUpdateApplicationHandler( handleMemberChange( e.target.value, - 'after', + 'name', signatureIndex, memberIndex, ), @@ -135,14 +135,14 @@ export const RegularMember = ({ debouncedOnUpdateApplicationHandler( handleMemberChange( e.target.value, - 'name', + 'after', signatureIndex, memberIndex, ), diff --git a/libs/application/templates/official-journal-of-iceland/src/lib/constants.ts b/libs/application/templates/official-journal-of-iceland/src/lib/constants.ts index a5710590e5ce..785f7f5d4240 100644 --- a/libs/application/templates/official-journal-of-iceland/src/lib/constants.ts +++ b/libs/application/templates/official-journal-of-iceland/src/lib/constants.ts @@ -4,6 +4,8 @@ export const ALLOWED_FILE_TYPES = ['.pdf', '.doc', '.docx'] export const FILE_SIZE_LIMIT = 10000000 +export const OJOI_DF = 'd. MMMM yyyy.' + export const VERDSKRA_LINK = 'https://www.stjornartidindi.is/PdfVersions.aspx?recordId=0f574646-eb9d-430b-bbe7-936e7c9389a0' diff --git a/libs/application/templates/official-journal-of-iceland/src/lib/messages/attachments.ts b/libs/application/templates/official-journal-of-iceland/src/lib/messages/attachments.ts index 36d271b576d4..1e61ad4fb28f 100644 --- a/libs/application/templates/official-journal-of-iceland/src/lib/messages/attachments.ts +++ b/libs/application/templates/official-journal-of-iceland/src/lib/messages/attachments.ts @@ -4,7 +4,7 @@ export const attachments = { general: defineMessages({ title: { id: 'ojoi.application:attachments.general.title', - defaultMessage: 'Viðaukar og fylgirit', + defaultMessage: 'Viðaukar og fylgiskjöl', description: 'Title of the addition and documents form', }, intro: { @@ -15,7 +15,7 @@ export const attachments = { }, section: { id: 'ojoi.application:attachments.general.section', - defaultMessage: 'Viðaukar og fylgirit', + defaultMessage: 'Viðaukar og fylgiskjöl', description: 'Title of the addition and documents section', }, }), @@ -55,7 +55,7 @@ export const attachments = { documents: defineMessages({ label: { id: 'ojoi.application:attachments.radio.documents.label', - defaultMessage: 'Fylgirit (I, II, III..)', + defaultMessage: 'Fylgiskjöl (I, II, III..)', description: 'Label of the documents radio button', }, }), diff --git a/libs/application/templates/official-journal-of-iceland/src/lib/messages/publishing.ts b/libs/application/templates/official-journal-of-iceland/src/lib/messages/publishing.ts index 5e4ccbb90bc1..d1dd45f20544 100644 --- a/libs/application/templates/official-journal-of-iceland/src/lib/messages/publishing.ts +++ b/libs/application/templates/official-journal-of-iceland/src/lib/messages/publishing.ts @@ -21,7 +21,7 @@ export const publishing = { communicationIntro: { id: 'ojoi.application:publishing.general.communicationIntro', defaultMessage: - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sit amet mattis erat, eget dignissim lacus. Cras id enim ac urna bibendum gravida.', + 'Hér getur þú skráð inn tölvupóstfang og/eða símanúmer þess sem best er að hafa samskipti við vegna málsins, hægt að skrá fleiri en einn.', description: 'Intro of the communication section', }, }), diff --git a/libs/application/templates/official-journal-of-iceland/src/lib/utils.ts b/libs/application/templates/official-journal-of-iceland/src/lib/utils.ts index 976a51e21517..01104ff2486c 100644 --- a/libs/application/templates/official-journal-of-iceland/src/lib/utils.ts +++ b/libs/application/templates/official-journal-of-iceland/src/lib/utils.ts @@ -13,7 +13,7 @@ import { InputFields, OJOIApplication, RequiredInputFieldsNames } from './types' import { HTMLText } from '@island.is/regulations-tools/types' import format from 'date-fns/format' import is from 'date-fns/locale/is' -import { SignatureTypes } from './constants' +import { SignatureTypes, OJOI_DF } from './constants' import { MessageDescriptor } from 'react-intl' export const countDaysAgo = (date: Date) => { @@ -211,7 +211,7 @@ const signatureTemplate = ( } const date = signature.date - ? format(new Date(signature.date), 'dd. MMM yyyy.', { locale: is }) + ? format(new Date(signature.date), OJOI_DF, { locale: is }) : '' const chairmanMarkup = chairman