From 6e156292b31e30ac8707eeec44c841f7a6f141d9 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 27 Aug 2023 22:07:57 -0700
Subject: feat(settings): change conditional

---
 src/routes/settings/+page.svelte | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

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

diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index 874d3804..d29e9161 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -10,11 +10,6 @@
 
 	export let data;
 
-	$: displayingUnresolved = $displayUnresolved === 'true';
-	$: roundingDownChapters = $roundDownChapters === 'true';
-	$: mangaClosed = $closeMangaByDefault === 'true';
-	$: animeClosed = $closeAnimeByDefault === 'true';
-
 	const pruneUnresolved = async () => {
 		const unresolved = await chapterDatabase.chapters.where('chapters').equals(-1).toArray();
 
@@ -22,7 +17,6 @@
 
 		await chapterDatabase.chapters.bulkDelete(ids);
 	};
-
 	const pruneAll = async () => {
 		const all = await chapterDatabase.chapters.toArray();
 
@@ -44,8 +38,10 @@
 			<a
 				href="#"
 				on:click={() =>
-					displayingUnresolved ? displayUnresolved.set('false') : displayUnresolved.set('true')}
-				>{displayingUnresolved ? 'Hide' : 'Show'} unresolved</a
+					$displayUnresolved === 'true'
+						? displayUnresolved.set('false')
+						: displayUnresolved.set('true')}
+				>{$displayUnresolved === 'true' ? 'Hide' : 'Show'} unresolved</a
 			>
 			<small style="opacity: 50%;">Displays unresolved chapter counts as "?"</small>
 		</li>
@@ -53,8 +49,10 @@
 			<a
 				href="#"
 				on:click={() =>
-					roundingDownChapters ? roundDownChapters.set('false') : roundDownChapters.set('true')}
-				>{roundingDownChapters ? 'Round down' : 'Maintain'} chapters</a
+					$roundDownChapters === 'true'
+						? roundDownChapters.set('false')
+						: roundDownChapters.set('true')}
+				>{$roundDownChapters === 'true' ? 'Round down' : 'Maintain'} chapters</a
 			>
 			<small style="opacity: 50%;">50/50.6 would <b>not</b> be due</small>
 		</li>
@@ -62,16 +60,20 @@
 			<a
 				href="#"
 				on:click={() =>
-					animeClosed ? closeAnimeByDefault.set('false') : closeAnimeByDefault.set('true')}
-				>{animeClosed ? 'Expand' : 'Close'} anime panel by default</a
+					$closeAnimeByDefault === 'true'
+						? closeAnimeByDefault.set('false')
+						: closeAnimeByDefault.set('true')}
+				>{$closeAnimeByDefault === 'true' ? 'Expand' : 'Close'} anime panel by default</a
 			>
 		</li>
 		<li>
 			<a
 				href="#"
 				on:click={() =>
-					mangaClosed ? closeMangaByDefault.set('false') : closeMangaByDefault.set('true')}
-				>{mangaClosed ? 'Expand' : 'Close'} manga panel by default</a
+					$closeMangaByDefault === 'true'
+						? closeMangaByDefault.set('false')
+						: closeMangaByDefault.set('true')}
+				>{$closeMangaByDefault === 'true' ? 'Expand' : 'Close'} manga panel by default</a
 			>
 		</li>
 		<li>
-- 
cgit v1.2.3

