From 36a0e0dcc7d052ae27a54c69ac105bb591a3060a Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 20 Oct 2025 10:05:35 +0800 Subject: [PATCH] use getState --- qt/launcher-gui/src/routes/+page.svelte | 28 +++++++++++++++++++++---- qt/launcher-gui/src/routes/+page.ts | 12 +++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/qt/launcher-gui/src/routes/+page.svelte b/qt/launcher-gui/src/routes/+page.svelte index 2f26bc2a7..a08929594 100644 --- a/qt/launcher-gui/src/routes/+page.svelte +++ b/qt/launcher-gui/src/routes/+page.svelte @@ -14,13 +14,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { onMount } from "svelte"; import { tr, zoomFactor } from "./stores"; import Start from "./Start.svelte"; + import ErrorState from "./ErrorState.svelte"; + import Normal from "./Normal.svelte"; + import Uninstall from "./Uninstall.svelte"; + import { launcherOsUnsupported } from "@generated/ftl"; const { data }: PageProps = $props(); - const langs = data.langs; - const options = $state(data.options); - let mirrors = $state(data.mirrors); + let langs = $state(data.langs); let selectedLang = $state(data.userLocale); + let flow = $state(data.state); + let mirrors = $state(data.mirrors); async function onLangChange(lang: string) { await setLang({ val: lang }); @@ -39,6 +43,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }); onMount(() => windowReady({})); + + let footer: any = $state(null); + + const uninstall = () => { + flow.case = "uninstall"; + }; - + + {#if flow.case === "normal"} + + {:else if flow.case === "uninstall"} + + {:else if flow.case === "osUnsupported" } + + {:else if flow.case === "unknownError" } + + {/if} + diff --git a/qt/launcher-gui/src/routes/+page.ts b/qt/launcher-gui/src/routes/+page.ts index f167f5baa..deb80d96c 100644 --- a/qt/launcher-gui/src/routes/+page.ts +++ b/qt/launcher-gui/src/routes/+page.ts @@ -1,22 +1,22 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -import { getLangs, getMirrors, getOptions } from "@generated/backend-launcher"; +import { getLangs, getMirrors, getState } from "@generated/backend-launcher"; import { ModuleName, setupI18n } from "@tslib/i18n"; import type { PageLoad } from "./$types"; export const load = (async () => { const i18nPromise = setupI18n({ modules: [ModuleName.LAUNCHER] }, true); const langsPromise = getLangs({}); - const optionsPromise = getOptions({}); + const statePromise = getState({}); const mirrorsPromise = getMirrors({}); - const [_, { userLocale, langs }, options, { mirrors }] = await Promise.all([ + const [_, { userLocale, langs }, { kind: state }, { mirrors }] = await Promise.all([ i18nPromise, langsPromise, - optionsPromise, - mirrorsPromise, + statePromise, + mirrorsPromise ]); - return { langs, userLocale, options, mirrors }; + return { langs, userLocale, state, mirrors }; }) satisfies PageLoad;