diff --git a/web/app/_components/ExploreModelList/index.tsx b/web/app/_components/ExploreModelList/index.tsx index 4fb7e8bde..1a74dd28b 100644 --- a/web/app/_components/ExploreModelList/index.tsx +++ b/web/app/_components/ExploreModelList/index.tsx @@ -2,9 +2,10 @@ import React, { useEffect } from "react"; import ExploreModelItem from "../ExploreModelItem"; import { getConfiguredModels } from "@/_hooks/useGetDownloadedModels"; import useGetConfiguredModels from "@/_hooks/useGetConfiguredModels"; +import { Waveform } from "@uiball/loaders"; const ExploreModelList: React.FC = () => { - const { models } = useGetConfiguredModels(); + const { loading, models } = useGetConfiguredModels(); useEffect(() => { getConfiguredModels(); @@ -12,6 +13,11 @@ const ExploreModelList: React.FC = () => { return (
+ {loading && ( +
+ +
+ )} {models.map((item) => ( ))} diff --git a/web/app/_hooks/useGetConfiguredModels.ts b/web/app/_hooks/useGetConfiguredModels.ts index c5dd5d46a..f34f3052c 100644 --- a/web/app/_hooks/useGetConfiguredModels.ts +++ b/web/app/_hooks/useGetConfiguredModels.ts @@ -3,11 +3,13 @@ import { useEffect, useState } from "react"; import { getConfiguredModels } from "./useGetDownloadedModels"; export default function useGetConfiguredModels() { + const [loading, setLoading] = useState(false); const [models, setModels] = useState([]); const fetchModels = async () => { + setLoading(true); const models = await getConfiguredModels(); - + setLoading(false); setModels(models); }; @@ -16,5 +18,5 @@ export default function useGetConfiguredModels() { fetchModels(); }, []); - return { models }; + return { loading, models }; }