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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
310 changed files with 6435 additions and 4176 deletions

View file

@ -10,12 +10,20 @@
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
import { t } from 'svelte-i18n';
export let asset: AssetResponseDto;
export let onClose: () => void;
interface Props {
asset: AssetResponseDto;
onClose: () => void;
}
let imgElement: HTMLDivElement;
let { asset, onClose }: Props = $props();
let imgElement: HTMLDivElement | undefined = $state();
onMount(() => {
if (!imgElement) {
return;
}
imgElement.style.width = '100%';
});
@ -45,6 +53,10 @@
};
const handleSetProfilePicture = async () => {
if (!imgElement) {
return;
}
try {
const blob = await domtoimage.toBlob(imgElement);
if (await hasTransparentPixels(blob)) {
@ -79,7 +91,8 @@
<PhotoViewer bind:element={imgElement} {asset} />
</div>
</div>
<svelte:fragment slot="sticky-bottom">
<Button fullwidth on:click={handleSetProfilePicture}>{$t('set_as_profile_picture')}</Button>
</svelte:fragment>
{#snippet stickyBottom()}
<Button fullwidth onclick={handleSetProfilePicture}>{$t('set_as_profile_picture')}</Button>
{/snippet}
</FullScreenModal>