From 743401f15199a116b1777bced843c774c5a59fba Mon Sep 17 00:00:00 2001 From: HsiangNianian 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/InstancesView.svelte | 331 +++++++++++++++++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 ui/src/components/InstancesView.svelte (limited to 'ui/src/components/InstancesView.svelte') diff --git a/ui/src/components/InstancesView.svelte b/ui/src/components/InstancesView.svelte new file mode 100644 index 0000000..a4881e6 --- /dev/null +++ b/ui/src/components/InstancesView.svelte @@ -0,0 +1,331 @@ + + +
+
+

Instances

+ +
+ + {#if instancesState.instances.length === 0} +
+
+

No instances yet

+

Create your first instance to get started

+
+
+ {:else} +
+ {#each instancesState.instances as instance (instance.id)} +
instancesState.setActiveInstance(instance.id)} + > + {#if instancesState.activeInstanceId === instance.id} +
+
+
+ {/if} + +
+

+ {instance.name} +

+
+ + + +
+
+ +
+ {#if instance.version_id} +

Version: {instance.version_id}

+ {:else} +

No version selected

+ {/if} + + {#if instance.mod_loader && instance.mod_loader !== "vanilla"} +

+ Mod Loader: {instance.mod_loader} + {#if instance.mod_loader_version} + ({instance.mod_loader_version}) + {/if} +

+ {/if} + +

Created: {formatDate(instance.created_at)}

+ + {#if instance.last_played} +

Last played: {formatLastPlayed(instance.last_played)}

+ {/if} +
+ + {#if instance.notes} +

+ {instance.notes} +

+ {/if} +
+ {/each} +
+ {/if} +
+ + +{#if showCreateModal} +
+
+

Create Instance

+ e.key === "Enter" && confirmCreate()} + autofocus + /> +
+ + +
+
+
+{/if} + + +{#if showEditModal && selectedInstance} +
+
+

Edit Instance

+ e.key === "Enter" && confirmEdit()} + autofocus + /> +
+ + +
+
+
+{/if} + + +{#if showDeleteConfirm && selectedInstance} +
+
+

Delete Instance

+

+ Are you sure you want to delete "{selectedInstance.name}"? This action cannot be undone and will delete all game data for this instance. +

+
+ + +
+
+
+{/if} + + +{#if showDuplicateModal && selectedInstance} +
+
+

Duplicate Instance

+ e.key === "Enter" && confirmDuplicate()} + autofocus + /> +
+ + +
+
+
+{/if} -- cgit v1.2.3-70-g09d2