From ec7bd1a8dc0c52dfa45067e39333a93f1e925f4e Mon Sep 17 00:00:00 2001 From: Johnny McQuade Date: Mon, 23 Dec 2024 17:51:34 +0000 Subject: [PATCH] chore: activity should be locked when now countdown start date is provided --- .../activity-check-in.component.html | 22 ++++++++++--------- .../activity-check-in.component.ts | 3 +++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.html b/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.html index 5576e05b3..f402b2c93 100644 --- a/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.html +++ b/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.html @@ -3,17 +3,19 @@ class="activity-container" [attr.data-language-direction]="templateTranslateService.languageDirection()" > -
-
-
+ @if (params.countdownStartDate) { +
+
+
+
+
{{ countdownText() }}
-
{{ countdownText() }}
-
+ }
diff --git a/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.ts b/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.ts index bfb6aef5c..0c1b106e4 100644 --- a/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.ts +++ b/packages/components/plh/plh-kids-kw/components/activity-check-in/activity-check-in.component.ts @@ -37,6 +37,8 @@ export class PlhActivityCheckInComponent extends TemplateBaseComponent implement daysUntilUnlock = signal(Infinity); locked = computed(() => { + // If no start date is provided, activity should be locked + if (!this.params.countdownStartDate) return true; return this.daysUntilUnlock() && this.daysUntilUnlock() > 0; }); countdownText = computed(() => { @@ -93,6 +95,7 @@ export class PlhActivityCheckInComponent extends TemplateBaseComponent implement // Attempt to parse from ISO format parsedDate = parseISO(countdownStartDate); if (!isValid(parsedDate)) { + parsedDate = null; console.error( `[ACTIVITY CHECK-IN] Invalid date for countdown_start_date: ${countdownStartDate}` );