From 910d6fd0e10e4f9c7bd1f189d94e3be90ca2aaea Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Sat, 21 Jan 2023 20:26:08 +1100
Subject: Make info modal start/end labels category-specific

---
 src/components/InfoModal.vue | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'src/components/InfoModal.vue')

diff --git a/src/components/InfoModal.vue b/src/components/InfoModal.vue
index 25a1d36..795b21c 100644
--- a/src/components/InfoModal.vue
+++ b/src/components/InfoModal.vue
@@ -12,12 +12,14 @@
 		</h1>
 
 		<!-- Time Display -->
-		<div class="flex justify-evenly pb-1 md:pb-2">
+		<div class="flex justify-evenly pb-1">
 			<div class="text-center text-sm md:text-base">
-				<span class="font-bold">Start:</span> {{datesDisplayStrs[0]}}
+				<span class="font-bold">{{CTG_TO_START_END_STR.get(eventInfo.event.ctg)![0]}}:</span>
+				{{datesDisplayStrs[0]}}
 			</div>
 			<div v-if="datesDisplayStrs[1] != null" class="text-center text-sm md:text-base">
-				<span class="font-bold">End:</span> {{datesDisplayStrs[1]}}
+				<span class="font-bold">{{CTG_TO_START_END_STR.get(eventInfo.event.ctg)![1]}}:</span>
+				{{datesDisplayStrs[1]}}
 			</div>
 		</div>
 
@@ -150,6 +152,15 @@ function licenseToUrl(license: string){
 	}
 }
 
+// Map holding event-category-specific start/end labels
+const CTG_TO_START_END_STR = new Map();
+CTG_TO_START_END_STR.set('event', ['Began', 'Ended']);
+CTG_TO_START_END_STR.set('place', ['Formed', 'Ended']);
+CTG_TO_START_END_STR.set('organism', ['Evolved', 'Extinct']);
+CTG_TO_START_END_STR.set('person', ['Born', 'Died']);
+CTG_TO_START_END_STR.set('work', ['Published', 'Ended']);
+CTG_TO_START_END_STR.set('discovery', ['Discovered', 'Ended']);
+
 // ========== Close handling ==========
 
 function onClose(evt: Event){
-- 
cgit v1.2.3

