From 618ba08e25f0b9337748d8708549d18a11ef1532 Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Mon, 15 Jan 2024 12:34:17 +0200 Subject: [PATCH 1/3] feat(apps): add localized providerContactInfo field to event details HH-337 --- .../src/components/domain/event/query.ts | 3 ++ .../src/types/generated/graphql.tsx | 29 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/components/src/components/domain/event/query.ts b/packages/components/src/components/domain/event/query.ts index 1801cb930..6a0acec56 100644 --- a/packages/components/src/components/domain/event/query.ts +++ b/packages/components/src/components/domain/event/query.ts @@ -72,6 +72,9 @@ export const QUERY_EVENT_DETAILS = gql` provider { ...localizedFields } + providerContactInfo { + ...localizedFields + } infoUrl { ...localizedFields } diff --git a/packages/components/src/types/generated/graphql.tsx b/packages/components/src/types/generated/graphql.tsx index 010f58c8f..a370e294a 100644 --- a/packages/components/src/types/generated/graphql.tsx +++ b/packages/components/src/types/generated/graphql.tsx @@ -2907,7 +2907,7 @@ export type EventDetails = { name: LocalizedObject; offers: Array; provider?: Maybe; - providerContactInfo?: Maybe; + providerContactInfo?: Maybe; publisher?: Maybe; remainingAttendeeCapacity?: Maybe; shortDescription?: Maybe; @@ -12625,6 +12625,12 @@ export type EventFieldsFragment = { fi?: string | null; sv?: string | null; } | null; + providerContactInfo?: { + __typename?: 'LocalizedObject'; + en?: string | null; + fi?: string | null; + sv?: string | null; + } | null; infoUrl?: { __typename?: 'LocalizedObject'; en?: string | null; @@ -12812,6 +12818,12 @@ export type EventDetailsQuery = { fi?: string | null; sv?: string | null; } | null; + providerContactInfo?: { + __typename?: 'LocalizedObject'; + en?: string | null; + fi?: string | null; + sv?: string | null; + } | null; infoUrl?: { __typename?: 'LocalizedObject'; en?: string | null; @@ -13079,6 +13091,12 @@ export type EventListQuery = { fi?: string | null; sv?: string | null; } | null; + providerContactInfo?: { + __typename?: 'LocalizedObject'; + en?: string | null; + fi?: string | null; + sv?: string | null; + } | null; infoUrl?: { __typename?: 'LocalizedObject'; en?: string | null; @@ -13278,6 +13296,12 @@ export type EventsByIdsQuery = { fi?: string | null; sv?: string | null; } | null; + providerContactInfo?: { + __typename?: 'LocalizedObject'; + en?: string | null; + fi?: string | null; + sv?: string | null; + } | null; infoUrl?: { __typename?: 'LocalizedObject'; en?: string | null; @@ -14251,6 +14275,9 @@ export const EventFieldsFragmentDoc = gql` provider { ...localizedFields } + providerContactInfo { + ...localizedFields + } infoUrl { ...localizedFields } From 597316da0d18e65b529edc1c01952d961ed9e920 Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Mon, 15 Jan 2024 12:35:40 +0200 Subject: [PATCH 2/3] feat(apps): replace the location phone and email from event info with provider contact info HH-337 --- .../domain/event/eventInfo/EventInfo.tsx | 19 +++---------------- packages/components/src/utils/eventUtils.ts | 1 + 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx b/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx index 0702801cc..7442fa38a 100644 --- a/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx +++ b/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx @@ -14,7 +14,7 @@ import type { EventAttributes } from 'ics'; import { createEvent } from 'ics'; import { useTranslation } from 'next-i18next'; import React from 'react'; -import { Link, SecondaryLink } from 'react-helsinki-headless-cms'; +import { SecondaryLink } from 'react-helsinki-headless-cms'; import IconDirections from '../../../../assets/icons/IconDirections'; import InfoWithIcon from '../../../../components/infoWithIcon/InfoWithIcon'; @@ -249,7 +249,7 @@ const OtherInfo: React.FC<{ const { t } = useTranslation('event'); const locale = useLocale(); - const { email, externalLinks, infoUrl, telephone, registrationUrl } = + const { externalLinks, infoUrl, registrationUrl, providerContactInfo } = getEventFields(event, locale); return ( @@ -257,20 +257,7 @@ const OtherInfo: React.FC<{ icon={} title={t('info.labelOtherInfo')} > - {email && ( -
- - {email} - -
- )} - {telephone && ( -
- - {telephone} - -
- )} + {providerContactInfo &&
{providerContactInfo}
} {infoUrl && ( { remainingAttendeeCapacity: event.remainingAttendeeCapacity, enrolmentStartTime: event.enrolmentStartTime, enrolmentEndTime: event.enrolmentEndTime, + providerContactInfo: getLocalizedString(event.providerContactInfo, locale), }; }; From 2c4954e8a91cbe7ccff159ed3d0e4886dc3cfd24 Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Mon, 15 Jan 2024 15:42:33 +0200 Subject: [PATCH 3/3] refactor: links in the other info section HH-337 --- .../src/components/domain/event/eventInfo/EventInfo.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx b/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx index 7442fa38a..eed98f2a4 100644 --- a/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx +++ b/packages/components/src/components/domain/event/eventInfo/EventInfo.tsx @@ -276,13 +276,14 @@ const OtherInfo: React.FC<{ ) => { return ( !!externalLink.link && + !!externalLink.name && externalLink.link !== registrationUrl && ( - {translateValue('info.', externalLink.name as string, t)} + {translateValue('info.', externalLink.name, t)} ) );