misc: change $site to a $state

This commit is contained in:
James Xylight committed 2025-02-09 11:17:01 -08:00
1 parent a94dd5f3d4
commit 8dcca84e60
85 files changed
+153 -140

No files matched your search

@@ -7,7 +7,7 @@
import type { PageData } from './$types.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { getClient } from '$lib/lemmy.js'
import { getClient } from '$lib/lemmy.svelte.js'
import { profile } from '$lib/auth.svelte.js'
import { Check, Icon, Trash, XMark } from 'svelte-hero-icons'
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation'
import { page } from '$app/state'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { client } from '$lib/lemmy.js'
import { client } from '$lib/lemmy.svelte.js'
import { t } from '$lib/translations.js'
import { qr } from '@svelte-put/qr/svg'
import { Button, Material, TextInput, toast } from 'mono-svelte'
@@ -2,7 +2,7 @@
import { preventDefault } from 'svelte/legacy'
import { deleteProfile, profile, setUser } from '$lib/auth.svelte'
import { client } from '$lib/lemmy'
import { client } from '$lib/lemmy.svelte'
import { instance as currentInstance } from '$lib/instance'
import { t } from '$lib/translations'
import { Button, TextInput, toast } from 'mono-svelte'
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation'
import { profileData, setUserID } from '$lib/auth.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { client } from '$lib/lemmy'
import { client } from '$lib/lemmy.svelte'
import { t } from '$lib/translations'
import {
Button,
@@ -1,7 +1,7 @@
<script lang="ts">
import { publishedToDate } from '$lib/components/util/date.js'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { client } from '$lib/lemmy.js'
import { client } from '$lib/lemmy.svelte.js'
import { Checkbox, Material } from 'mono-svelte'
import { Icon, Key } from 'svelte-hero-icons'
@@ -1,4 +1,4 @@
import { client } from '$lib/lemmy.js'
import { client } from '$lib/lemmy.svelte.js'
export async function load({ fetch, parent }) {
const user = await parent()
@@ -12,7 +12,7 @@
removeToast,
toast,
} from 'mono-svelte'
import { getClient, site } from '$lib/lemmy.js'
import { getClient, site } from '$lib/lemmy.svelte.js'
import type { SaveUserSettings } from 'lemmy-js-client'
import { Button, Switch, TextInput } from 'mono-svelte'
import { uploadImage } from '$lib/util.svelte.js'
@@ -129,7 +129,7 @@
<SectionTitle>{$t('form.profile.languages.title')}</SectionTitle>
<p>{$t('form.profile.languages.description')}</p>
<Material rounding="xl" color="uniform" class="dark:bg-zinc-950">
{#if $site && formData.discussion_languages}
{#if site.data && formData.discussion_languages}
<div class="flex gap-2 flex-wrap flex-row">
<Menu class="gap-px">
{#snippet target()}
@@ -140,7 +140,7 @@
</Badge>
</button>
{/snippet}
{#each $site.all_languages.filter((l) => !formData.discussion_languages?.includes(l.id)) as language, index}
{#each site.data.all_languages.filter((l) => !formData.discussion_languages?.includes(l.id)) as language, index}
<MenuButton
class="min-h-[16px] py-0"
onclick={() => {
@@ -152,7 +152,7 @@
{/each}
</Menu>
{#each formData.discussion_languages as languageId, index}
{@const language = $site.all_languages.find(
{@const language = site.data.all_languages.find(
(l) => l.id == languageId,
)}
<button
+2 -2
View File
@@ -5,7 +5,7 @@
import MultiSelect from '$lib/components/input/Switch.svelte'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
import { site } from '$lib/lemmy'
import { site } from '$lib/lemmy.svelte'
import { t } from '$lib/translations'
import { feature } from '$lib/version'
import { Button, Menu, MenuButton } from 'mono-svelte'
@@ -62,7 +62,7 @@
},
]}
/>
{#if feature('mediaAndVotes', $site?.version)}
{#if feature('mediaAndVotes', site.data?.version)}
<Menu class="flex-1" placement="bottom-end">
{#snippet target()}
<Button
+1 -1
View File
@@ -1,5 +1,5 @@
import { profile } from '$lib/auth.svelte'
import { client, getClient } from '$lib/lemmy.js'
import { client, getClient } from '$lib/lemmy.svelte.js'
import { getItemPublished } from '$lib/lemmy/item.js'
import type { SortType } from 'lemmy-js-client'
import { get } from 'svelte/store'
+1 -1
View File
@@ -1,5 +1,5 @@
import { profile } from '$lib/auth.svelte'
import { client } from '$lib/lemmy.js'
import { client } from '$lib/lemmy.svelte.js'
export async function load({ fetch, url }) {
const { jwt } = profile.data
+1 -1
View File
@@ -3,7 +3,7 @@
import { publishedToDate } from '$lib/components/util/date'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { instance } from '$lib/instance'
import { client } from '$lib/lemmy'
import { client } from '$lib/lemmy.svelte'
import { t } from '$lib/translations'
import { instanceToURL } from '$lib/util.svelte'
import type { LocalImage } from 'lemmy-js-client'
+1 -1
View File
@@ -1,4 +1,4 @@
import { getClient } from '$lib/lemmy.js'
import { getClient } from '$lib/lemmy.svelte.js'
import { getItemPublished } from '$lib/lemmy/item.js'
import type { SortType } from 'lemmy-js-client'
+1 -1
View File
@@ -1,4 +1,4 @@
import { client } from '$lib/lemmy.js'
import { client } from '$lib/lemmy.svelte.js'
import { postFeed } from '$lib/lemmy/postfeed.js'
import { error } from '@sveltejs/kit'