From 21be5e96221ef9a2627f7e700e66378b7d8edf52 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 23 Feb 2024 05:04:50 +0000 Subject: [PATCH] refactor: hide countdown after deadline --- OliverBooth/Pages/Shared/_Layout.cshtml | 17 ++++++++++------- src/ts/app.ts | 8 +++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/OliverBooth/Pages/Shared/_Layout.cshtml b/OliverBooth/Pages/Shared/_Layout.cshtml index 0b9c4d0..b1d9a88 100644 --- a/OliverBooth/Pages/Shared/_Layout.cshtml +++ b/OliverBooth/Pages/Shared/_Layout.cshtml @@ -94,14 +94,17 @@
-
-
-
00
-
00
-
00
-
00
+@if (DateTimeOffset.UtcNow < new DateTime(2024, 03, 08)) +{ +
+
+
00
+
00
+
00
+
00
+
-
+}
diff --git a/src/ts/app.ts b/src/ts/app.ts index 33d0cab..9d0723e 100644 --- a/src/ts/app.ts +++ b/src/ts/app.ts @@ -99,7 +99,9 @@ declare const Prism: any; UI.updateUI(); const usaCountdown = document.getElementById("usa-countdown"); - usaCountdown.addEventListener("click", () => window.location.href = "/blog/2024/02/19/the-american"); - UI.updateUsaCountdown(usaCountdown); - setInterval(() => UI.updateUsaCountdown(usaCountdown), 1000); + if (usaCountdown) { + usaCountdown.addEventListener("click", () => window.location.href = "/blog/2024/02/19/the-american"); + UI.updateUsaCountdown(usaCountdown); + setInterval(() => UI.updateUsaCountdown(usaCountdown), 1000); + } })();