canina/frontend/application/app/catalog/CatalogClient.tsx
parsa aghaei 49eb1e5ff3
Some checks failed
Deploy Canina / deploy (push) Successful in 2m25s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 0s
fix(catalog,footer): resolve catalog footer white gap, refine mobile footer layout and improve micro-scrollbar contrast
2026-09-06 11:56:40 +03:30

45 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
import React, { useState, useEffect } from "react";
import FlipbookCatalog from "../../components/catalog/FlipbookCatalog";
import { productService } from "../../lib/services/productService";
import { Product } from "../../lib/data/products";
export default function CatalogClient() {
const [products, setProducts] = useState<Product[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
productService.getProducts({ limit: 999 })
.then(res => {
if (res.data && res.data.length > 0) {
setProducts(res.data);
} else {
setProducts([]);
}
})
.catch(err => {
console.error("Catalog fetch error:", err);
setProducts([]);
})
.finally(() => setLoading(false));
}, []);
if (loading) {
return (
<div className="min-h-screen bg-slate-900 text-slate-100 flex items-center justify-center font-vazir">
<div className="text-center space-y-4">
<div className="w-12 h-12 border-4 border-amber-400 border-t-transparent rounded-full animate-spin mx-auto" />
<p className="text-sm font-bold text-slate-300">در حال بارگذاری کاتالوگ دیجیتال Canina Pharma...</p>
</div>
</div>
);
}
return (
<div className="w-full min-h-screen bg-slate-950">
<FlipbookCatalog products={products} />
</div>
);
}