From 2c435e96ec8a1a110ba5a65eac443ef427bab92d Mon Sep 17 00:00:00 2001
From: Natsuu <natsukawa247@outlook.com>
Date: Wed, 14 Jan 2026 04:27:50 +0000
Subject: feat: implement version search functionality in VersionsView

---
 ui/src/components/VersionsView.svelte | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

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

diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte
index 8c0ddfe..1f72d32 100644
--- a/ui/src/components/VersionsView.svelte
+++ b/ui/src/components/VersionsView.svelte
@@ -1,14 +1,32 @@
 <script lang="ts">
   import { gameState } from "../stores/game.svelte";
+
+  let searchQuery = $state("");
+
+  let filteredVersions = $derived(
+    gameState.versions.filter((v) =>
+      v.id.toLowerCase().includes(searchQuery.toLowerCase())
+    )
+  );
 </script>
 
 <div class="p-8 h-full overflow-y-auto bg-zinc-900">
   <h2 class="text-3xl font-bold mb-6">Versions</h2>
+
+  <input
+    type="text"
+    placeholder="Search versions..."
+    class="w-full p-3 mb-4 bg-zinc-800 border border-zinc-700 rounded text-white focus:outline-none focus:border-green-500 transition-colors"
+    bind:value={searchQuery}
+  />
+
   <div class="grid gap-2">
     {#if gameState.versions.length === 0}
       <div class="text-zinc-500">Loading versions...</div>
+    {:else if filteredVersions.length === 0}
+      <div class="text-zinc-500">No versions found matching "{searchQuery}"</div>
     {:else}
-      {#each gameState.versions as version}
+      {#each filteredVersions as version}
         <button
           class="flex items-center justify-between p-4 bg-zinc-800 rounded hover:bg-zinc-700 transition text-left border border-zinc-700 {gameState.selectedVersion ===
           version.id
-- 
cgit v1.2.3-70-g09d2


From 9b6e52f772e70a8fb36d40a86e6375bf9e1875e1 Mon Sep 17 00:00:00 2001
From: Natsuu <natsukawa247@outlook.com>
Date: Wed, 14 Jan 2026 04:57:04 +0000
Subject: feat: enhance search functionality by trimming and replacing
 characters in search query

---
 ui/src/components/VersionsView.svelte | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte
index 1f72d32..81f2379 100644
--- a/ui/src/components/VersionsView.svelte
+++ b/ui/src/components/VersionsView.svelte
@@ -5,7 +5,7 @@
 
   let filteredVersions = $derived(
     gameState.versions.filter((v) =>
-      v.id.toLowerCase().includes(searchQuery.toLowerCase())
+      v.id.toLowerCase().includes(searchQuery.trim().toLowerCase().replace("。", "."))
     )
   );
 </script>
-- 
cgit v1.2.3-70-g09d2


From a58130fdf4d3fef3c5150bb444ce551c1886a652 Mon Sep 17 00:00:00 2001
From: Natsuu <natsukawa247@outlook.com>
Date: Wed, 14 Jan 2026 05:01:17 +0000
Subject: fix: search query character replacement to use replaceAll for better
 accuracy

---
 ui/src/components/VersionsView.svelte | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte
index 81f2379..1eba447 100644
--- a/ui/src/components/VersionsView.svelte
+++ b/ui/src/components/VersionsView.svelte
@@ -5,7 +5,7 @@
 
   let filteredVersions = $derived(
     gameState.versions.filter((v) =>
-      v.id.toLowerCase().includes(searchQuery.trim().toLowerCase().replace("。", "."))
+      v.id.toLowerCase().includes(searchQuery.trim().toLowerCase().replaceAll("。", "."))
     )
   );
 </script>
-- 
cgit v1.2.3-70-g09d2


From fc4b535d6f69fa25f33207b9e7117027b3c85e55 Mon Sep 17 00:00:00 2001
From: Natsuu <natsukawa247@outlook.com>
Date: Wed, 14 Jan 2026 05:06:23 +0000
Subject: feat: optimize search filtering by using normalized query for better
 accuracy

---
 ui/src/components/VersionsView.svelte | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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

diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte
index 1eba447..27aba7d 100644
--- a/ui/src/components/VersionsView.svelte
+++ b/ui/src/components/VersionsView.svelte
@@ -2,10 +2,13 @@
   import { gameState } from "../stores/game.svelte";
 
   let searchQuery = $state("");
+  let normalizedQuery = $derived(
+    searchQuery.trim().toLowerCase().replaceAll("。", ".")
+  );
 
   let filteredVersions = $derived(
     gameState.versions.filter((v) =>
-      v.id.toLowerCase().includes(searchQuery.trim().toLowerCase().replaceAll("。", "."))
+      v.id.toLowerCase().includes(normalizedQuery)
     )
   );
 </script>
@@ -23,7 +26,7 @@
   <div class="grid gap-2">
     {#if gameState.versions.length === 0}
       <div class="text-zinc-500">Loading versions...</div>
-    {:else if filteredVersions.length === 0}
+    {:else if filteredVersions.length === 0 && normalizedQuery.length > 0}
       <div class="text-zinc-500">No versions found matching "{searchQuery}"</div>
     {:else}
       {#each filteredVersions as version}
-- 
cgit v1.2.3-70-g09d2


From d689d0b8d33ad9d3bc5c235bbfb3ce792efe7536 Mon Sep 17 00:00:00 2001
From: 简律纯 <i@jyunko.cn>
Date: Wed, 14 Jan 2026 14:14:05 +0800
Subject: Update ui/src/components/VersionsView.svelte

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---
 ui/src/components/VersionsView.svelte | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte
index 27aba7d..98261b8 100644
--- a/ui/src/components/VersionsView.svelte
+++ b/ui/src/components/VersionsView.svelte
@@ -3,7 +3,7 @@
 
   let searchQuery = $state("");
   let normalizedQuery = $derived(
-    searchQuery.trim().toLowerCase().replaceAll("。", ".")
+    searchQuery.trim().toLowerCase().replace(/。/g, ".")
   );
 
   let filteredVersions = $derived(
-- 
cgit v1.2.3-70-g09d2

