From 00a37d80baff59b57fec2bd475ab7de531580199 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 3 Sep 2023 17:58:56 -0700
Subject: feat(stores): settings store for all settings

---
 src/routes/+page.svelte | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

(limited to 'src/routes/+page.svelte')

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index cfcf016a..1e49411e 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -3,18 +3,12 @@
 	import { userIdentity as getUserIdentity } from '$lib/AniList/identity';
 	import AnimeList from '$lib/List/Due/AnimeList.svelte';
 	import MangaList from '$lib/List/Due/MangaList.svelte';
-	import displayUnresolved from '../stores/displayUnresolved';
-	import closeAnimeByDefault from '../stores/closeAnimeByDefault';
-	import closeMangaByDefault from '../stores/closeMangaByDefault';
 	import UpcomingAnimeList from '$lib/List/UpcomingAnimeList.svelte';
 	import userIdentity from '../stores/userIdentity';
+	import settings from '../stores/settings';
 
 	export let data;
 
-	$: displayingUnresolved = $displayUnresolved === 'true';
-	$: mangaClosed = $closeMangaByDefault === 'false';
-	$: animeClosed = $closeAnimeByDefault === 'false';
-
 	let currentUserIdentity = { name: '', id: -1 };
 
 	onMount(async () => {
@@ -39,12 +33,12 @@
 	{:else}
 		<p />
 
-		<details open={animeClosed} class="list">
+		<details open={!$settings.closeAnimeByDefault} class="list">
 			{#if currentUserIdentity.id != -1}
 				<UpcomingAnimeList
 					user={data.user}
 					identity={currentUserIdentity}
-					displayUnresolved={displayingUnresolved}
+					displayUnresolved={$settings.displayUnresolved}
 				/>
 			{:else}
 				<summary>Upcoming Episodes [...] <small style="opacity: 50%">...s</small></summary>
@@ -54,12 +48,12 @@
 
 		<p />
 
-		<details open={animeClosed} class="list">
+		<details open={!$settings.closeAnimeByDefault} class="list">
 			{#if currentUserIdentity.id != -1}
 				<AnimeList
 					user={data.user}
 					identity={currentUserIdentity}
-					displayUnresolved={displayingUnresolved}
+					displayUnresolved={$settings.displayUnresolved}
 				/>
 			{:else}
 				<summary>Anime [...] <small style="opacity: 50%">...s</small></summary>
@@ -69,12 +63,12 @@
 
 		<p />
 
-		<details open={mangaClosed} class="list">
+		<details open={!$settings.closeMangaByDefault} class="list">
 			{#if currentUserIdentity.id != -1}
 				<MangaList
 					user={data.user}
 					identity={currentUserIdentity}
-					displayUnresolved={displayingUnresolved}
+					displayUnresolved={$settings.displayUnresolved}
 				/>
 			{:else}
 				<summary>Manga [...] <small style="opacity: 50%">...s</small></summary>
-- 
cgit v1.2.3

