Migrate to svelte 5

This commit is contained in:
kwaroran
2024-10-23 02:31:37 +09:00
parent e434c7ab96
commit c7330719ad
120 changed files with 2398 additions and 2033 deletions

View File

@@ -2,17 +2,17 @@
import { alertMd } from "src/ts/alert";
import { shareRealmCardData } from "src/ts/realm";
import { DataBase, downloadPreset } from "src/ts/storage/database";
import { CurrentCharacter, ShowRealmFrameStore } from "src/ts/stores";
import { selectedCharID, ShowRealmFrameStore } from "src/ts/stores";
import { sleep } from "src/ts/util";
import { onDestroy, onMount } from "svelte";
const close = () => {
$ShowRealmFrameStore = ''
}
let iframe: HTMLIFrameElement = null
let iframe: HTMLIFrameElement = $state(null)
const tk = $DataBase?.account?.token;
const id = $DataBase?.account?.id
let loadingStage = 0
let loadingStage = $state(0)
let pongGot = false
const pmfunc = (e:MessageEvent) => {
@@ -30,9 +30,9 @@
if($ShowRealmFrameStore.startsWith('preset') || $ShowRealmFrameStore.startsWith('module')){
//TODO, add preset edit
}
else if($CurrentCharacter.type === 'character'){
else if($DataBase.characters[$selectedCharID].type === 'character'){
loadingStage = 0
$CurrentCharacter.realmId = e.data.id
$DataBase.characters[$selectedCharID].realmId = e.data.id
}
close()
}
@@ -96,8 +96,8 @@
if($ShowRealmFrameStore.startsWith('preset') || $ShowRealmFrameStore.startsWith('module')){
//TODO, add preset edit
}
else if($CurrentCharacter.type === 'character' && $CurrentCharacter.realmId){
url += `&edit=${$CurrentCharacter.realmId}&edit-type=normal`
else if($DataBase.characters[$selectedCharID].type === 'character' && $DataBase.characters[$selectedCharID].realmId){
url += `&edit=${$DataBase.characters[$selectedCharID].realmId}&edit-type=normal`
}
url += '#noLayout'
return url
@@ -111,15 +111,15 @@
<div class="top-0 left-0 z-50 fixed w-full h-full flex flex-col justify-center items-center text-textcolor bg-white">
<div class="bg-darkbg border-b border-b-darkborderc w-full flex p-2">
<h1 class="text-2xl font-bold max-w-full overflow-hidden whitespace-nowrap text-ellipsis">Upload to Realm</h1>
<button class="text-textcolor text-lg hover:text-red-500 ml-auto" on:click={close}>&times;</button>
<button class="text-textcolor text-lg hover:text-red-500 ml-auto" onclick={close}>&times;</button>
</div>
{#if loadingStage < 1}
<div class="w-full flex justify-center items-center p-4 flex-1">
<div class="loadmove"/>
<div class="loadmove"></div>
</div>
{/if}
<iframe bind:this={iframe}
src={getUrl()}
title="upload" class="w-full flex-1" class:hidden={loadingStage < 1}
/>
></iframe>
</div>