From b018bd62213b1a72114ecf47c6676204e33bd429 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 16 Dec 2023 18:50:51 -0800
Subject: feat(anime): subtitle countdown

---
 src/lib/Tools/SequelSpy.svelte | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'src/lib/Tools/SequelSpy.svelte')

diff --git a/src/lib/Tools/SequelSpy.svelte b/src/lib/Tools/SequelSpy.svelte
index 56f40956..e8cc98bf 100644
--- a/src/lib/Tools/SequelSpy.svelte
+++ b/src/lib/Tools/SequelSpy.svelte
@@ -8,6 +8,7 @@
 	import type { Media } from '$lib/AniList/media';
 	import { page } from '$app/stores';
 	import { browser } from '$app/environment';
+	import type { SubsPlease } from '$lib/subsPlease';
 
 	export let user: AniListAuthorisation;
 
@@ -42,7 +43,8 @@
 
 	onMount(() => clearAllParameters(['year', 'season']));
 
-	const prequelAiringTime = (prequel: MediaPrequel) => airingTime(prequel as unknown as Media);
+	const prequelAiringTime = (prequel: MediaPrequel, subsPlease: SubsPlease) =>
+		airingTime(prequel as unknown as Media, subsPlease);
 </script>
 
 <p>
@@ -66,7 +68,11 @@
 				</a>
 				<span style="opacity: 50%;">|</span>
 				{prequel.seen}<span style="opacity: 50%;">/{prequel.episodes}</span>
-				{@html prequelAiringTime(prequel)}
+				{#await fetch(`/api/subsplease?tz=${Intl.DateTimeFormat().resolvedOptions().timeZone}`).then( (r) => r.json() )}
+					Loading ...
+				{:then subsPlease}
+					{@html prequelAiringTime(prequel, subsPlease)}
+				{/await}
 			</li>
 		{/each}
 	</ul>
-- 
cgit v1.2.3

