From 5f1ca7469293da931fc300febbaee0901d116764 Mon Sep 17 00:00:00 2001 From: Stephanie Smith Date: Mon, 12 Aug 2024 16:08:46 -0700 Subject: [PATCH] fix: EDU Event Detail Page (#537) * fixes after feedback on edu event detail page * fixing speaker data shape * fixing ICS generation * fixing custom date display * fixing ongoing date display * layout adjustment to related events carousel * fixing time for multi-day events --- .../vue/src/components/BaseTag/BaseTag.vue | 2 +- .../CalendarButton/CalendarButton.vue | 19 +- .../src/components/EventCard/EventCard.vue | 30 ++- .../EventDetailHero/EventDetailHero.vue | 66 +++-- .../PageNewsDetail/PageNewsDetail.vue | 4 +- .../PageEduEventDetail.stories.js | 250 ++++++++++-------- .../PageEduEventDetail/PageEduEventDetail.vue | 149 +++++++---- packages/vue/src/utils/mixins.ts | 32 ++- packages/vue/tsconfig.json | 2 +- 9 files changed, 345 insertions(+), 209 deletions(-) diff --git a/packages/vue/src/components/BaseTag/BaseTag.vue b/packages/vue/src/components/BaseTag/BaseTag.vue index 152155d7..73127a40 100644 --- a/packages/vue/src/components/BaseTag/BaseTag.vue +++ b/packages/vue/src/components/BaseTag/BaseTag.vue @@ -11,7 +11,7 @@ const variantMap: Attributes = { const sizeMap: Attributes = { sm: 'text-xs border-t-2 py-1 px-2.5', md: 'text-xs lg:text-base border-t py-1.5 px-3.5', - lg: 'text-base lg:text-lg border-t py-1.5 px-5' + lg: 'text-base lg:text-lg border-t pt-1.5 pb-1 px-5' } interface BaseTagProps { diff --git a/packages/vue/src/components/CalendarButton/CalendarButton.vue b/packages/vue/src/components/CalendarButton/CalendarButton.vue index 5e77d8c8..45d3bbea 100644 --- a/packages/vue/src/components/CalendarButton/CalendarButton.vue +++ b/packages/vue/src/components/CalendarButton/CalendarButton.vue @@ -64,13 +64,18 @@ export default defineComponent({ options: undefined } }, + computed: { + icsDescription() { + return `${(this.description ? this.description + '\n\n' : '') + window?.location.href}` + } + }, mounted() { this.init() }, methods: { init() { - let recurrence = {} + let recurrence = undefined if (this.endDatetime && this.isAllDay) { // Calculate how many full days const startDateDayjs = dayjs(this.startDatetime) @@ -81,21 +86,15 @@ export default defineComponent({ this.options = { title: this.title ? this.title : undefined, - location: this.location ? this.addSlashes(this.location) : undefined, - description: this.description ? this.description : undefined, + location: this.location ? this.location : undefined, + description: this.icsDescription, start: new Date(this.startDatetime), end: !this.isAllDay && this.endDatetime ? new Date(this.endDatetime) : undefined, recurrence } + this.icalendar = new ICalendar(this.options) }, - addSlashes(string: string): string { - // Escape special characters COMMA, SEMI-COLON and BACKSLASH - // as temporary fix for this issue https://github.com/jshor/datebook/issues/179 - // regex based of https://stackoverflow.com/a/770533 - // eslint-disable-next-line - return string.replace(/[,;\\]/g, '\\$&').replace(/\u0000/g, '\\0') - }, handleDownload() { const ics = this.icalendar.render() const blob = new Blob([ics], { diff --git a/packages/vue/src/components/EventCard/EventCard.vue b/packages/vue/src/components/EventCard/EventCard.vue index 25934eab..554fc5b8 100644 --- a/packages/vue/src/components/EventCard/EventCard.vue +++ b/packages/vue/src/components/EventCard/EventCard.vue @@ -65,12 +65,22 @@ v-if="splitDate" class="hidden md:block absolute top-0 left-0 z-10 px-4 py-4 text-center text-white bg-primary" > -
- {{ splitDate.day }} -
-
- {{ splitDate.monthAndYear }} -
+ + @@ -84,8 +94,11 @@ import { defineComponent } from 'vue' import { mixinFormatEventDates, mixinFormatSplitEventDates, - mixinFormatEventTimeInHoursAndMinutes + mixinFormatEventTimeInHoursAndMinutes, + type EventDateObject } from './../../utils/mixins' +import { mapStores } from 'pinia' +import { useThemeStore } from '../../store/theme' import BaseLink from './../BaseLink/BaseLink.vue' import BaseHeading from './../BaseHeading/BaseHeading.vue' import BaseImage from './../BaseImage/BaseImage.vue' @@ -145,7 +158,8 @@ export default defineComponent({ } }, computed: { - splitDate(): { day: string; monthAndYear: string } | null { + ...mapStores(useThemeStore), + splitDate(): EventDateObject | null { if (this.startDate) { return mixinFormatSplitEventDates(this.startDate, this.endDate) } diff --git a/packages/vue/src/components/EventDetailHero/EventDetailHero.vue b/packages/vue/src/components/EventDetailHero/EventDetailHero.vue index c93be4a3..a4e6e830 100644 --- a/packages/vue/src/components/EventDetailHero/EventDetailHero.vue +++ b/packages/vue/src/components/EventDetailHero/EventDetailHero.vue @@ -4,41 +4,55 @@ class="EventDetailHero mb-10 md:mb-10 lg:mb-14 -mx-4 lg:mx-0" >
- -
-
- {{ startDateSplit.day }} + +
+ +
-
- {{ startDateSplit.monthAndYear }} -
-
+