migrate: change settings from a store to a state
This commit is contained in:
1 parent
ffcd9faa96
commit
d597349887
128 files changed
+1010
-1144
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { addFavorite } from '$lib/lemmy/item'
|
||||
@@ -11,11 +11,11 @@
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
interface Props {
|
||||
items: Community[];
|
||||
isFavorites?: boolean;
|
||||
items: Community[]
|
||||
isFavorites?: boolean
|
||||
}
|
||||
|
||||
let { items, isFavorites = false }: Props = $props();
|
||||
let { items, isFavorites = false }: Props = $props()
|
||||
</script>
|
||||
|
||||
{#each items.sort( (a, b) => a.title.localeCompare(b.title), ) as follow (follow.id)}
|
||||
@@ -65,13 +65,13 @@
|
||||
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
|
||||
>
|
||||
{#snippet label()}
|
||||
<div class="flex flex-col max-w-full break-words" >
|
||||
<div class="flex flex-col max-w-full break-words">
|
||||
<span>{follow.title}</span>
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(follow.actor_id).hostname}
|
||||
</span>
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -1,22 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { profile, setUserID, type Profile } from '$lib/auth.js'
|
||||
import { profile, setUserID, type Profile } from '$lib/auth.svelte.js'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, QuestionMarkCircle } from 'svelte-hero-icons'
|
||||
|
||||
|
||||
let switching: boolean = $state(false)
|
||||
interface Props {
|
||||
prof: Profile;
|
||||
index: number;
|
||||
guest?: boolean;
|
||||
prof: Profile
|
||||
index: number
|
||||
guest?: boolean
|
||||
}
|
||||
|
||||
let { prof, index, guest = false }: Props = $props();
|
||||
let { prof, index, guest = false }: Props = $props()
|
||||
</script>
|
||||
|
||||
<SidebarButton
|
||||
@@ -48,7 +47,6 @@
|
||||
{index}
|
||||
{guest}
|
||||
selected={$profile?.id == prof.id}
|
||||
|
||||
/>
|
||||
{/snippet}
|
||||
<span
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import { notifications, profile, profileData } from '$lib/auth.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { notifications, profile, profileData } from '$lib/auth.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
||||
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
|
||||
@@ -36,9 +36,9 @@
|
||||
gap-1 h-fit max-h-screen {clazz}"
|
||||
{style}
|
||||
>
|
||||
{#if $userSettings.dock.pins?.length ?? 0 > 0}
|
||||
{#if settings.dock.pins?.length ?? 0 > 0}
|
||||
<div class="flex items-center flex-wrap gap-2 pl-1.5">
|
||||
{#each $userSettings.dock.pins as pin}
|
||||
{#each settings.dock.pins as pin}
|
||||
<SidebarButton
|
||||
icon={iconOfLink(pin.url)}
|
||||
on:click={() => goto(pin.url)}
|
||||
@@ -46,8 +46,8 @@
|
||||
selected={`${$page.url.pathname}${$page.url.search}` == pin.url}
|
||||
on:contextmenu={(e) => {
|
||||
e.preventDefault()
|
||||
$userSettings.dock.pins = $userSettings.dock.pins.toSpliced(
|
||||
$userSettings.dock.pins.findLastIndex((p) => pin.url == p.url),
|
||||
settings.dock.pins = settings.dock.pins.toSpliced(
|
||||
settings.dock.pins.findLastIndex((p) => pin.url == p.url),
|
||||
1,
|
||||
)
|
||||
return false
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={$userSettings.expand.accounts}
|
||||
bind:open={settings.expand.accounts}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
@@ -148,11 +148,11 @@
|
||||
{#if $profile?.favorites && $profile?.favorites.length > 0}
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={$userSettings.expand.favorites}
|
||||
bind:open={settings.expand.favorites}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span
|
||||
class="px-2 py-1 w-full {$userSettings.expandSidebar
|
||||
class="px-2 py-1 w-full {settings.expandSidebar
|
||||
? ''
|
||||
: '//max-lg:hidden'}"
|
||||
>
|
||||
@@ -174,11 +174,11 @@
|
||||
{#if $profile?.user.moderates.length > 0}
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={$userSettings.expand.moderates}
|
||||
bind:open={settings.expand.moderates}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span
|
||||
class="px-2 py-1 w-full {$userSettings.expandSidebar
|
||||
class="px-2 py-1 w-full {settings.expandSidebar
|
||||
? ''
|
||||
: '//max-lg:hidden'}"
|
||||
>
|
||||
@@ -201,11 +201,11 @@
|
||||
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={$userSettings.expand.communities}
|
||||
bind:open={settings.expand.communities}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span
|
||||
class="px-2 py-1 w-full {$userSettings.expandSidebar
|
||||
class="px-2 py-1 w-full {settings.expandSidebar
|
||||
? ''
|
||||
: '//max-lg:hidden'}"
|
||||
>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { page } from '$app/stores'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
|
||||
Reference in new issue
Block a user