mirror of https://github.com/hykilpikonna/AquaDX
[-] Remove unnecessary showOpenFilePicker library
parent
2719522e07
commit
88702085bb
|
@ -40,7 +40,6 @@
|
|||
"lxgw-wenkai-lite-webfont": "^1.7.0",
|
||||
"modern-normalize": "^3.0.1",
|
||||
"moment": "^2.30.1",
|
||||
"show-open-file-picker": "^0.2.2"
|
||||
},
|
||||
"packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf"
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
let mapRank: number | undefined = meta?.notes?.[mapData[1] === 10 ? 0 : mapData[1]]?.lv
|
||||
const rounding = useLocalStorage("rounding", true);
|
||||
|
||||
console.log(rounding.value)
|
||||
|
||||
let gameIndexMap = {
|
||||
'mai2': 3,
|
||||
'ongeki': 2,
|
||||
|
|
|
@ -113,7 +113,7 @@ export const EN_REF_HOME = {
|
|||
'home.setup.ask': 'If you have any questions, please ask in our',
|
||||
'home.setup.support': 'server',
|
||||
'home.setup.keychip-tips': 'This is your unique keychip, do not share it with anyone',
|
||||
'home.import.unknown-game': 'Unknown game type',
|
||||
'home.import.unknown-game': 'Unknown game type. Currently only maimai and chunithm are supported for importing.',
|
||||
'home.import.new-data': 'Data to import',
|
||||
'home.import.data-conflict': 'Proceed will override your current data',
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ const zhHome: typeof EN_REF_HOME = {
|
|||
'home.setup.ask': "如果您有任何问题, 请加入我们的",
|
||||
'home.setup.support': "以获取支持",
|
||||
'home.setup.keychip-tips': "这是你的狗号, 不要与任何人分享",
|
||||
'home.import.unknown-game': '未知游戏类型',
|
||||
'home.import.unknown-game': '未知游戏类型 (目前导入只支持舞萌和中二)',
|
||||
'home.import.new-data': '要导入的数据',
|
||||
'home.import.data-conflict': '继续导入将覆盖现有数据',
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import StatusOverlays from "../../components/StatusOverlays.svelte";
|
||||
import { CARD, GAME, USER } from "../../libs/sdk";
|
||||
import Icon from "@iconify/svelte";
|
||||
import { showOpenFilePicker } from 'show-open-file-picker'
|
||||
|
||||
let load = false;
|
||||
let error = "";
|
||||
|
@ -17,25 +16,14 @@
|
|||
} | null;
|
||||
let confirmAction: (override: boolean) => void;
|
||||
|
||||
const startImport = async () => {
|
||||
const [fileHandle] = await (window.showOpenFilePicker || showOpenFilePicker)({
|
||||
id: 'aquadx_import' as any,
|
||||
startIn: 'downloads',
|
||||
types: [
|
||||
{
|
||||
description: "Aqua Player Data",
|
||||
accept: {
|
||||
"application/json": [".json"],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
let fileInput: HTMLInputElement;
|
||||
const startImport = async (e: Event & { currentTarget: EventTarget & HTMLInputElement; }) => {
|
||||
const file = e.currentTarget.files?.[0]
|
||||
|
||||
if (!fileHandle) return;
|
||||
if (!file) return;
|
||||
load = true;
|
||||
|
||||
try {
|
||||
const file = await fileHandle.getFile();
|
||||
const data = JSON.parse(await file.text()) as any;
|
||||
const me = await USER.me();
|
||||
|
||||
|
@ -68,6 +56,7 @@
|
|||
location.href = `/u/${me.username}/${game}`;
|
||||
} catch (e: any) {
|
||||
error = e.message;
|
||||
console.error(e);
|
||||
} finally {
|
||||
conflict = null;
|
||||
load = false;
|
||||
|
@ -75,7 +64,7 @@
|
|||
}
|
||||
|
||||
const getGameByCode = (code: string) => {
|
||||
switch (code.toUpperCase()) {
|
||||
switch (code?.toUpperCase()) {
|
||||
case 'SDEZ':
|
||||
return 'mai2';
|
||||
case 'SDHD':
|
||||
|
@ -86,9 +75,11 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<ActionCard color="209, 124, 102" icon="bxs:file-import" on:click={startImport}>
|
||||
<ActionCard color="209, 124, 102" icon="bxs:file-import" on:click={() => fileInput.click()}>
|
||||
<h3>{t('home.import')}</h3>
|
||||
<span>{t('home.import-description')}</span>
|
||||
<input type="file" accept=".json" bind:this={fileInput} style="display: none"
|
||||
on:change={startImport}/>
|
||||
</ActionCard>
|
||||
|
||||
<StatusOverlays {error} loading={load}/>
|
||||
|
|
Loading…
Reference in New Issue