diff --git a/src/pages/catalogue/Business.tsx b/src/pages/catalogue/Business.tsx index 8e058a9..7d88c26 100644 --- a/src/pages/catalogue/Business.tsx +++ b/src/pages/catalogue/Business.tsx @@ -2,14 +2,21 @@ import GridWrapper from "@/components/GridWrapper"; import { type FC } from "react"; import { useParams } from "react-router-dom"; import ButtonAddCatalogue from "./components/ButtonAddCatalogue"; +import CatalogueGridSkeleton from "./components/CatalogueGridSkeleton"; import CatalogueItem from "./components/CatalogueItem"; import { useGetBusinessCatalog } from "./hooks/useCatalogueData"; const Business: FC = () => { const { slug } = useParams<{ slug: string }>(); const { data, isPending, refetch } = useGetBusinessCatalog(slug ?? ""); - // const { data: businessData, isLoading: businessLoading } = - // useGetBusinessBySlug(slug ?? ""); + + if (isPending) { + return ( +
+ +
+ ); + } return (
diff --git a/src/pages/catalogue/List.tsx b/src/pages/catalogue/List.tsx index 73d9092..df9adc4 100644 --- a/src/pages/catalogue/List.tsx +++ b/src/pages/catalogue/List.tsx @@ -3,11 +3,20 @@ import { usePageTitle } from "@/hooks/usePageTitle"; import { type FC } from "react"; import { useGetCatalog } from "../home/hooks/useHomeData"; import ButtonAddCatalogue from "./components/ButtonAddCatalogue"; +import CatalogueGridSkeleton from "./components/CatalogueGridSkeleton"; import CatalogueItem from "./components/CatalogueItem"; const CatalogueList: FC = () => { usePageTitle("لیست کاتالوگ‌ها"); - const { data, refetch } = useGetCatalog(); + const { data, isPending, refetch } = useGetCatalog(); + + if (isPending) { + return ( +
+ +
+ ); + } return (
diff --git a/src/pages/catalogue/components/CatalogueGridSkeleton.tsx b/src/pages/catalogue/components/CatalogueGridSkeleton.tsx new file mode 100644 index 0000000..1449dc5 --- /dev/null +++ b/src/pages/catalogue/components/CatalogueGridSkeleton.tsx @@ -0,0 +1,42 @@ +import GridWrapper from "@/components/GridWrapper"; +import { type FC } from "react"; + +const PREVIEW_WIDTH = 64; +const PREVIEW_HEIGHT = 89; + +export const CatalogueItemSkeleton: FC = () => ( +