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

+13 -13
View File
@@ -1,8 +1,8 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { preventDefault } from 'svelte/legacy'
import { navigating, page } from '$app/stores'
import { profile } from '$lib/auth.js'
import { profile } from '$lib/auth.svelte.js'
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
@@ -17,8 +17,8 @@
isPostView,
isUser,
} from '$lib/lemmy/item.js'
import { userSettings } from '$lib/settings.js'
import { searchParam } from '$lib/util.js'
import { settings } from '$lib/settings.svelte.js'
import { searchParam } from '$lib/util.svelte.js'
import type {
CommentView,
CommunityView,
@@ -42,7 +42,7 @@
type Result = PostView | CommentView | PersonView | CommunityView
let { data = $bindable() } = $props();
let { data = $bindable() } = $props()
let query = $state(data.query || '')
let searchElement: HTMLInputElement = $state()
@@ -72,7 +72,8 @@
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
<form
onsubmit={preventDefault(() =>
searchParam($page.url, 'q', query, 'page'))}
searchParam($page.url, 'q', query, 'page'),
)}
class="flex gap-2 flex-row items-center w-full text-base h-10"
>
<TextInput
@@ -92,8 +93,8 @@
loading={$navigating != null}
>
{#snippet prefix()}
<Icon src={MagnifyingGlass} size="16" micro />
{/snippet}
<Icon src={MagnifyingGlass} size="16" micro />
{/snippet}
</Button>
</form>
</Tabs>
@@ -104,11 +105,11 @@
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
>
{#snippet label()}
<span class="flex items-center gap-1">
<span class="flex items-center gap-1">
<Icon src={AdjustmentsHorizontal} mini size="15" />
{$t('filter.type')}
</span>
{/snippet}
{/snippet}
<option value="All">{$t('content.all')}</option>
<option value="Posts">{$t('content.posts')}</option>
<option value="Comments">{$t('content.comments')}</option>
@@ -118,7 +119,6 @@
<Sort navigate bind:selected={data.sort} />
{#snippet summary()}
<Button
size="square-lg"
color="tertiary"
class="self-end justify-self-center"
@@ -186,8 +186,8 @@
{/await}
<div
class="flex flex-col mt-4 divide-slate-200 dark:divide-zinc-800"
class:!divide-y={$userSettings.view != 'card'}
class:gap-4={$userSettings.view == 'card'}
class:!divide-y={settings.view != 'card'}
class:gap-4={settings.view == 'card'}
>
{#each data.results as result}
{#if isPostView(result)}
+1 -1
View File
@@ -1,4 +1,4 @@
import { profile } from '$lib/auth.js'
import { profile } from '$lib/auth.svelte'
import { client, getClient } from '$lib/lemmy.js'
import { getItemPublished } from '$lib/lemmy/item.js'
import type {