diff --git a/src/app.d.ts b/src/app.d.ts index 9ef481b2..e3c01c1a 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,6 +1,6 @@ // See https://kit.svelte.dev/docs/types#app -import type { Action } from '$lib/components/ui/navbar/commands/actions' +import type { Action } from '$lib/components/ui/navbar/commands/actions.svelte' import type { ComponentType, SvelteComponent } from 'svelte' // for information about these interfaces diff --git a/src/lib/auth.ts b/src/lib/auth.svelte.ts similarity index 99% rename from src/lib/auth.ts rename to src/lib/auth.svelte.ts index 7f26bf6b..59741b14 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.svelte.ts @@ -6,7 +6,7 @@ import { toast } from 'mono-svelte' import { DEFAULT_INSTANCE_URL, instance } from '$lib/instance.js' import { client, getClient } from '$lib/lemmy.js' import { site } from './lemmy' -import { instanceToURL, moveItem } from '$lib/util.js' +import { instanceToURL, moveItem } from '$lib/util.svelte' import { type GetSiteResponse, type MyUserInfo, diff --git a/src/lib/components/lemmy/SiteCard.svelte b/src/lib/components/lemmy/SiteCard.svelte index 0d46308a..9eb77b92 100644 --- a/src/lib/components/lemmy/SiteCard.svelte +++ b/src/lib/components/lemmy/SiteCard.svelte @@ -19,7 +19,7 @@ import { userLink } from '$lib/lemmy/generic' import { t } from '$lib/translations' import Entity from '../ui/Entity.svelte' - import { userSettings } from '$lib/settings' + import { settings } from '$lib/settings.svelte' import { optimizeImageURL } from './post/helpers' interface Props { @@ -100,7 +100,7 @@ {/if}
- + {#snippet title()} @@ -113,7 +113,7 @@
- + {#snippet title()} @@ -141,7 +141,7 @@ {#if admins}
- + {#snippet title()} diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index adcf3f9c..ec21c8d0 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -13,7 +13,7 @@ PlusCircle, MinusCircle, } from 'svelte-hero-icons' - import type { CommentNodeI } from './comments' + import type { CommentNodeI } from './comments.svelte' import RelativeDate from '$lib/components/util/RelativeDate.svelte' import CommentForm from './CommentForm.svelte' import UserLink from '$lib/components/lemmy/user/UserLink.svelte' @@ -21,7 +21,7 @@ import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte' import { getClient } from '$lib/lemmy.js' import { Disclosure, toast } from 'mono-svelte' - import { profile } from '$lib/auth.js' + import { profile } from '$lib/auth.svelte.js' import { Button, Modal } from 'mono-svelte' import { publishedToDate } from '$lib/components/util/date.js' import ShieldIcon from '../moderation/ShieldIcon.svelte' @@ -110,7 +110,7 @@
{#if actions} (editing = true)} disabled={node.comment_view.banned_from_community || @@ -259,7 +259,6 @@ children: [], comment_view: e.detail.comment_view, depth: node.depth + 1, - ui: {}, }, ...node.children, ] diff --git a/src/lib/components/lemmy/comment/CommentActions.svelte b/src/lib/components/lemmy/comment/CommentActions.svelte index 4dee6295..df4d72e5 100644 --- a/src/lib/components/lemmy/comment/CommentActions.svelte +++ b/src/lib/components/lemmy/comment/CommentActions.svelte @@ -22,13 +22,13 @@ report, } from '$lib/components/lemmy/moderation/moderation.js' import CommentModerationMenu from '$lib/components/lemmy/moderation/CommentModerationMenu.svelte' - import { profile } from '$lib/auth.js' + import { profile } from '$lib/auth.svelte.js' import { deleteItem, save } from '$lib/lemmy/contentview.js' import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte' import { t } from '$lib/translations' import Translation from '$lib/components/translate/Translation.svelte' import { text } from '$lib/components/translate/translation' - import { userSettings } from '$lib/settings' + import { settings } from '$lib/settings.svelte' interface Props { comment: CommentView @@ -54,12 +54,12 @@
- {/snippet} + {/snippet} {#if data.items && data.items.length > 0} diff --git a/src/routes/moderation/+page.ts b/src/routes/moderation/+page.ts index a436e4a1..66700a57 100644 --- a/src/routes/moderation/+page.ts +++ b/src/routes/moderation/+page.ts @@ -1,4 +1,4 @@ -import { profile } from '$lib/auth.js' +import { profile } from '$lib/auth.svelte' import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js' import { getClient } from '$lib/lemmy.js' import { diff --git a/src/routes/moderation/Report.svelte b/src/routes/moderation/Report.svelte index 5c6af45c..b9b40d3f 100644 --- a/src/routes/moderation/Report.svelte +++ b/src/routes/moderation/Report.svelte @@ -10,7 +10,7 @@ PrivateMessageReportView, } from 'lemmy-js-client' import { Check, CheckCircle, Icon } from 'svelte-hero-icons' - import { notifications, profile } from '$lib/auth.js' + import { notifications, profile } from '$lib/auth.svelte.js' import { Button } from 'mono-svelte' import type { ReportView } from '$lib/lemmy/report.js' import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte' @@ -19,10 +19,10 @@ import UserLink from '$lib/components/lemmy/user/UserLink.svelte' interface Props { - item: ReportView; + item: ReportView } - let { item = $bindable() }: Props = $props(); + let { item = $bindable() }: Props = $props() let resolving = $state(false) async function resolve() { @@ -140,8 +140,8 @@ disabled={resolving} > {#snippet prefix()} - - {/snippet} + + {/snippet} {!item.resolved ? $t('routes.moderation.resolve') : $t('routes.moderation.resolved')} diff --git a/src/routes/modlog/+page.svelte b/src/routes/modlog/+page.svelte index 8bd663ff..07f6e1b5 100644 --- a/src/routes/modlog/+page.svelte +++ b/src/routes/modlog/+page.svelte @@ -1,12 +1,12 @@ @@ -49,11 +51,11 @@ class="w-48" > {#snippet label()} - + Type - {/snippet} + {/snippet} @@ -74,11 +76,11 @@ - {/snippet} + {/snippet} {:else} {/if} @@ -465,9 +461,9 @@ undefined, (c) => !( - ($userSettings.hidePosts.deleted && c.comment.deleted) || - ($userSettings.hidePosts.removed && c.comment.removed) - ) + (settings.hidePosts.deleted && c.comment.deleted) || + (settings.hidePosts.removed && c.comment.removed) + ), )} scrollTo={data.thread.focus} /> @@ -487,17 +483,16 @@ {$t('routes.post.commentCount')} {#snippet action()} - - {/snippet} + {/snippet} {/if} diff --git a/src/routes/post/[instance]/[id=integer]/+page.ts b/src/routes/post/[instance]/[id=integer]/+page.ts index 8e33e773..58d9a96f 100644 --- a/src/routes/post/[instance]/[id=integer]/+page.ts +++ b/src/routes/post/[instance]/[id=integer]/+page.ts @@ -1,10 +1,10 @@ import { browser } from '$app/environment' import { env } from '$env/dynamic/public' -import { profile } from '$lib/auth.js' +import { profile } from '$lib/auth.svelte' import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte' import { getClient } from '$lib/lemmy.js' import { awaitIfServer } from '$lib/promise.js' -import { SSR_ENABLED, userSettings } from '$lib/settings.js' +import { SSR_ENABLED, settings } from '$lib/settings.svelte' import { error } from '@sveltejs/kit' import type { GetComments } from 'lemmy-js-client' import { get } from 'svelte/store' @@ -35,7 +35,7 @@ export async function load({ params, url, fetch }) { max_depth = 10 } - const sort = get(userSettings)?.defaultSort?.comments ?? 'Hot' + const sort = settings?.defaultSort?.comments ?? 'Hot' const commentParams: GetComments = { post_id: Number(params.id), diff --git a/src/routes/profile/(local_user)/blocks/+page.svelte b/src/routes/profile/(local_user)/blocks/+page.svelte index 34f088bd..8c31319e 100644 --- a/src/routes/profile/(local_user)/blocks/+page.svelte +++ b/src/routes/profile/(local_user)/blocks/+page.svelte @@ -9,7 +9,7 @@ import UserLink from '$lib/components/lemmy/user/UserLink.svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte' import { getClient } from '$lib/lemmy.js' - import { profile } from '$lib/auth.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' import { flip } from 'svelte/animate' @@ -22,23 +22,22 @@ import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte' import { expoOut } from 'svelte/easing' - interface Props { // sveltekit doesn't feel like making types work right now data: PageData & { - person_blocks: PersonBlockView[] - community_blocks: CommunityBlockView[] - }; + person_blocks: PersonBlockView[] + community_blocks: CommunityBlockView[] + } } - let { data = $bindable() }: Props = $props(); + let { data = $bindable() }: Props = $props() async function unblockUser(item: PersonBlockView) { if (!$profile?.jwt) return data.person_blocks.splice( data.person_blocks.findIndex((i) => i.target.id == item.target.id), - 1 + 1, ) // hack to get reactivity working data.person_blocks = data.person_blocks @@ -54,9 +53,9 @@ data.community_blocks.splice( data.community_blocks.findIndex( - (i) => i.community.id == item.community.id + (i) => i.community.id == item.community.id, ), - 1 + 1, ) // hack to get reactivity working @@ -74,9 +73,9 @@ data.my_user.instance_blocks.splice( data.my_user.instance_blocks.findIndex( - (i) => i.instance.id == item.instance.id + (i) => i.instance.id == item.instance.id, ), - 1 + 1, ) data.my_user.instance_blocks = data.my_user.instance_blocks @@ -91,9 +90,9 @@ {#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
{$t('content.instances')} - unblockInstances(i.detail)}> + unblockInstances(i.detail)}> {#snippet children({ action })} - {#each data.my_user?.instance_blocks as block (block.instance.id)} + {#each data.my_user?.instance_blocks as block (block.instance.id)}
action(block)} > {#snippet prefix()} - - {/snippet} + + {/snippet}
{/each} - {/snippet} -
+ {/snippet} +
{/if} {#if data.community_blocks?.length > 0}
{$t('content.communities')} - unblockCommunity(i.detail)}> + unblockCommunity(i.detail)}> {#snippet children({ action })} - {#each data.community_blocks as block (block.community.id)} + {#each data.community_blocks as block (block.community.id)}
action(block)} > {#snippet prefix()} - - {/snippet} + + {/snippet}
{/each} - {/snippet} -
+ {/snippet} +
{/if} {#if data.person_blocks?.length > 0}
{$t('content.users')} - unblockUser(i.detail)}> + unblockUser(i.detail)}> {#snippet children({ action })} - {#each data.person_blocks as block (block.target.id)} + {#each data.person_blocks as block (block.target.id)}
action(block)} > {#snippet prefix()} - - {/snippet} + + {/snippet}
{/each} - {/snippet} -
+ {/snippet} +
{/if} {:else} diff --git a/src/routes/profile/(local_user)/password/change/+page.svelte b/src/routes/profile/(local_user)/password/change/+page.svelte index c30eaa12..cf69222e 100644 --- a/src/routes/profile/(local_user)/password/change/+page.svelte +++ b/src/routes/profile/(local_user)/password/change/+page.svelte @@ -1,7 +1,7 @@ @@ -54,7 +54,7 @@ ]} > {#snippet nameDetail()} - + @ {#snippet title()} - + {$t('routes.profile.moderates')} - {/snippet} + {/snippet} ({ id: m.community.id, @@ -88,7 +88,7 @@ {/if} -{#if $userSettings.debugInfo} +{#if settings.debugInfo}
   {JSON.stringify(my_user, undefined, 4)}
 
diff --git a/src/routes/profile/media/+page.svelte b/src/routes/profile/media/+page.svelte index 39273339..2be45c0b 100644 --- a/src/routes/profile/media/+page.svelte +++ b/src/routes/profile/media/+page.svelte @@ -3,12 +3,12 @@ import Header from '$lib/components/ui/layout/pages/Header.svelte' import Pageination from '$lib/components/ui/Pageination.svelte' import { t } from '$lib/translations' - import { searchParam } from '$lib/util' + import { searchParam } from '$lib/util.svelte' import { flip } from 'svelte/animate' import PictrsImage from './PictrsImage.svelte' import { expoInOut, expoOut } from 'svelte/easing' - let { data = $bindable() } = $props(); + let { data = $bindable() } = $props()
{$t('routes.profile.media.title')}
@@ -22,9 +22,9 @@ data.images.findIndex( (i) => i.local_image.pictrs_delete_token == - image.local_image.pictrs_delete_token + image.local_image.pictrs_delete_token, ), - 1 + 1, ) }} /> diff --git a/src/routes/profile/media/+page.ts b/src/routes/profile/media/+page.ts index adc9fc39..95d9bedc 100644 --- a/src/routes/profile/media/+page.ts +++ b/src/routes/profile/media/+page.ts @@ -1,4 +1,4 @@ -import { profile } from '$lib/auth.js' +import { profile } from '$lib/auth.svelte' import { client } from '$lib/lemmy.js' import { error } from '@sveltejs/kit' import { get } from 'svelte/store' diff --git a/src/routes/profile/media/PictrsImage.svelte b/src/routes/profile/media/PictrsImage.svelte index 497e77e7..9ec45651 100644 --- a/src/routes/profile/media/PictrsImage.svelte +++ b/src/routes/profile/media/PictrsImage.svelte @@ -1,11 +1,11 @@
@@ -59,8 +59,8 @@ class="ml-auto" > {#snippet prefix()} - - {/snippet} + + {/snippet}
diff --git a/src/routes/profile/user/+page.ts b/src/routes/profile/user/+page.ts index 2219cf31..0f4bdef2 100644 --- a/src/routes/profile/user/+page.ts +++ b/src/routes/profile/user/+page.ts @@ -1,4 +1,4 @@ -import { profile } from '$lib/auth.js' +import { profile } from '$lib/auth.svelte' import { getClient } from '$lib/lemmy.js' import { getItemPublished } from '$lib/lemmy/item.js' import type { SortType } from 'lemmy-js-client' diff --git a/src/routes/saved/+page.svelte b/src/routes/saved/+page.svelte index b37eac6a..26577345 100644 --- a/src/routes/saved/+page.svelte +++ b/src/routes/saved/+page.svelte @@ -1,13 +1,13 @@

Constants

diff --git a/src/routes/util/placeholder/+page.svelte b/src/routes/util/placeholder/+page.svelte index 1a5461bf..24b66b7e 100644 --- a/src/routes/util/placeholder/+page.svelte +++ b/src/routes/util/placeholder/+page.svelte @@ -1,5 +1,5 @@