From 05dd46c2f36787e71f4a3a3d7ac0febf3c6f9309 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 14 Jan 2023 14:31:14 +1100 Subject: Extend info modal date display Show combined descriptions for certain (imprecise) starts and ends. Conditionally display start and end separately. --- src/components/InfoModal.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/components') diff --git a/src/components/InfoModal.vue b/src/components/InfoModal.vue index d2ac425..0b46be0 100644 --- a/src/components/InfoModal.vue +++ b/src/components/InfoModal.vue @@ -7,7 +7,14 @@

{{event.title}}

-

{{datesDisplayStr}}

+ +
+ {{datesDisplayStrs.length == 1 ? 'Time' : 'Start'}}: {{datesDisplayStrs[0]}} +
+
+ End: {{datesDisplayStrs[1]}} +
+
@@ -75,7 +82,7 @@ import SCollapsible from './SCollapsible.vue'; import CloseIcon from './icon/CloseIcon.vue'; import DownIcon from './icon/DownIcon.vue'; import ExternalLinkIcon from './icon/ExternalLinkIcon.vue'; -import {EventInfo, boundedDateToStr, getImagePath} from '../lib'; +import {EventInfo, eventDatesToStrings, getImagePath} from '../lib'; import {useStore} from '../store'; // Refs @@ -93,11 +100,8 @@ const emit = defineEmits(['close']); // For data display const event = computed(() => props.eventInfo.event) -const datesDisplayStr = computed(() => { - const startStr = boundedDateToStr(event.value.start, event.value.startUpper); - const endStr = event.value.end == null ? null : boundedDateToStr(event.value.end, event.value.endUpper); - return 'Start: ' + startStr + (endStr == null ? '' : ', End: ' + endStr); -}); +const datesDisplayStrs = computed( + () => eventDatesToStrings(event.value.start, event.value.startUpper, event.value.end, event.value.endUpper)); function licenseToUrl(license: string){ license = license.toLowerCase().replaceAll('-', ' '); if (license == 'cc0'){ -- cgit v1.2.3