From 447efaf6be58e6c0e81253d33316a890047b6557 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Mon, 28 Aug 2023 15:44:13 -0700
Subject: refactor(list): use interface for key

---
 src/lib/List/UpcomingAnimeList.svelte | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

(limited to 'src/lib/List/UpcomingAnimeList.svelte')

diff --git a/src/lib/List/UpcomingAnimeList.svelte b/src/lib/List/UpcomingAnimeList.svelte
index 677d0769..9c05d679 100644
--- a/src/lib/List/UpcomingAnimeList.svelte
+++ b/src/lib/List/UpcomingAnimeList.svelte
@@ -25,20 +25,20 @@
 
 		const flattenedLists = flattenLists(media);
 		const releasingMedia = flattenedLists.filter(
-			(media: Media) => media['status'] == 'RELEASING' && media.nextAiringEpisode !== null
+			(media: Media) => media.status == 'RELEASING' && media.nextAiringEpisode !== null
 			/* &&
 				(media['mediaListEntry'] || { progress: 0 })['progress'] >=
 					($displayNotStarted === 'true' ? 0 : 1) */
 		);
 		const outdatedMedia = releasingMedia.filter((media: Media) => {
 			return (
-				(media['nextAiringEpisode'] || { episode: 0 })['episode'] - 1 <=
-				(media['mediaListEntry'] || { progress: 0 })['progress']
+				(media.nextAiringEpisode || { episode: 0 }).episode - 1 <=
+				(media.mediaListEntry || { progress: 0 }).progress
 			);
 		});
 		let finalMedia = outdatedMedia.map((media: Media) => {
-			if ((media['nextAiringEpisode'] || { episode: 0 })['episode'] - 1 <= 0) {
-				media['nextAiringEpisode'] = { episode: -1 };
+			if ((media.nextAiringEpisode || { episode: 0 }).episode - 1 <= 0) {
+				media.nextAiringEpisode = { episode: -1 };
 			}
 
 			return media;
@@ -99,9 +99,7 @@
 	};
 
 	const totalEpisodes = (anime: Media) => {
-		return anime['episodes'] === null
-			? ''
-			: `<span style="opacity: 50%">/${anime['episodes']}</span>`;
+		return anime.episodes === null ? '' : `<span style="opacity: 50%">/${anime.episodes}</span>`;
 	};
 </script>
 
@@ -120,8 +118,8 @@
 	<ul>
 		{#each cleanedMedia as anime}
 			<li>
-				<a href={`https://anilist.co/anime/${anime['id']}`} target="_blank">
-					{anime['title']['english'] || anime['title']['romaji']}
+				<a href={`https://anilist.co/anime/${anime.id}`} target="_blank">
+					{anime.title.english || anime.title.romaji}
 				</a>
 				<span style="opacity: 50%;">|</span>
 				{@html airingTime(anime)}
-- 
cgit v1.2.3

