Update to svelte 5

This commit is contained in:
Pixeldrain-Server committed 2025-10-13 16:05:50 +02:00
1 parent f936e4c0f2
commit 6d89c5ddd9
129 files changed
+2443 -2180

No files matched your search

+10 -7
View File
@@ -1,11 +1,14 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { countries } from "country-data-list";
import { get_misc_vat_rate, put_user } from "lib/PixeldrainAPI";
import { payment_providers, type CheckoutState } from "./CheckoutLib";
import { loading_finish, loading_start } from "lib/Loading";
export let state: CheckoutState
let country_input = ""
let { status = $bindable() }: {
status: CheckoutState;
} = $props();
let country_input = $state("")
const set_country = async (e?: Event) => {
if (e !== undefined) {
@@ -21,7 +24,7 @@ const set_country = async (e?: Event) => {
// We always clear the provider field after picking a country, as providers
// vary per country. If we did not clear the provider then we may end up
// with an invalid combination
state.provider = null
status.provider = null
loading_start()
try {
@@ -29,8 +32,8 @@ const set_country = async (e?: Event) => {
await put_user({checkout_country: c.alpha3})
const vat_rate = await get_misc_vat_rate(c.alpha3)
state.vat = vat_rate.vat*100
state.country = c
status.vat = vat_rate.vat*100
status.country = c
} catch (err) {
alert(err)
} finally {
@@ -56,7 +59,7 @@ const format_country = (c: typeof countries.all[0]) => {
Please pick your country of residence
</div>
<div>
<form on:submit|preventDefault={set_country} class="country_form">
<form onsubmit={preventDefault(set_country)} class="country_form">
<div class="country_search">
<datalist id="country_picker">
{#each countries.all.filter(c => c.status === "assigned") as c}
@@ -74,7 +77,7 @@ const format_country = (c: typeof countries.all[0]) => {
Continue
</button>
</div>
<select bind:value={country_input} on:dblclick={set_country} style="padding: 0;" size="10">
<select bind:value={country_input} ondblclick={set_country} style="padding: 0;" size="10">
{#each countries.all.filter(c => c.status === "assigned") as c}
<option value={c.alpha2}>{format_country(c)}</option>
{/each}