diff --git a/frontend/src/features/assets/page.tsx b/frontend/src/features/assets/page.tsx index 912fd31..a8debf6 100644 --- a/frontend/src/features/assets/page.tsx +++ b/frontend/src/features/assets/page.tsx @@ -802,24 +802,26 @@ export function ProfileCatalog({ {copy.profiles.create} - - {profiles.map((profile) => ( - { - setSettings(profile); - setOpen(true); - }} - onDelete={() => onDelete(profile.profile_name)} - deleteLabel={`${copy.profiles.delete} ${profile.profile_name}`} - /> +
+ + {profiles.map((profile) => ( + { + setSettings(profile); + setOpen(true); + }} + onDelete={() => onDelete(profile.profile_name)} + deleteLabel={`${copy.profiles.delete} ${profile.profile_name}`} + /> ))} - + +
Promise; locale: Locale }) { +function PersonaCatalog({ builds, onRefresh, locale, loading }: { builds: Build[]; onRefresh: () => Promise; locale: Locale; loading: boolean }) { const t = text[locale]; - const [items, setItems] = useState([]), [draft, setDraft] = useState(null), [error, setError] = useState(""); - const load = () => api("/api/personas").then(setItems); - useEffect(() => { void load(); }, []); + const [items, setItems] = useState([]), [draft, setDraft] = useState(null), [error, setError] = useState(""), [itemsLoading, setItemsLoading] = useState(true); + const load = () => { + setItemsLoading(true); + return api("/api/personas").then(setItems).finally(() => setItemsLoading(false)); + }; + useEffect(() => { + void api("/api/personas").then(setItems).finally(() => setItemsLoading(false)); + }, []); const save = () => { if (!draft) return; const exists = items.some((item) => item.id === draft.id); @@ -1937,7 +1944,7 @@ function PersonaCatalog({ builds, onRefresh, locale }: { builds: Build[]; onRefr .then(() => { setDraft(null); setError(""); return Promise.all([load(), onRefresh()]); }) .catch((value) => setError(value.message)); }; - return
} />

{t.personaDescription}

{items.map((item) => build.persona_ids?.includes(item.id)).length} locale={locale} onClick={() => setDraft(item)} onDelete={() => api(`/api/personas/${item.id}`, "DELETE").then(() => Promise.all([load(), onRefresh()]).then(() => undefined)).catch((value) => setError(value.message))} />)}{draft && setDraft(null)}>