canina/frontend/application/app/catalog/CatalogClient.tsx
parsa aghaei 00839017ff
Some checks failed
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
Deploy Canina / deploy (push) Has been cancelled
feat(products): remove mock static fallbacks and add dynamic specialist recommendation management in database and admin panel
2026-09-02 15:50:01 +03:30

41 lines
1.3 KiB
TypeScript
Raw 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 <FlipbookCatalog products={products} />;
}