diff --git a/bun.lockb b/bun.lockb index 6480ec87..19866bfb 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.js b/eslint.config.js index fd8ed3c7..5fb6b567 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -23,11 +23,11 @@ export default ts.config( 'no-undef': 'off', // sveltekit should make this native then 'svelte/valid-prop-names-in-kit-pages': 'off', - 'svelte/no-at-html-tags': 'warn', - '@typescript-eslint/no-unsafe-function-type': 'warn', + 'svelte/no-at-html-tags': 'off', + '@typescript-eslint/no-unsafe-function-type': 'off', 'svelte/require-each-key': 'off', - 'svelte/prefer-writable-derived': 'warn', - 'no-console': 'warn', + 'svelte/prefer-writable-derived': 'off', + 'no-console': 'off', }, }, { diff --git a/package.json b/package.json index cb3d499c..621923ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "photon-lemmy", "version": "2.0.0", + "license": "AGPL-3.0-only", "devDependencies": { "@dicebear/core": "^8.0.1", "@dicebear/initials": "^8.0.1", @@ -16,23 +17,23 @@ "@tailwindcss/postcss": "^4.1.8", "@types/nprogress": "^0.2.0", "@types/ua-parser-js": "^0.7.39", + "@xylightdev/svelte-hero-icons": "^2.2.4", "eslint": "^9.28.0", - "eslint-plugin-svelte": "^3.9.1", + "eslint-plugin-svelte": "^3.11.0", "jsdom": "^22.1.0", "lemmy-js-client": "0.19.11-donation-dialog.1", "linkify-it": "^5.0.0", "marked": "7.0.5", - "marked-linkify-it": "^3.1.10", + "marked-linkify-it": "^3.1.13", "nprogress": "^0.2.0", "postcss": "^8.4.30", "prettier": "^3.3.3", "prettier-plugin-svelte": "^3.2.7", - "svelte": "^5.34.8", + "svelte": "^5.37.3", "svelte-adapter-bun-next": "^1.0.3", "svelte-check": "^4.0.0", "svelte-floating-ui": "^1.5.9", "svelte-focus-trap": "^1.2.0", - "svelte-hero-icons": "^5.2.0", "svelte-infinite-scroll": "^2.0.1", "svelte-markdown": "^0.4.1", "sveltekit-i18n": "^2.4.2", @@ -44,7 +45,7 @@ "vite": "^5.4.14" }, "overrides": { - "svelte": "^5.34.8" + "svelte": "^5.37.3" }, "private": true, "scripts": { diff --git a/src/lib/components/lemmy/comment/comments.svelte.ts b/src/lib/components/lemmy/comment/comments.svelte.ts index 9a8b4aed..1234938e 100644 --- a/src/lib/components/lemmy/comment/comments.svelte.ts +++ b/src/lib/components/lemmy/comment/comments.svelte.ts @@ -1,4 +1,5 @@ import type { Comment, CommentView } from 'lemmy-js-client' +import { SvelteMap } from 'svelte/reactivity' export interface CommentNodeI { comment_view: CommentView @@ -28,7 +29,7 @@ export function buildCommentsTree( baseDepth: number = 0, filter: (c: CommentView) => boolean = () => true, ): CommentNodeI[] { - const map = new Map() + const map = new SvelteMap() let min_depth = Number.MAX_VALUE for (const comment_view of comments) { diff --git a/src/lib/components/lemmy/moderation/ModerationMenu.svelte b/src/lib/components/lemmy/moderation/ModerationMenu.svelte index ee02024e..ea56015a 100644 --- a/src/lib/components/lemmy/moderation/ModerationMenu.svelte +++ b/src/lib/components/lemmy/moderation/ModerationMenu.svelte @@ -2,9 +2,11 @@ import { profile } from '$lib/auth.svelte.js' import { t } from '$lib/i18n/translations' import { getClient } from '$lib/lemmy.svelte' + import { errorMessage } from '$lib/lemmy/error' import { isCommentView, isPostView } from '$lib/lemmy/item.js' import type { CommentView, PostView } from 'lemmy-js-client' - import { Button, Menu, MenuButton, MenuDivider, toast } from 'mono-svelte' + import { Menu, MenuButton, MenuDivider, toast } from 'mono-svelte' + import type { Snippet } from 'svelte' import { ArrowsUpDown, Fire, @@ -17,23 +19,19 @@ Trash, } from 'svelte-hero-icons' import { amMod, ban, isAdmin, remove, viewVotes } from './moderation' - import ShieldIcon from './ShieldIcon.svelte' - import { errorMessage } from '$lib/lemmy/error' interface Props { item: PostView | CommentView + target: Snippet<[boolean]> } - let { item = $bindable(), ...rest }: Props = $props() + let { item = $bindable(), target: passedTarget }: Props = $props() - let locking = $state(false) - let pinning = $state(false) - - let acting = $derived(locking || pinning) + let acting = $state(false) async function lock(lock: boolean) { if (!profile.current?.jwt || !isPostView(item)) return - locking = true + acting = true try { await getClient().lockPost({ @@ -49,13 +47,13 @@ }) } - locking = false + acting = false } async function pin(pinned: boolean, toInstance: boolean = false) { if (!profile.current?.jwt || !isPostView(item)) return - pinning = true + acting = true try { await getClient().featurePost({ @@ -72,21 +70,13 @@ }) } - pinning = false + acting = false } {#snippet target()} - + {@render passedTarget(acting)} {/snippet} {#if (profile.current?.user && amMod(profile.current.user, item.community)) || (profile.current?.user && isAdmin(profile.current.user))} @@ -99,8 +89,7 @@ lock(!item.post.locked)} - loading={locking} - disabled={locking} + loading={acting} > {#snippet prefix()} @@ -112,8 +101,7 @@ color="success-subtle" onclick={() => pin(isPostView(item) ? !item.post.featured_community : false)} - loading={pinning} - disabled={pinning} + loading={acting} >
- import { goto } from '$app/navigation' - import { profile } from '$lib/auth.svelte.js' - import { - amMod, - isAdmin, - report, - } from '$lib/components/lemmy/moderation/moderation.js' - import ModerationMenu from '$lib/components/lemmy/moderation/ModerationMenu.svelte' - import TextProps from '$lib/components/ui/text/TextProps.svelte' - import { publishedToDate } from '$lib/components/util/date' - import FormattedNumber from '$lib/components/util/FormattedNumber.svelte' - import { t } from '$lib/i18n/translations' - import { instance } from '$lib/instance.svelte' - import { site } from '$lib/lemmy.svelte.js' - import { deleteItem, markAsRead, save } from '$lib/lemmy/contentview.js' - import { communityLink, userLink } from '$lib/lemmy/generic' - import { setSessionStorage } from '$lib/session.js' - import { settings, type View } from '$lib/settings.svelte.js' - import { instanceToURL } from '$lib/util.svelte' - import { feature } from '$lib/version' - import type { PostView } from 'lemmy-js-client' - import { - Button, - Menu, - MenuButton, - MenuDivider, - Modal, - Spinner, - toast, - } from 'mono-svelte' - import { - ArrowTopRightOnSquare, - Bookmark, - BookmarkSlash, - BugAnt, - ChatBubbleOvalLeft, - ChatBubbleOvalLeftEllipsis, - EllipsisHorizontal, - Eye, - EyeSlash, - Flag, - GlobeAmericas, - Icon, - MapPin, - Newspaper, - PencilSquare, - Share, - Trash, - UserCircle, - XMark, - } from 'svelte-hero-icons' - import { hidePost, postLink } from './helpers' - import PostVote from './PostVote.svelte' - - let editing = $state(false) - let saving = $state(false) - - let localShare = $state(false) - - interface Props { - post: PostView - view?: View - debug?: boolean - style?: string - onedit?: (post: PostView) => void - onhide?: (hide: boolean) => void - } - - let { - post = $bindable(), - view = 'cozy', - debug = $bindable(false), - style = '', - onedit, - onhide, - }: Props = $props() - let buttonHeight = $derived(view == 'compact' ? 'h-7' : 'h-8') - let buttonSquare = $derived(view == 'compact' ? 'w-7 h-7' : 'w-8 h-8') - - -{#if editing} - - {#snippet customTitle()} -

Editing post

- {/snippet} - {#await import('./form/PostForm.svelte')} -
- -
- {:then { default: PostForm }} - { - editing = false - post = e - onedit?.(e) - }} - > - {#snippet formtitle()} - - {/snippet} - - {/await} -
-{/if} - -
- - - -
- {#if settings.debugInfo} - {#if debug} - {#await import('$lib/components/util/debug/DebugObject.svelte') then { default: DebugObject }} - - {/await} - {/if} - - {/if} - {#if profile.current?.user && (amMod(profile.current.user, post.community) || isAdmin(profile.current.user))} - - {/if} - - {#if profile.current?.jwt} - - {/if} - - - {#snippet target()} - - {/snippet} - {$t('post.actions.more.creator')} - - {#snippet prefix()} - - {/snippet} - - {post.creator.name} - - - - {#snippet prefix()} - - {/snippet} - - {post.community.title} - - - - {$t('post.actions.more.actions')} - - {#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id} - (editing = true)}> - {#snippet prefix()} - - {/snippet} - {$t('post.actions.more.edit')} - - {/if} - {#if profile.current?.jwt} - { - if (profile.current?.jwt) - post.read = await markAsRead(post.post, !post.read) - }} - > - {#snippet prefix()} - - {/snippet} - {post.read - ? $t('post.actions.more.markUnread') - : $t('post.actions.more.markRead')} - - {/if} - { - if (navigator.share) - navigator.share?.({ - url: localShare - ? `${instanceToURL(instance.data)}/post/${post.post.id}` - : post.post.ap_id, - }) - else - navigator.clipboard.writeText( - localShare - ? `${instanceToURL(instance.data)}/post/${post.post.id}` - : post.post.ap_id, - ) - toast({ content: $t('toast.copied') }) - }} - class="flex-1 py-0!" - > - {#snippet prefix()} - - {/snippet} - {$t('post.actions.more.share')} -
- {#if !post.post.local} -
- - -
- {/if} -
- {#if profile.current?.jwt} - { - setSessionStorage('postDraft', { - body: `${ - settings.crosspostOriginalLink - ? `cross-posted from: ${post.post.ap_id}` - : `` - }\n${ - post.post.body - ? '>' + post.post.body.split('\n').join('\n> ') - : '' - }`, - url: post.post.url, - title: post.post.name, - loading: false, - nsfw: post.post.nsfw, - community: null, - image: null, - }) - - goto('/create/post?crosspost=true') - }} - > - {#snippet prefix()} - - {/snippet} - {$t('post.actions.more.crosspost')} - - {#if profile.current.user && post.creator.id == profile.current.user.local_user_view.person.id} - { - if (profile.current?.jwt) - post.post.deleted = await deleteItem(post, !post.post.deleted) - }} - color="danger-subtle" - > - {#snippet prefix()} - - {/snippet} - {post.post.deleted - ? $t('post.actions.more.restore') - : $t('post.actions.more.delete')} - - {/if} - {#if profile.current.user?.local_user_view.person.id != post.creator.id} - {#if feature('hidePosts', site.data?.version)} - { - if (!profile.current?.jwt) return - const hidden = await hidePost( - post.post.id, - !post.hidden, - profile.current?.jwt, - ) - post.hidden = hidden - if (hidden) onhide?.(hidden) - }} - color="danger-subtle" - > - {#snippet prefix()} - - {/snippet} - {post.hidden - ? $t('post.actions.more.unhide') - : $t('post.actions.more.hide')} - - {/if} - report(post)} color="danger-subtle"> - {#snippet prefix()} - - {/snippet} - {$t('moderation.report')} - - {/if} - {/if} -
-
diff --git a/src/lib/components/lemmy/post/PostItem.svelte b/src/lib/components/lemmy/post/PostItem.svelte index d8e5bc18..91613a6a 100644 --- a/src/lib/components/lemmy/post/PostItem.svelte +++ b/src/lib/components/lemmy/post/PostItem.svelte @@ -6,7 +6,7 @@ post: PostView } - let { post } = $props() + let { post }: Props = $props() diff --git a/src/lib/components/lemmy/post/PostMeta.svelte b/src/lib/components/lemmy/post/PostMeta.svelte index 5e83fde4..91fb680c 100644 --- a/src/lib/components/lemmy/post/PostMeta.svelte +++ b/src/lib/components/lemmy/post/PostMeta.svelte @@ -64,12 +64,11 @@ Megaphone, PaperAirplane, Pencil, + ShieldCheck, Tag, Trash, type IconSource, } from 'svelte-hero-icons' - import CommunityHeader from '../community/CommunityHeader.svelte' - import ShieldIcon from '../moderation/ShieldIcon.svelte' import Material from 'mono-svelte/materials/Material.svelte' interface Props { @@ -144,7 +143,7 @@ {style} > {#if showCommunity && community} - + {#snippet target()} +
+ {#if settings.debugInfo} + {#if debug} + {#await import('$lib/components/util/debug/DebugObject.svelte') then { default: DebugObject }} + + {/await} + {/if} + + {/if} + {#if profile.current?.user && (amMod(profile.current.user, post.community) || isAdmin(profile.current.user))} + {#await import('$lib/components/lemmy/moderation/ModerationMenu.svelte') then { default: ModerationMenu }} + + {#snippet target(acting)} + + {/snippet} + + {/await} + {/if} + + {#if profile.current?.jwt} + + {/if} + + + {#snippet target()} + + {/snippet} + {#snippet children(open)} + {#if open} + {#await import('./PostActionsMenu.svelte') then { default: PostActionsMenu }} + + {/await} + {/if} + {/snippet} + + diff --git a/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte b/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte new file mode 100644 index 00000000..c49a07ea --- /dev/null +++ b/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte @@ -0,0 +1,202 @@ + + +{$t('post.actions.more.creator')} + + {#snippet prefix()} + + {/snippet} + + {post.creator.name} + + + + {#snippet prefix()} + + {/snippet} + + {post.community.title} + + + + {$t('post.actions.more.actions')} + +{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id} + (editing = true)}> + {#snippet prefix()} + + {/snippet} + {$t('post.actions.more.edit')} + +{/if} +{#if profile.current?.jwt} + { + if (profile.current?.jwt) + post.read = await markAsRead(post.post, !post.read) + }} + > + {#snippet prefix()} + + {/snippet} + {post.read + ? $t('post.actions.more.markUnread') + : $t('post.actions.more.markRead')} + +{/if} + { + if (navigator.share) + navigator.share?.({ + url: localShare + ? `${instanceToURL(profile.current.instance)}/post/${post.post.id}` + : post.post.ap_id, + }) + else + navigator.clipboard.writeText( + localShare + ? `${instanceToURL(profile.current.instance)}/post/${post.post.id}` + : post.post.ap_id, + ) + toast({ content: $t('toast.copied') }) + }} + class="flex-1 py-0!" +> + {#snippet prefix()} + + {/snippet} + {$t('post.actions.more.share')} +
+ {#if !post.post.local} +
+ + +
+ {/if} +
+{#if profile.current?.jwt} + { + setSessionStorage('postDraft', { + body: `${ + settings.crosspostOriginalLink + ? `cross-posted from: ${post.post.ap_id}` + : `` + }\n${ + post.post.body ? '>' + post.post.body.split('\n').join('\n> ') : '' + }`, + url: post.post.url, + title: post.post.name, + loading: false, + nsfw: post.post.nsfw, + community: null, + image: null, + }) + + goto('/create/post?crosspost=true') + }} + > + {#snippet prefix()} + + {/snippet} + {$t('post.actions.more.crosspost')} + + {#if profile.current.user && post.creator.id == profile.current.user.local_user_view.person.id} + { + if (profile.current?.jwt) + post.post.deleted = await deleteItem(post, !post.post.deleted) + }} + color="danger-subtle" + > + {#snippet prefix()} + + {/snippet} + {post.post.deleted + ? $t('post.actions.more.restore') + : $t('post.actions.more.delete')} + + {/if} + {#if profile.current.user?.local_user_view.person.id != post.creator.id} + { + if (!profile.current?.jwt) return + const hidden = await hidePost( + post.post.id, + !post.hidden, + profile.current?.jwt, + ) + post.hidden = hidden + if (hidden) onhide?.(hidden) + }} + color="danger-subtle" + > + {#snippet prefix()} + + {/snippet} + {post.hidden + ? $t('post.actions.more.unhide') + : $t('post.actions.more.hide')} + + report(post)} color="danger-subtle"> + {#snippet prefix()} + + {/snippet} + {$t('moderation.report')} + + {/if} +{/if} diff --git a/src/lib/components/lemmy/post/feed/crosspost.svelte.ts b/src/lib/components/lemmy/post/feed/crosspost.svelte.ts index e81431e7..f900203b 100644 --- a/src/lib/components/lemmy/post/feed/crosspost.svelte.ts +++ b/src/lib/components/lemmy/post/feed/crosspost.svelte.ts @@ -1,5 +1,6 @@ import { settings } from '$lib/settings.svelte' import type { PostView } from 'lemmy-js-client' +import { SvelteMap, SvelteSet } from 'svelte/reactivity' export type PostViewWithCrossposts = PostView & { withCrossposts: true @@ -10,12 +11,12 @@ export type PostViewWithoutCrossposts = PostView & { withCrossposts?: false } export const combineCrossposts = ( posts: PostView[], ): (PostViewWithCrossposts | PostViewWithoutCrossposts)[] => { - const urlMap = new Map< + const urlMap = new SvelteMap< string, PostViewWithCrossposts | PostViewWithoutCrossposts >() const results: (PostViewWithCrossposts | PostViewWithoutCrossposts)[] = [] - const seenUrls = new Set() + const seenUrls = new SvelteSet() posts?.forEach(post => { if ( diff --git a/src/lib/components/lemmy/post/media/PostMediaCompact.svelte b/src/lib/components/lemmy/post/media/PostMediaCompact.svelte index 1a17c10e..eeb105fc 100644 --- a/src/lib/components/lemmy/post/media/PostMediaCompact.svelte +++ b/src/lib/components/lemmy/post/media/PostMediaCompact.svelte @@ -60,9 +60,7 @@ this={!settings.expandImages || type != 'image' ? 'a' : 'button'} href={postLink(post)} onclick={() => { - if (type == 'image') { - showImage(bestImageURL(post, false, -1)) - } + if (type == 'image') showImage(bestImageURL(post, false, -1)) }} role="button" tabindex="0" @@ -109,7 +107,7 @@
@@ -138,8 +136,8 @@
{ if (href?.startsWith('?')) { - const current = new URLSearchParams(pageData.url.searchParams) - const newParams = new URLSearchParams(href) + const current = new SvelteURLSearchParams(pageData.url.searchParams) + const newParams = new SvelteURLSearchParams(href) current.delete(Array.from(newParams.keys())[0]) current.append( diff --git a/src/lib/components/ui/navbar/Navbar.svelte b/src/lib/components/ui/navbar/Navbar.svelte index 80fd4724..88097aae 100644 --- a/src/lib/components/ui/navbar/Navbar.svelte +++ b/src/lib/components/ui/navbar/Navbar.svelte @@ -10,6 +10,7 @@ import { site } from '$lib/lemmy.svelte.js' import { Badge, Menu, MenuButton, MenuDivider, Spinner } from 'mono-svelte' import { + Bars3, Bell, GlobeAlt, Icon, @@ -23,9 +24,8 @@ } from 'svelte-hero-icons' import type { ClassValue } from 'svelte/elements' import Logo from '../Logo.svelte' - import NavButton from './NavButton.svelte' - import Profile from './Profile.svelte' import CommandsWrapper from './commands/CommandsWrapper.svelte' + import NavButton from './NavButton.svelte' let promptOpen: boolean = $state(false) interface Props { @@ -197,6 +197,38 @@ {/if}
- + + {#snippet target()} + + {/snippet} + {#snippet children(open)} + {#if open} + {#await import('./Profile.svelte') then { default: Profile }} + + {/await} + {/if} + {/snippet} + diff --git a/src/lib/components/ui/navbar/Profile.svelte b/src/lib/components/ui/navbar/Profile.svelte index 3c9332ef..0c7dae06 100644 --- a/src/lib/components/ui/navbar/Profile.svelte +++ b/src/lib/components/ui/navbar/Profile.svelte @@ -9,7 +9,6 @@ import { Badge, Button, - Menu, MenuButton, MenuDivider, Modal, @@ -18,10 +17,8 @@ Spinner, toast, } from 'mono-svelte' - import type { Placement } from 'svelte-floating-ui/core' import { ArrowLeftOnRectangle, - Bars3, Bookmark, BugAnt, CodeBracketSquare, @@ -37,16 +34,8 @@ UserCircle, UserGroup, } from 'svelte-hero-icons' - import Avatar from '../Avatar.svelte' let showInstance = $state(false) - - interface Props { - buttonClass?: string - placement?: Placement - } - - let { buttonClass = '', ...rest }: Props = $props() {#if showInstance} @@ -64,158 +53,128 @@ {/if} - - {#snippet target()} - +{$t('nav.menu.label')} +{#if profile.current?.jwt} + + {#snippet prefix()} + + {/snippet} + {$t('profile.profile')} + + + {#snippet prefix()} + + {/snippet} + {$t('profile.inbox')} + {#if $notifications.inbox > 0} + + {$notifications.inbox > 99 ? '∞' : $notifications.inbox} + + {/if} + + + {#snippet prefix()} + + {/snippet} + {$t('profile.saved')} + +{:else} + + {#snippet prefix()} + + {/snippet} + {$t('account.login')} + + + {#snippet prefix()} + + {/snippet} + {$t('account.signup')} + +{/if} + + {#snippet prefix()} + {/snippet} - {$t('nav.menu.label')} - {#if profile.current?.jwt} - - {#snippet prefix()} - - {/snippet} - {$t('profile.profile')} - - - {#snippet prefix()} - - {/snippet} - {$t('profile.inbox')} - {#if $notifications.inbox > 0} - - {$notifications.inbox > 99 ? '∞' : $notifications.inbox} - - {/if} - - - {#snippet prefix()} - - {/snippet} - {$t('profile.saved')} - - {:else} - - {#snippet prefix()} - - {/snippet} - {$t('account.login')} - - - {#snippet prefix()} - - {/snippet} - {$t('account.signup')} - - {/if} - + {$t('account.accounts')} + +{$t('nav.menu.app')} + + {#snippet prefix()} + + {/snippet} + {$t('nav.menu.settings')} + + e.stopPropagation()}> + {#snippet prefix()} + + {/snippet} + {$t('nav.menu.colorscheme.label')} + + + + {#snippet prefix()} + + {/snippet} + {$t('nav.menu.theme')} + +{#if settings.debugInfo} + {#snippet prefix()} - + {/snippet} - {$t('account.accounts')} + Debug - {$t('nav.menu.app')} - - {#snippet prefix()} - - {/snippet} - {$t('nav.menu.settings')} - - e.stopPropagation()}> - {#snippet prefix()} - - {/snippet} - {$t('nav.menu.colorscheme.label')} - - - - {#snippet prefix()} - - {/snippet} - {$t('nav.menu.theme')} - - {#if settings.debugInfo} - - {#snippet prefix()} - - {/snippet} - Debug - - {/if} - -
  • -
    -
    - -
    - - + {__VERSION__} +
    -
  • -
    + + + + diff --git a/src/lib/components/ui/navbar/commands/actions.svelte.ts b/src/lib/components/ui/navbar/commands/actions.svelte.ts index 57f7321d..31b3243a 100644 --- a/src/lib/components/ui/navbar/commands/actions.svelte.ts +++ b/src/lib/components/ui/navbar/commands/actions.svelte.ts @@ -45,6 +45,7 @@ import { ViewColumns, type IconSource, } from 'svelte-hero-icons' +import { SvelteURL } from 'svelte/reactivity' export interface Group { name: string @@ -411,7 +412,7 @@ export function getGroups( f.community.name, f.community.actor_id, )}`, - detail: new URL(f.community.actor_id).hostname, + detail: new SvelteURL(f.community.actor_id).hostname, })) ?? [], }, ] diff --git a/src/lib/components/ui/sidebar/SidebarButton.svelte b/src/lib/components/ui/sidebar/SidebarButton.svelte index 4f87e07c..541dfe60 100644 --- a/src/lib/components/ui/sidebar/SidebarButton.svelte +++ b/src/lib/components/ui/sidebar/SidebarButton.svelte @@ -7,7 +7,6 @@ interface Props extends ButtonProps { href?: string | undefined icon?: IconSource | undefined - selected?: boolean class?: string customIcon?: import('svelte').Snippet<[{ selected: boolean }]> children?: import('svelte').Snippet @@ -17,7 +16,6 @@ let { href = undefined, icon = undefined, - selected = $bindable(false), class: clazz = '', customIcon, children, @@ -25,11 +23,7 @@ ...rest }: Props = $props() - $effect(() => { - if (href != undefined) { - selected = page.url.pathname == href - } - }) + let selected = $derived(page.url.pathname == href) diff --git a/src/routes/inbox/messages/+page.svelte b/src/routes/inbox/messages/+page.svelte index 2deaecd2..4dab47b8 100644 --- a/src/routes/inbox/messages/+page.svelte +++ b/src/routes/inbox/messages/+page.svelte @@ -16,6 +16,7 @@ import { Button, Modal } from 'mono-svelte' import { ChatBubbleOvalLeftEllipsis, Icon, Inbox } from 'svelte-hero-icons' import { expoOut } from 'svelte/easing' + import { SvelteSet } from 'svelte/reactivity' import { fly } from 'svelte/transition' interface ConversationPreview { @@ -34,7 +35,7 @@ } function filterDuplicates(array: T[], predicate: (item: T) => K): T[] { - const seen = new Set() + const seen = new SvelteSet() return array.filter(element => { const value = predicate(element) if (seen.has(value)) { diff --git a/src/routes/post/[instance]/[id=integer]/+page.svelte b/src/routes/post/[instance]/[id=integer]/+page.svelte index 96745ed7..fc4f740d 100644 --- a/src/routes/post/[instance]/[id=integer]/+page.svelte +++ b/src/routes/post/[instance]/[id=integer]/+page.svelte @@ -4,7 +4,7 @@ import { mediaType } from '$lib/components/lemmy/post/helpers.js' import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte' import Post from '$lib/components/lemmy/post/Post.svelte' - import PostActions from '$lib/components/lemmy/post/PostActions.svelte' + import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte' import PostMeta, { parseTags, } from '$lib/components/lemmy/post/PostMeta.svelte' diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index 39201000..d7f19ed9 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -230,18 +230,16 @@ {#if env.PUBLIC_XYLIGHT_MODE} {#snippet title()} - + {$t('nav.menu.donate')} {/snippet} {#snippet description()} -

    - {$t('settings.donate.description')} -

    + {$t('settings.donate.description')} {/snippet}