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

+43 -27
View File
@@ -22,12 +22,21 @@
import { userSettings } from '$lib/settings'
import { optimizeImageURL } from './post/helpers'
export let site: SiteView
export let taglines: Tagline[] | undefined = undefined
export let admins: PersonView[] | undefined = undefined
export let version: string | undefined = undefined
let clazz: string = ''
export { clazz as class }
interface Props {
site: SiteView
taglines?: Tagline[] | undefined
admins?: PersonView[] | undefined
version?: string | undefined
class?: string
}
let {
site,
taglines = undefined,
admins = undefined,
version = undefined,
class: clazz = '',
}: Props = $props()
</script>
<StickyCard class="w-full {clazz} text-slate-600 dark:text-zinc-400">
@@ -45,13 +54,14 @@
</div>
{/if}
<Entity name={site.site.name} label={new URL(site.site.actor_id).hostname}>
<Avatar
width={32}
url={site.site.icon}
alt={site.site.name}
circle={false}
slot="icon"
/>
{#snippet customIcon()}
<Avatar
width={32}
url={site.site.icon}
alt={site.site.name}
circle={false}
/>
{/snippet}
</Entity>
<div class="flex flex-row gap-1 !border-0">
<Button
@@ -91,21 +101,25 @@
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
<Expandable bind:open={$userSettings.expand.about}>
<span class="flex items-center gap-1 py-1 px-2" slot="title">
<Icon src={InformationCircle} size="16" mini />
{$t('cards.site.about')}
</span>
{#snippet title()}
<span class="flex items-center gap-1 py-1 px-2">
<Icon src={InformationCircle} size="16" mini />
{$t('cards.site.about')}
</span>
{/snippet}
<Markdown source={site.site.description} />
<div class="my-4" />
<div class="my-4"></div>
<Markdown source={site.site.sidebar} />
</Expandable>
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
<Expandable bind:open={$userSettings.expand.stats}>
<span class="flex items-center gap-1 py-1 px-2" slot="title">
<Icon src={ChartBar} size="16" mini />
{$t('cards.site.stats')}
</span>
{#snippet title()}
<span class="flex items-center gap-1 py-1 px-2">
<Icon src={ChartBar} size="16" mini />
{$t('cards.site.stats')}
</span>
{/snippet}
<div class="flex flex-row gap-4 flex-wrap">
<LabelStat
label={$t('content.users')}
@@ -128,10 +142,12 @@
{#if admins}
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
<Expandable bind:open={$userSettings.expand.team}>
<span class="flex items-center gap-1 py-1 px-2" slot="title">
<Icon src={UserGroup} size="16" mini />
{$t('cards.site.admins')}
</span>
{#snippet title()}
<span class="flex items-center gap-1 py-1 px-2">
<Icon src={UserGroup} size="16" mini />
{$t('cards.site.admins')}
</span>
{/snippet}
<ItemList
items={admins.map((a) => ({
id: a.person.id,
@@ -146,7 +162,7 @@
{#if version}
<div class="w-max">
<Badge title="Lemmy version">
<Badge label="Lemmy version">
<Icon src={ServerStack} micro size="14" />
{version}
</Badge>