migrate: change settings from a store to a state

This commit is contained in:
Xylight committed 2024-10-25 21:09:32 -07:00
1 parent ffcd9faa96
commit d597349887
128 files changed
+1010 -1144

No files matched your search

@@ -1,10 +1,7 @@
<script lang="ts">
import { run } from 'svelte/legacy'
import { page } from '$app/stores'
import { profile } from '$lib/auth'
import { userSettings } from '$lib/settings'
import { searchParam } from '$lib/util'
import { profile } from '$lib/auth.svelte'
import { searchParam } from '$lib/util.svelte'
import { Select } from 'mono-svelte'
import {
GlobeAmericas,
@@ -25,32 +22,19 @@
}
let {
selected,
selected = $bindable(),
navigate = true,
changeDefault = false,
showLabel = true,
...rest
}: Props = $props()
let feed: string = $state(selected)
run(() => {
feed = selected
})
run(() => {
changeDefault
? ($userSettings.defaultSort.feed = selected as
| 'All'
| 'Subscribed'
| 'Local')
: undefined
})
</script>
<Select
{...rest}
bind:value={feed}
bind:value={selected}
on:change={() => {
if (navigate) searchParam($page.url, 'type', feed, 'page', 'cursor')
if (navigate) searchParam($page.url, 'type', selected, 'page', 'cursor')
}}
>
{#snippet customLabel()}