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,19 +10,24 @@
import LinkButton from '../elements/buttons/link-button.svelte';
import DateInput from '../elements/date-input.svelte';
export let settings: MapSettings;
export let onClose: () => void;
export let onSave: (settings: MapSettings) => void;
interface Props {
settings: MapSettings;
onClose: () => void;
onSave: (settings: MapSettings) => void;
}
let customDateRange = !!settings.dateAfter || !!settings.dateBefore;
let { settings = $bindable(), onClose, onSave }: Props = $props();
let customDateRange = $state(!!settings.dateAfter || !!settings.dateBefore);
const onsubmit = (event: Event) => {
event.preventDefault();
onSave(settings);
};
</script>
<FullScreenModal title={$t('map_settings')} {onClose}>
<form
on:submit|preventDefault={() => onSave(settings)}
class="flex flex-col gap-4 text-immich-primary dark:text-immich-dark-primary"
id="map-settings-form"
>
<form {onsubmit} class="flex flex-col gap-4 text-immich-primary dark:text-immich-dark-primary" id="map-settings-form">
<SettingSwitch title={$t('allow_dark_mode')} bind:checked={settings.allowDarkMode} />
<SettingSwitch title={$t('only_favorites')} bind:checked={settings.onlyFavorites} />
<SettingSwitch title={$t('include_archived')} bind:checked={settings.includeArchived} />
@@ -46,7 +51,7 @@
</div>
<div class="flex justify-center text-xs">
<LinkButton
on:click={() => {
onclick={() => {
customDateRange = false;
settings.dateAfter = '';
settings.dateBefore = '';
@@ -91,7 +96,7 @@
/>
<div class="text-xs">
<LinkButton
on:click={() => {
onclick={() => {
customDateRange = true;
settings.relativeDate = '';
}}
@@ -102,8 +107,9 @@
</div>
{/if}
</form>
<svelte:fragment slot="sticky-bottom">
<Button color="gray" size="sm" fullwidth on:click={onClose}>{$t('cancel')}</Button>
{#snippet stickyBottom()}
<Button color="gray" size="sm" fullwidth onclick={onClose}>{$t('cancel')}</Button>
<Button type="submit" size="sm" fullwidth form="map-settings-form">{$t('save')}</Button>
</svelte:fragment>
{/snippet}
</FullScreenModal>