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

+12 -5
View File
@@ -1,4 +1,6 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { site, validateInstance } from '$lib/lemmy.js'
import { Button, Note, TextInput, toast } from 'mono-svelte'
import { MINIMUM_VERSION } from '$lib/version'
@@ -10,13 +12,18 @@
import { t } from '$lib/translations'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
export let ref: string = '/'
interface Props {
ref?: string;
children?: import('svelte').Snippet;
}
let form = {
let { ref = '/', children }: Props = $props();
let form = $state({
instance: '',
username: `${$t('account.guest')} ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
loading: false,
}
})
async function addGuest() {
form.loading = true
@@ -51,9 +58,9 @@
</script>
<div class="max-w-xl w-full mx-auto h-max my-auto">
<form on:submit|preventDefault={addGuest} class="flex flex-col gap-5">
<form onsubmit={preventDefault(addGuest)} class="flex flex-col gap-5">
<div class="flex flex-col gap-2">
<slot />
{@render children?.()}
<Header>{$t('account.addGuest')}</Header>
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
<Note>