From 743401f15199a116b1777bced843c774c5a59fba Mon Sep 17 00:00:00 2001
From: HsiangNianian <i@jyunko.cn>
Date: Fri, 16 Jan 2026 20:20:19 +0800
Subject: feat: add InstancesView component and integrate instance management
 into the UI

Introduced a new InstancesView component for managing game instances, allowing users to create, edit, delete, and duplicate instances. Updated the App.svelte to include the InstancesView and modified various components to ensure instance selection is handled correctly. Enhanced the ModLoaderSelector and VersionsView to check for active instances before performing actions. Updated the Sidebar to include navigation to the new InstancesView.
---
 ui/src/App.svelte | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'ui/src/App.svelte')

diff --git a/ui/src/App.svelte b/ui/src/App.svelte
index 2b78892..127bbea 100644
--- a/ui/src/App.svelte
+++ b/ui/src/App.svelte
@@ -11,12 +11,14 @@
   import ParticleBackground from "./components/ParticleBackground.svelte";
   import SettingsView from "./components/SettingsView.svelte";
   import AssistantView from "./components/AssistantView.svelte";
+  import InstancesView from "./components/InstancesView.svelte";
   import Sidebar from "./components/Sidebar.svelte";
   import StatusToast from "./components/StatusToast.svelte";
   import VersionsView from "./components/VersionsView.svelte";
 // Stores
   import { authState } from "./stores/auth.svelte";
   import { gameState } from "./stores/game.svelte";
+  import { instancesState } from "./stores/instances.svelte";
   import { settingsState } from "./stores/settings.svelte";
   import { uiState } from "./stores/ui.svelte";
   import { logsState } from "./stores/logs.svelte";
@@ -40,6 +42,7 @@
     await settingsState.loadSettings();
     logsState.init();
     await settingsState.detectJava();
+    await instancesState.loadInstances();
     gameState.loadVersions();
     getVersion().then((v) => (uiState.appVersion = v));
     window.addEventListener("mousemove", handleMouseMove);
@@ -113,6 +116,8 @@
           <div class="flex-1 relative overflow-hidden">
              {#if uiState.currentView === "home"}
                <HomeView mouseX={mouseX} mouseY={mouseY} />
+             {:else if uiState.currentView === "instances"}
+               <InstancesView />
              {:else if uiState.currentView === "versions"}
                <VersionsView />
              {:else if uiState.currentView === "settings"}
-- 
cgit v1.2.3-70-g09d2

