migrate: convert most components to svelte 5

This commit is contained in:
Xylight committed 2024-10-25 19:33:27 -07:00
1 parent d670f39f0a
commit 10ef4123da
225 files changed
+5441 -3341

No files matched your search

@@ -14,19 +14,25 @@
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
import { t } from '$lib/translations'
export let item: PostView | CommentView
interface Props {
item: PostView | CommentView
[key: string]: any
}
let { item = $bindable(), ...rest }: Props = $props()
</script>
<Menu placement="bottom" class="top-0 h-[26px] w-[26px] ">
<Button
class="w-[26px] h-[26px] hover:!text-green-500 dark:text-zinc-400 text-slate-600"
size="square-md"
slot="target"
color="tertiary"
{...$$restProps}
>
<ShieldIcon filled width={14} />
</Button>
{#snippet target()}
<Button
class="w-[26px] h-[26px] hover:!text-green-500 dark:text-zinc-400 text-slate-600"
size="square-md"
color="tertiary"
{...rest}
>
<ShieldIcon filled width={14} />
</Button>
{/snippet}
{#if ($profile?.user && amMod($profile.user, item.community)) || ($profile?.user && isAdmin($profile.user))}
<MenuDivider>
{#if !item.community.local && !amMod($profile.user, item.community)}
@@ -36,7 +42,9 @@
{/if}
</MenuDivider>
<MenuButton color="danger-subtle" on:click={() => remove(item)}>
<Icon src={Trash} size="16" mini slot="prefix" />
{#snippet prefix()}
<Icon src={Trash} size="16" mini />
{/snippet}
{#if isCommentView(item)}
{item.comment.removed
? $t('moderation.restore')
@@ -52,7 +60,9 @@
on:click={() =>
ban(item.creator_banned_from_community, item.creator, item.community)}
>
<Icon src={ShieldExclamation} size="16" mini slot="prefix" />
{#snippet prefix()}
<Icon src={ShieldExclamation} size="16" mini />
{/snippet}
{item.creator_banned_from_community
? $t('moderation.ban.unbanFromCommunity')
: $t('moderation.ban.banFromCommunity')}
@@ -67,12 +77,14 @@
await feature(
!item.comment.distinguished,
item.comment,
$profile.jwt
$profile.jwt,
)
).comment_view.comment
}}
>
<Icon src={Megaphone} size="16" micro slot="prefix" />
{#snippet prefix()}
<Icon src={Megaphone} size="16" micro />
{/snippet}
{item.comment.distinguished
? $t('moderation.unfeature')
: $t('moderation.feature')}
@@ -83,7 +95,9 @@
{#if $profile?.user && isAdmin($profile.user)}
<MenuDivider>{$t('admin.label')}</MenuDivider>
<MenuButton color="danger-subtle" on:click={() => remove(item, true)}>
<Icon src={Fire} size="16" mini slot="prefix" />
{#snippet prefix()}
<Icon src={Fire} size="16" mini />
{/snippet}
{$t('admin.purge')}
</MenuButton>
{/if}