first commit

This commit is contained in:
Samandar Turgunboyev
2025-12-15 18:41:13 +05:00
parent a5b46a9f26
commit 6bf86f39c6
109 changed files with 7007 additions and 295 deletions

View File

@@ -0,0 +1,145 @@
'use client';
import { useRouter } from '@/shared/config/i18n/navigation';
import { Button } from '@/shared/ui/button';
import { ProductCard } from '@/widgets/categories/ui/product-card';
import { Heart } from 'lucide-react';
import { useState } from 'react';
// Fake data
const LIKED_PRODUCTS = [
{
id: 1,
name: 'Samsung Galaxy S23 Ultra 256GB, Phantom Black',
price: 12500000,
oldPrice: 15000000,
image: 'https://images.unsplash.com/photo-1610945415295-d9bbf067e59c?w=400',
rating: 4.8,
reviews: 342,
discount: 17,
inStock: true,
liked: true,
},
{
id: 2,
name: 'Apple AirPods Pro 2-chi avlod (USB-C)',
price: 2850000,
oldPrice: 3200000,
image: 'https://images.unsplash.com/photo-1606841837239-c5a1a4a07af7?w=400',
rating: 4.9,
reviews: 567,
discount: 11,
liked: true,
inStock: true,
},
{
id: 3,
name: "Sony PlayStation 5 Slim 1TB + 2 ta o'yin",
price: 7500000,
oldPrice: 8500000,
image: 'https://images.unsplash.com/photo-1606813907291-d86efa9b94db?w=400',
rating: 4.7,
reviews: 234,
discount: 12,
inStock: true,
liked: true,
},
{
id: 4,
name: 'MacBook Air 13 M2 chip, 8GB RAM, 256GB SSD',
price: 14200000,
oldPrice: 16000000,
image: 'https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=400',
rating: 4.9,
reviews: 891,
liked: true,
discount: 11,
inStock: true,
},
{
id: 5,
name: 'Dyson V15 Detect Simsiz Changyutgich',
price: 6800000,
oldPrice: 7800000,
image: 'https://images.unsplash.com/photo-1558317374-067fb5f30001?w=400',
rating: 4.6,
reviews: 178,
discount: 13,
liked: true,
inStock: false,
},
{
id: 6,
name: 'Nike Air Max 270 React Erkaklar Krosovkasi',
price: 1250000,
oldPrice: 1650000,
image: 'https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=400',
rating: 4.5,
liked: true,
reviews: 423,
discount: 24,
inStock: true,
},
];
export default function Favourite() {
const [likedProducts, setLikedProducts] = useState(LIKED_PRODUCTS);
const router = useRouter();
const handleRemove = (id: number) => {
setLikedProducts((prev) => prev.filter((product) => product.id !== id));
};
if (likedProducts.length === 0) {
return (
<div className="min-h-screen bg-slate-50 py-12">
<div className="container mx-auto px-4">
<div className="flex flex-col items-center justify-center py-20">
<div className="w-32 h-32 bg-slate-100 rounded-full flex items-center justify-center mb-6">
<Heart className="w-16 h-16 text-slate-300" />
</div>
<h2 className="text-2xl font-bold text-slate-800 mb-2">
{"Sevimlilar bo'sh"}
</h2>
<p className="text-slate-500 text-center max-w-md mb-8">
{`Hali hech qanday mahsulotni sevimlilarga qo'shmadingiz.
Mahsulotlar ro'yxatiga o'ting va yoqqan mahsulotlaringizni
saqlang.`}
</p>
<Button
className="bg-blue-600 text-white px-8 py-3 rounded-xl hover:bg-blue-700"
onClick={() => router.push('/')}
>
Xarid qilishni boshlash
</Button>
</div>
</div>
</div>
);
}
return (
<div className="min-h-screen bg-slate-50 py-8">
<div className="container mx-auto px-4">
<div className="flex items-center justify-between mb-8">
<div>
<h1 className="text-3xl font-bold text-slate-800 mb-2">
Sevimli mahsulotlar
</h1>
<p className="text-slate-500">{likedProducts.length} ta mahsulot</p>
</div>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
{likedProducts.map((product) => (
<ProductCard
key={product.id}
product={product}
handleRemove={handleRemove}
/>
))}
</div>
</div>
</div>
);
}