Skip to content

Commit

Permalink
merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmst committed Jan 2, 2024
1 parent 8f83243 commit f83e36a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
7 changes: 7 additions & 0 deletions src/lib/utils/breadcrumbs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BreadcrumbItem, BreadCrumbLink } from '@/types/drupal/field_type'
import { RESOURCE_TYPES } from '@/lib/constants/resourceTypes'

export function deriveLastBreadcrumbFromPath(
breadcrumbs: BreadcrumbItem[],
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion src/pages/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 0 additions & 7 deletions src/templates/globals/util/shouldHideHomeBreadcrumb.tsx

This file was deleted.

30 changes: 22 additions & 8 deletions src/templates/layouts/event/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="va-l-detail-page va-facility-page">
<div className="usa-grid usa-grid-full">
Expand Down Expand Up @@ -216,11 +228,12 @@ export const Event = ({
<p className="vads-u-margin--0">
<a
className="vads-c-action-link--green"
href={`mailto:${emailCTA}?subject=RSVP for ${title} on ${deriveFormattedTimestamp(
mostRecentDate
)}&body=I would like to register for ${title} on ${deriveFormattedTimestamp(
mostRecentDate
)}. (https://va.gov${link?.url?.path})`}
href={createMailToLink(
emailCTA,
title,
mostRecentDate,
link?.url?.path
)}
>
{eventCTA && formatEventCTA(eventCTA)}
</a>
Expand Down Expand Up @@ -256,8 +269,9 @@ export const Event = ({
View other times for this event
<i
aria-hidden="true"
className={`fa ${showRecurringEvents ? 'fa-minus' : 'fa-plus'
}`}
className={`fa ${
showRecurringEvents ? 'fa-minus' : 'fa-plus'
}`}
id="expand-recurring-events-icon"
></i>
</button>
Expand All @@ -274,7 +288,7 @@ export const Event = ({
<a
className="recurring-event"
data-description={description}
data-end={dateRange.endValue}
data-end={dateRange?.endValue}
data-location={directionsString}
data-start={dateRange?.value}
data-subject={title}
Expand Down

0 comments on commit f83e36a

Please sign in to comment.