chore(web): migration svelte 5 syntax (#13883)

This commit is contained in:
Alex
2024-11-14 08:43:25 -06:00
committed by GitHub
parent 9203a61709
commit 0b3742cf13
310 changed files with 6435 additions and 4176 deletions

View File

@@ -10,14 +10,13 @@
import { preferences } from '$lib/stores/user.store';
import Button from '../elements/buttons/button.svelte';
import { t } from 'svelte-i18n';
import SettingInputField, {
SettingInputFieldType,
} from '$lib/components/shared-components/settings/setting-input-field.svelte';
import SettingInputField from '$lib/components/shared-components/settings/setting-input-field.svelte';
import { ByteUnit, convertFromBytes, convertToBytes } from '$lib/utils/byte-units';
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
import { SettingInputFieldType } from '$lib/constants';
let archiveSize = convertFromBytes($preferences?.download?.archiveSize || 4, ByteUnit.GiB);
let includeEmbeddedVideos = $preferences?.download?.includeEmbeddedVideos || false;
let archiveSize = $state(convertFromBytes($preferences?.download?.archiveSize || 4, ByteUnit.GiB));
let includeEmbeddedVideos = $state($preferences?.download?.includeEmbeddedVideos || false);
const handleSave = async () => {
try {
@@ -36,16 +35,20 @@
handleError(error, $t('errors.unable_to_update_settings'));
}
};
const onsubmit = (event: Event) => {
event.preventDefault();
};
</script>
<section class="my-4">
<div in:fade={{ duration: 500 }}>
<form autocomplete="off" on:submit|preventDefault>
<form autocomplete="off" {onsubmit}>
<div class="ml-4 mt-4 flex flex-col gap-4">
<SettingInputField
inputType={SettingInputFieldType.NUMBER}
label={$t('archive_size')}
desc={$t('archive_size_description')}
description={$t('archive_size_description')}
bind:value={archiveSize}
/>
<SettingSwitch
@@ -54,7 +57,7 @@
bind:checked={includeEmbeddedVideos}
></SettingSwitch>
<div class="flex justify-end">
<Button type="submit" size="sm" on:click={() => handleSave()}>{$t('save')}</Button>
<Button type="submit" size="sm" onclick={() => handleSave()}>{$t('save')}</Button>
</div>
</div>
</form>