diff --git a/src/lib/utils/breadcrumbs.ts b/src/lib/utils/breadcrumbs.ts index 1afac72f3..b226b1e99 100644 --- a/src/lib/utils/breadcrumbs.ts +++ b/src/lib/utils/breadcrumbs.ts @@ -1,4 +1,5 @@ import { BreadcrumbItem, BreadCrumbLink } from '@/types/drupal/field_type' +import { RESOURCE_TYPES } from '@/lib/constants/resourceTypes' export function deriveLastBreadcrumbFromPath( breadcrumbs: BreadcrumbItem[], @@ -69,3 +70,9 @@ export function filterInvalidCrumbs( return crumb.href !== '' || index === arr.length - 1 }) } + +export const shouldHideHomeBreadcrumb = (resourceType) => { + const typesToShowHomeBreadcrumb = [RESOURCE_TYPES.EVENT] + + return !typesToShowHomeBreadcrumb.includes(resourceType) +} diff --git a/src/pages/[[...slug]].tsx b/src/pages/[[...slug]].tsx index 12d692fb4..9a10726f6 100644 --- a/src/pages/[[...slug]].tsx +++ b/src/pages/[[...slug]].tsx @@ -10,7 +10,7 @@ import { Wrapper } from '@/templates/globals/wrapper' import { NewsStory } from '@/templates/layouts/newsStory' import { StoryListing } from '@/templates/layouts/storyListing' import HTMLComment from '@/templates/globals/util/HTMLComment' -import { shouldHideHomeBreadcrumb } from '@/templates/globals/util/shouldHideHomeBreadcrumb' +import { shouldHideHomeBreadcrumb } from '@/lib/utils/breadcrumbs' import { Event } from '@/templates/layouts/event' import { getStaticPathsByResourceType } from '@/lib/drupal/staticPaths' import { RESOURCE_TYPES } from '@/lib/constants/resourceTypes' diff --git a/src/templates/globals/util/shouldHideHomeBreadcrumb.tsx b/src/templates/globals/util/shouldHideHomeBreadcrumb.tsx deleted file mode 100644 index 3900fca87..000000000 --- a/src/templates/globals/util/shouldHideHomeBreadcrumb.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { RESOURCE_TYPES } from '@/lib/constants/resourceTypes' - -export const shouldHideHomeBreadcrumb = (resourceType) => { - const typesToShowHomeBreadcrumb = [RESOURCE_TYPES.EVENT] - - return !typesToShowHomeBreadcrumb.includes(resourceType) -} diff --git a/src/templates/layouts/event/index.tsx b/src/templates/layouts/event/index.tsx index 48b949860..3d9d15d1f 100644 --- a/src/templates/layouts/event/index.tsx +++ b/src/templates/layouts/event/index.tsx @@ -72,6 +72,18 @@ export const Event = ({ .filter(Boolean) .join(', ') + const createMailToLink = (emailCTA, title, mostRecentDate, linkPath) => { + const formattedDate = deriveFormattedTimestamp(mostRecentDate) + const subject = `RSVP for ${title} on ${formattedDate}` + const body = `I would like to register for ${title} on ${formattedDate}. (https://va.gov${ + linkPath || '' + })` + + return `mailto:${emailCTA}?subject=${encodeURIComponent( + subject + )}&body=${encodeURIComponent(body)}` + } + return (
{eventCTA && formatEventCTA(eventCTA)} @@ -256,8 +269,9 @@ export const Event = ({ View other times for this event @@ -274,7 +288,7 @@ export const Event = ({