From 64b939e6ac0b196d18ee183a37a40b0bf7927a80 Mon Sep 17 00:00:00 2001 From: Natsuu Date: Wed, 14 Jan 2026 03:41:18 +0000 Subject: refactor: split App.svelte into components --- ui/src/components/BottomBar.svelte | 86 +++++++++++++++++++++++ ui/src/components/HomeView.svelte | 26 +++++++ ui/src/components/LoginModal.svelte | 126 ++++++++++++++++++++++++++++++++++ ui/src/components/SettingsView.svelte | 125 +++++++++++++++++++++++++++++++++ ui/src/components/Sidebar.svelte | 66 ++++++++++++++++++ ui/src/components/StatusToast.svelte | 36 ++++++++++ ui/src/components/VersionsView.svelte | 34 +++++++++ 7 files changed, 499 insertions(+) create mode 100644 ui/src/components/BottomBar.svelte create mode 100644 ui/src/components/HomeView.svelte create mode 100644 ui/src/components/LoginModal.svelte create mode 100644 ui/src/components/SettingsView.svelte create mode 100644 ui/src/components/Sidebar.svelte create mode 100644 ui/src/components/StatusToast.svelte create mode 100644 ui/src/components/VersionsView.svelte (limited to 'ui/src/components') diff --git a/ui/src/components/BottomBar.svelte b/ui/src/components/BottomBar.svelte new file mode 100644 index 0000000..ceba5b3 --- /dev/null +++ b/ui/src/components/BottomBar.svelte @@ -0,0 +1,86 @@ + + +
+
+
authState.openLoginModal()} + role="button" + tabindex="0" + onkeydown={(e) => e.key === "Enter" && authState.openLoginModal()} + > +
+ {#if authState.currentAccount} + {authState.currentAccount.username} + {:else} + ? + {/if} +
+
+
+ {authState.currentAccount ? authState.currentAccount.username : "Click to Login"} +
+
+ + {authState.currentAccount ? "Ready" : "Guest"} +
+
+
+ + +
+ +
+
+ + +
+ + +
+
diff --git a/ui/src/components/HomeView.svelte b/ui/src/components/HomeView.svelte new file mode 100644 index 0000000..e876c14 --- /dev/null +++ b/ui/src/components/HomeView.svelte @@ -0,0 +1,26 @@ + + + +
+
+ +
+

+ MINECRAFT +

+
+ JAVA EDITION + Release 1.20.4 +
+
diff --git a/ui/src/components/LoginModal.svelte b/ui/src/components/LoginModal.svelte new file mode 100644 index 0000000..f1ac0d5 --- /dev/null +++ b/ui/src/components/LoginModal.svelte @@ -0,0 +1,126 @@ + + +{#if authState.isLoginModalOpen} +
+
+
+

Login

+ +
+ + {#if authState.loginMode === "select"} +
+ + +
+
+
+
+
+ OR +
+
+ +
+ e.key === "Enter" && authState.performOfflineLogin()} + /> + +
+
+ {:else if authState.loginMode === "microsoft"} +
+ {#if authState.msLoginLoading && !authState.deviceCodeData} +
+ Starting login flow... +
+ {:else if authState.deviceCodeData} +
+

1. Go to this URL:

+ + +

2. Enter this code:

+
e.key === 'Enter' && navigator.clipboard.writeText(authState.deviceCodeData?.user_code || "")} + onclick={() => + navigator.clipboard.writeText( + authState.deviceCodeData?.user_code || "" + )} + > + {authState.deviceCodeData.user_code} +
+

Click code to copy

+ +
+
+
+ {authState.msLoginStatus} +
+

This window will update automatically.

+
+ + +
+ {/if} +
+ {/if} +
+
+{/if} diff --git a/ui/src/components/SettingsView.svelte b/ui/src/components/SettingsView.svelte new file mode 100644 index 0000000..f09be4e --- /dev/null +++ b/ui/src/components/SettingsView.svelte @@ -0,0 +1,125 @@ + + +
+

Settings

+ +
+ +
+ +
+ + +
+ + {#if settingsState.javaInstallations.length > 0} +
+

Detected Java Installations:

+ {#each settingsState.javaInstallations as java} + + {/each} +
+ {/if} + +

+ The command or path to the Java Runtime Environment. Click "Auto Detect" to find installed Java versions. +

+
+ + +
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ +
+
+ + +
+
+ + +
+
+
+ +
+ +
+
+
diff --git a/ui/src/components/Sidebar.svelte b/ui/src/components/Sidebar.svelte new file mode 100644 index 0000000..a4f4e35 --- /dev/null +++ b/ui/src/components/Sidebar.svelte @@ -0,0 +1,66 @@ + + + diff --git a/ui/src/components/StatusToast.svelte b/ui/src/components/StatusToast.svelte new file mode 100644 index 0000000..b1feffc --- /dev/null +++ b/ui/src/components/StatusToast.svelte @@ -0,0 +1,36 @@ + + +{#if uiState.status !== "Ready"} +
+
+
Status
+ +
+
{uiState.status}
+
+
+
+
+{/if} + + diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte new file mode 100644 index 0000000..8c0ddfe --- /dev/null +++ b/ui/src/components/VersionsView.svelte @@ -0,0 +1,34 @@ + + +
+

Versions

+
+ {#if gameState.versions.length === 0} +
Loading versions...
+ {:else} + {#each gameState.versions as version} + + {/each} + {/if} +
+
-- cgit v1.2.3-70-g09d2