fixed: image url, and updated form phone input validation

This commit is contained in:
nabijonovdavronbek619@gmail.com
2025-12-26 15:15:39 +05:00
parent ca80c6920c
commit 3dfce04ab0
6 changed files with 67 additions and 41 deletions

View File

@@ -10,6 +10,7 @@ import { ChevronsRight } from "lucide-react";
import { ProductCard } from "./ProductCard";
import { ProductModal } from "./ProductModal";
import axios from "axios";
import EmptyState from "../productsPage/emptyData";
// hello everyone
@@ -20,11 +21,13 @@ export function ProductsGrid() {
useEffect(() => {
async function getData() {
await axios.get("https://admin.promtechno.uz/api/products/").then((res) => {
console.log("all data main page: ", res?.data);
const allData = res?.data || [];
setAllProducts(allData.slice(0,3));
});
await axios
.get("https://admin.promtechno.uz/api/products/")
.then((res) => {
console.log("all data main page: ", res?.data);
const allData = res?.data || [];
setAllProducts(allData.slice(0, 3));
});
}
getData();
}, []);
@@ -64,21 +67,25 @@ export function ProductsGrid() {
</motion.div>
{/* Product Grid */}
<motion.div
initial="hidden"
whileInView="visible"
viewport={{ once: true }}
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8"
>
{allProducts.map((product: any) => (
<motion.div key={product.id} >
<ProductCard
product={product}
onViewDetails={handleViewDetails}
/>
</motion.div>
))}
</motion.div>
{allProducts && allProducts.length > 0 ? (
<motion.div
initial="hidden"
whileInView="visible"
viewport={{ once: true }}
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8"
>
{allProducts.map((product: any) => (
<motion.div key={product.id}>
<ProductCard
product={product}
onViewDetails={handleViewDetails}
/>
</motion.div>
))}
</motion.div>
) : (
<EmptyState page="main" />
)}
</div>
<div className="mt-10 w-full flex items-center justify-center">
<Link