From 9595e41ff79d2fd04f9f91692f49bd7557bc5583 Mon Sep 17 00:00:00 2001 From: Tnze Date: Sat, 28 Dec 2024 20:01:44 +0800 Subject: [PATCH] Improve BOM UI --- src-server/src/main.rs | 4 +-- src/components/bom/Selector.vue | 19 ++++++++++--- src/datasource/beta-xivapi-source.ts | 3 +- src/pages/Bom.vue | 42 ++++++++++++++++++++++++---- src/stores/bom.ts | 16 ++++++++++- 5 files changed, 70 insertions(+), 14 deletions(-) diff --git a/src-server/src/main.rs b/src-server/src/main.rs index a5e2f00..c0f17e1 100644 --- a/src-server/src/main.rs +++ b/src-server/src/main.rs @@ -25,8 +25,8 @@ use serde::Serialize; mod db; use db::{ - collectables_shop_refine, craft_types, item_action, item_food, item_food_effect, - item_with_amount, items, prelude::*, recipe_level_tables, recipes, + craft_types, item_action, item_food, item_food_effect, item_with_amount, items, prelude::*, + recipe_level_tables, recipes, }; type Result = std::result::Result; diff --git a/src/components/bom/Selector.vue b/src/components/bom/Selector.vue index fa67f68..64c5ccd 100644 --- a/src/components/bom/Selector.vue +++ b/src/components/bom/Selector.vue @@ -34,11 +34,17 @@ const settingStore = useSettingStore(); const search = ref(''); const recipeList = ref([]); +const isLoading = ref(false); async function update() { - const source = await settingStore.getDataSource; - const recipeTable = await source.recipeTable(1, search.value); - recipeList.value = recipeTable.results; + try { + isLoading.value = true; + const source = await settingStore.getDataSource; + const recipeTable = await source.recipeTable(1, search.value); + recipeList.value = recipeTable.results; + } finally { + isLoading.value = false; + } } watch(search, () => update(), { immediate: true }); @@ -49,7 +55,12 @@ async function selectItem(recipe: RecipeInfo) {