diff --git a/components/admin/guide-section-editor.tsx b/components/admin/guide-section-editor.tsx index 8eafa59..73c9df9 100644 --- a/components/admin/guide-section-editor.tsx +++ b/components/admin/guide-section-editor.tsx @@ -125,7 +125,6 @@ import { import { Textarea } from "@/components/ui/textarea"; import { Separator } from "@/components/ui/separator"; import { Skeleton } from "@/components/ui/skeleton"; -import { Spinner } from "@/components/ui/spinner"; import { Toggle } from "@/components/ui/toggle"; import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { @@ -214,6 +213,13 @@ type CatalogItem = { }; const catalogItemsEqual = (item: CatalogItem, value: CatalogItem) => item.key === value.key; +const teamSearchTargetLabels: Record = { + all: "ทั้งหมด", + team: "ชื่อทีม", + character: "ตัวละคร", + weapon: "อาวุธ", + artifact: "อาร์ติแฟกต์", +}; type ExtraCatalogItem = { kind: "character" | "weapon" | "artifact"; key: string; @@ -2835,7 +2841,7 @@ function TeamEditor({ const [importGuides, setImportGuides] = useState | null>(null); const [activeImportGuide, setActiveImportGuide] = useState(null); const [selectedImports, setSelectedImports] = useState>>({}); - const [guideImportLoading, setGuideImportLoading] = useState(false); + const [guideImportLoading, setGuideImportLoading] = useState<"guides" | "teams" | null>(null); const [guideImportError, setGuideImportError] = useState(null); const [guideImportCondition, setGuideImportCondition] = useState("0"); const [guideTeamQuery, setGuideTeamQuery] = useState(""); @@ -3207,17 +3213,17 @@ function TeamEditor({ setSelectedImports({}); setGuideListQuery(""); setGuideImportError(null); - setGuideImportLoading(true); + setGuideImportLoading("guides"); const result = await listTeamImportGuides(guide.id); - setGuideImportLoading(false); + setGuideImportLoading(null); if (result.status === "success") setImportGuides(result.guides); else setGuideImportError(result.message); }; const enterImportGuide = async (guideId: string) => { setGuideImportError(null); - setGuideImportLoading(true); + setGuideImportLoading("teams"); const result = await loadTeamImportGuide(guideId); - setGuideImportLoading(false); + setGuideImportLoading(null); if (result.status === "success") { setGuideImportCondition("0"); setGuideTeamQuery(""); @@ -4027,9 +4033,74 @@ function TeamEditor({ ) : null} {guideImportLoading ? ( -
- -
+ guideImportLoading === "guides" ? ( +
+ +
+
+ {Array.from({ length: 6 }, (_, index) => ( + + + + + + + + + + + + ))} +
+
+
+ ) : ( +
+ +
+ + +
+
+
+ {Array.from({ length: 4 }, (_, index) => ( + + + + + + + +
+ {Array.from({ length: 4 }, (_, memberIndex) => ( +
+ + + +
+ ))} +
+ +
+ + +
+ +
+
+ ))} +
+
+
+ ) ) : activeImportGuide ? (