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/components/BottomBar.svelte | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'ui/src/components/BottomBar.svelte')

diff --git a/ui/src/components/BottomBar.svelte b/ui/src/components/BottomBar.svelte
index 8a6b7ff..19cf35d 100644
--- a/ui/src/components/BottomBar.svelte
+++ b/ui/src/components/BottomBar.svelte
@@ -4,6 +4,7 @@
   import { authState } from "../stores/auth.svelte";
   import { gameState } from "../stores/game.svelte";
   import { uiState } from "../stores/ui.svelte";
+  import { instancesState } from "../stores/instances.svelte";
   import { Terminal, ChevronDown, Play, User, Check } from 'lucide-svelte';
 
   interface InstalledVersion {
@@ -44,9 +45,16 @@
   }
 
   async function loadInstalledVersions() {
+    if (!instancesState.activeInstanceId) {
+      installedVersions = [];
+      isLoadingVersions = false;
+      return;
+    }
     isLoadingVersions = true;
     try {
-      installedVersions = await invoke<InstalledVersion[]>("list_installed_versions");
+      installedVersions = await invoke<InstalledVersion[]>("list_installed_versions", {
+        instanceId: instancesState.activeInstanceId,
+      });
       // If no version is selected but we have installed versions, select the first one
       if (!gameState.selectedVersion && installedVersions.length > 0) {
         gameState.selectedVersion = installedVersions[0].id;
-- 
cgit v1.2.3-70-g09d2

