diff --git a/src/lib/stores.ts b/src/lib/stores.ts index 3c590dd..30d73a8 100644 --- a/src/lib/stores.ts +++ b/src/lib/stores.ts @@ -22,15 +22,11 @@ export const userPreferencesStore = localStorageStore<{ theme: string; lightMode: boolean; compact: boolean; - /* 0 = first visit, 1 = second visit, 2 = unchosen but visited - 4 = prefers /home, 5 = prefers /s */ - visitState: number; - // lastSearched: string; + alreadyVisited: boolean; }>('preferences', { sortBy: 'name', theme: 'kjspkg', lightMode: false, compact: false, - visitState: 0, - // lastSearched: '' + alreadyVisited: true }); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 997942c..e777875 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -2,46 +2,15 @@ import { goto } from '$app/navigation'; import { base } from '$app/paths'; import { userPreferencesStore } from '$lib/stores'; - import { getToastStore } from '@skeletonlabs/skeleton'; import { onMount } from 'svelte'; - const toastStore = getToastStore(); - onMount(() => { - switch ($userPreferencesStore.visitState) { - case 0: - $userPreferencesStore.visitState = 1; - goto(base + '/home'); - break; - case 1: - $userPreferencesStore.visitState = 2; - goto(base + '/home'); - break; - case 2: - goto(base + '/home'); - toastStore.trigger({ - message: 'Do you wish to be redirected to the package list automatically?', - timeout: 30_000, - background: 'variant-filled-success', - action: { - label: 'Sure!', - response: () => setTimeout(() => ($userPreferencesStore.visitState = 5), 1) - }, - callback(response) { - if (response.status == 'closed') $userPreferencesStore.visitState = 4; - } - }); - break; - case 4: - goto(base + '/home'); - break; - case 5: - goto(base + '/s'); - break; - default: - $userPreferencesStore.visitState = 0; - goto(base + '/home'); - break; + if (!$userPreferencesStore.alreadyVisited) { + userPreferencesStore.update((prev) => ({ ...prev, alreadyVisited: true })); + goto(base + '/home'); + return; } + + goto(base + '/s'); }); diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte index 8cb7337..5501a02 100644 --- a/src/routes/home/+page.svelte +++ b/src/routes/home/+page.svelte @@ -22,12 +22,3 @@ This website serves as a means to share KJSPKG packages more easily. Use the search bar above to search for packages, or browse all packages.

- -{#if $userPreferencesStore.visitState == 5} - -{/if} diff --git a/src/routes/s/+page.svelte b/src/routes/s/+page.svelte index b473961..9a32949 100644 --- a/src/routes/s/+page.svelte +++ b/src/routes/s/+page.svelte @@ -228,14 +228,6 @@ sortBy={$userPreferencesStore.sortBy} compact={$userPreferencesStore.compact} /> - {#if $userPreferencesStore.visitState == 4 && !$packageStatusStore.search.v} - - {/if} {:else if state == 'fail'}

Something went wrong