From d1f050f1b89d3428a17c0601e4f65f2e87188302 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 27 Aug 2023 22:35:34 -0700 Subject: feat(settings): add reset settings --- src/routes/settings/+page.svelte | 19 ++++++++++++++++++- src/stores/cacheMangaMinutes.ts | 2 +- src/stores/roundDownChapters.ts | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index f68306ab..087cc445 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -24,6 +24,15 @@ await chapterDatabase.chapters.bulkDelete(ids); }; + const resetSettings = () => { + displayUnresolved.set('false'); + roundDownChapters.set('true'); + closeAnimeByDefault.set('false'); + closeMangaByDefault.set('false'); + sortByDifference.set('true'); + cacheMinutes.set('30'); + cacheMangaMinutes.set('60'); + }; Home @@ -52,7 +61,7 @@ $roundDownChapters === 'true' ? roundDownChapters.set('false') : roundDownChapters.set('true')} - >{$roundDownChapters === 'true' ? 'Round down' : 'Maintain'} chapters{$roundDownChapters === 'false' ? 'Round down' : 'Maintain'} chapters 50/50.6 would {@html $roundDownChapters === 'true' ? 'not' : ''} be due +
  • + Reset ALL settings +
  • +
  • + localStorage.clear()}>Clear localStorage + Doesn't break anything, but resets all settings and caches +
  • {/if} diff --git a/src/stores/cacheMangaMinutes.ts b/src/stores/cacheMangaMinutes.ts index f4c714ad..6da460b2 100644 --- a/src/stores/cacheMangaMinutes.ts +++ b/src/stores/cacheMangaMinutes.ts @@ -2,7 +2,7 @@ import { browser } from '$app/environment'; import { writable } from 'svelte/store'; const cacheMangaMinutes = writable( - browser ? localStorage.getItem('cacheMangaMinutes') ?? '120' : '120' + browser ? localStorage.getItem('cacheMangaMinutes') ?? '60' : '60' ); cacheMangaMinutes.subscribe((value) => { diff --git a/src/stores/roundDownChapters.ts b/src/stores/roundDownChapters.ts index f4ac3513..8cbdbdc1 100644 --- a/src/stores/roundDownChapters.ts +++ b/src/stores/roundDownChapters.ts @@ -2,7 +2,7 @@ import { browser } from '$app/environment'; import { writable } from 'svelte/store'; const roundDownChapters = writable( - browser ? localStorage.getItem('roundDownChapters') ?? 'false' : 'false' + browser ? localStorage.getItem('roundDownChapters') ?? 'true' : 'true' ); roundDownChapters.subscribe((value) => { -- cgit v1.2.3