From 561300de64373b883b6c456f552c3dedc3c2d71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Wed, 15 Nov 2023 01:46:23 +0100 Subject: [PATCH] refactor: cleanup --- src/env.d.ts | 6 ++--- src/lib/components/layout/Layout.svelte | 34 +++++-------------------- src/lib/dialogs/ConfirmDialog.svelte | 17 ------------- src/lib/dialogs/confirm-dialog.ts | 1 - src/routes/+layout.ts | 4 +-- src/routes/ConnectionPopup.svelte | 11 +++++++- src/routes/Footer.svelte | 7 +++-- src/routes/config/layout/+page.svelte | 4 --- src/routes/config/settings/+page.svelte | 9 +++---- vite.config.ts | 9 +++---- 10 files changed, 33 insertions(+), 69 deletions(-) diff --git a/src/env.d.ts b/src/env.d.ts index e10a2a24..74e23365 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -7,11 +7,11 @@ interface ImportMetaEnv { readonly TAURI_ARCH?: string readonly TAURI_DEBUG?: boolean readonly TAURI_PLATFORM_TYPE?: string + + readonly VITE_HOMEPAGE_URL: string + readonly VITE_BUGS_URL: string } interface ImportMeta { readonly env: ImportMetaEnv } - -declare const HOMEPAGE_URL: string -declare const BUGS_URL: string diff --git a/src/lib/components/layout/Layout.svelte b/src/lib/components/layout/Layout.svelte index f0d4a49f..577382ab 100644 --- a/src/lib/components/layout/Layout.svelte +++ b/src/lib/components/layout/Layout.svelte @@ -1,13 +1,10 @@
@@ -49,21 +36,12 @@ {/each} - {#await layouts[layoutOverride || device]() then { default: visualLayout }} + {#await layouts[device]() then visualLayout} {/await}
diff --git a/src/lib/dialogs/confirm-dialog.ts b/src/lib/dialogs/confirm-dialog.ts index f1f3597e..ae257566 100644 --- a/src/lib/dialogs/confirm-dialog.ts +++ b/src/lib/dialogs/confirm-dialog.ts @@ -15,7 +15,6 @@ export async function askForConfirmation( abortTitle, }, }) - dialog.show() let resolvePromise: (value: boolean) => void const resultPromise = new Promise(resolve => { diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 487add9d..73f669d9 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -6,9 +6,9 @@ export const prerender = true export const trailingSlash = "always" export const load = (async ({url, data, fetch}) => { - const importFile = new URLSearchParams(url.search).get("import") + const importFile = browser && new URLSearchParams(url.search).get("import") return { ...data, - importFile: browser && importFile ? await charaFileFromUriComponent(importFile, fetch) : undefined, + importFile: importFile ? await charaFileFromUriComponent(importFile, fetch) : undefined, } }) satisfies LayoutLoad diff --git a/src/routes/ConnectionPopup.svelte b/src/routes/ConnectionPopup.svelte index a1d803b7..f1e695d6 100644 --- a/src/routes/ConnectionPopup.svelte +++ b/src/routes/ConnectionPopup.svelte @@ -57,7 +57,16 @@ {#if powerDialog} -
(powerDialog = !powerDialog)} /> +
(powerDialog = !powerDialog)} + on:keypress={event => { + if (event.key === "Enter") powerDialog = !powerDialog + }} + />

{$LL.deviceManager.bootMenu.TITLE()}