faq, privacy-policy and about page complated
This commit is contained in:
@@ -7,6 +7,9 @@ const nextConfig: NextConfig = {
|
||||
// eslint: {
|
||||
// ignoreDuringBuilds: true,
|
||||
// },
|
||||
images: {
|
||||
remotePatterns: [{ protocol: 'http', hostname: '**' }],
|
||||
},
|
||||
};
|
||||
const withNextIntl = createNextIntlPlugin({
|
||||
requestConfig: './src/shared/config/i18n/request.ts',
|
||||
|
||||
68
package-lock.json
generated
68
package-lock.json
generated
@@ -12,6 +12,8 @@
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@hookform/resolvers": "^5.2.2",
|
||||
"@pbe/react-yandex-maps": "^1.2.5",
|
||||
"@radix-ui/react-accordion": "^1.2.8",
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
||||
"@radix-ui/react-avatar": "^1.1.11",
|
||||
@@ -44,12 +46,13 @@
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"react-hook-form": "^7.68.0",
|
||||
"recharts": "^2.15.3",
|
||||
"sonner": "^2.0.3",
|
||||
"sonner": "^2.0.7",
|
||||
"swiper": "^12.0.3",
|
||||
"tailwind-merge": "^3.2.0",
|
||||
"vaul": "^1.1.2",
|
||||
"zod": "^4.1.11",
|
||||
"zod": "^4.2.1",
|
||||
"zustand": "^5.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -434,6 +437,18 @@
|
||||
"tslib": "2"
|
||||
}
|
||||
},
|
||||
"node_modules/@hookform/resolvers": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-5.2.2.tgz",
|
||||
"integrity": "sha512-A/IxlMLShx3KjV/HeTcTfaMxdwy690+L/ZADoeaTltLx+CVuzkeVIPuybK3jrRfw7YZnmdKsVVHAlEPIAEUNlA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@standard-schema/utils": "^0.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react-hook-form": "^7.55.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||
@@ -1514,6 +1529,21 @@
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@pbe/react-yandex-maps": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@pbe/react-yandex-maps/-/react-yandex-maps-1.2.5.tgz",
|
||||
"integrity": "sha512-cBojin5e1fPx9XVCAqHQJsCnHGMeBNsP0TrNfpWCrPFfxb30ye+JgcGr2mn767Gbr1d+RufBLRiUcX2kaiAwjQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/yandex-maps": "2.1.29"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.x || ^17.x || ^18.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgr/core": {
|
||||
"version": "0.2.9",
|
||||
"resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.9.tgz",
|
||||
@@ -2923,6 +2953,12 @@
|
||||
"integrity": "sha512-bXHSaW5jRTmke9Vd0h5P7BtWZG9Znqb8gSDxZnxaGSJnGwPLDPfS+3g0BKzeWqzgZPsIVZkM7m2tbo18cm5HBw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@standard-schema/utils": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",
|
||||
"integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@swc/core": {
|
||||
"version": "1.15.5",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.15.5.tgz",
|
||||
@@ -3626,6 +3662,12 @@
|
||||
"@types/react": "^19.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/yandex-maps": {
|
||||
"version": "2.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@types/yandex-maps/-/yandex-maps-2.1.29.tgz",
|
||||
"integrity": "sha512-nuibRWj3RU/9KXlCzTrRtDE+n6V9l7NbT9JakicqZ5OXIdwyb6blvV2Uwn6lB58WYm3DSUDP2I2AWlnWMc8z2w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.49.0.tgz",
|
||||
@@ -8076,6 +8118,22 @@
|
||||
"react": "^19.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/react-hook-form": {
|
||||
"version": "7.68.0",
|
||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.68.0.tgz",
|
||||
"integrity": "sha512-oNN3fjrZ/Xo40SWlHf1yCjlMK417JxoSJVUXQjGdvdRCU07NTFei1i1f8ApUAts+IVh14e4EdakeLEA+BEAs/Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/react-hook-form"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17 || ^18 || ^19"
|
||||
}
|
||||
},
|
||||
"node_modules/react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
@@ -9582,9 +9640,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.2.0.tgz",
|
||||
"integrity": "sha512-Bd5fw9wlIhtqCCxotZgdTOMwGm1a0u75wARVEY9HMs1X17trvA/lMi4+MGK5EUfYkXVTbX8UDiDKW4OgzHVUZw==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.2.1.tgz",
|
||||
"integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@hookform/resolvers": "^5.2.2",
|
||||
"@pbe/react-yandex-maps": "^1.2.5",
|
||||
"@radix-ui/react-accordion": "^1.2.8",
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
||||
"@radix-ui/react-avatar": "^1.1.11",
|
||||
@@ -47,12 +49,13 @@
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"react-hook-form": "^7.68.0",
|
||||
"recharts": "^2.15.3",
|
||||
"sonner": "^2.0.3",
|
||||
"sonner": "^2.0.7",
|
||||
"swiper": "^12.0.3",
|
||||
"tailwind-merge": "^3.2.0",
|
||||
"vaul": "^1.1.2",
|
||||
"zod": "^4.1.11",
|
||||
"zod": "^4.2.1",
|
||||
"zustand": "^5.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
BIN
public/fine-dining-restaurant-plating.jpg
Normal file
BIN
public/fine-dining-restaurant-plating.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
BIN
public/fresh-ingredients-culinary-market.jpg
Normal file
BIN
public/fresh-ingredients-culinary-market.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 227 KiB |
BIN
public/generic-company-logo.png
Normal file
BIN
public/generic-company-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 735 KiB |
BIN
public/gourmet-food-culinary-magazine-hero-image.jpg
Normal file
BIN
public/gourmet-food-culinary-magazine-hero-image.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
BIN
public/professional-chef-cooking-gourmet-food.jpg
Normal file
BIN
public/professional-chef-cooking-gourmet-food.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
15
src/app/[locale]/about/page.tsx
Normal file
15
src/app/[locale]/about/page.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { AboutContent } from '@/features/about/ui/AboutContent';
|
||||
import { AboutHero } from '@/features/about/ui/AboutHero';
|
||||
import { PartnershipForm } from '@/features/about/ui/AboutPage';
|
||||
|
||||
const page = () => {
|
||||
return (
|
||||
<div className="custom-container">
|
||||
<AboutHero />
|
||||
<AboutContent />
|
||||
<PartnershipForm />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default page;
|
||||
11
src/app/[locale]/faq/page.tsx
Normal file
11
src/app/[locale]/faq/page.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import Faq from '@/features/faq/ui/Faq';
|
||||
|
||||
const page = () => {
|
||||
return (
|
||||
<div>
|
||||
<Faq />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default page;
|
||||
@@ -3,6 +3,7 @@ import { routing } from '@/shared/config/i18n/routing';
|
||||
import QueryProvider from '@/shared/config/react-query/QueryProvider';
|
||||
import { ThemeProvider } from '@/shared/config/theme-provider';
|
||||
import { PRODUCT_INFO } from '@/shared/constants/data';
|
||||
import { Toaster } from '@/shared/ui/sonner';
|
||||
import type { Metadata } from 'next';
|
||||
import { hasLocale, Locale, NextIntlClientProvider } from 'next-intl';
|
||||
import { setRequestLocale } from 'next-intl/server';
|
||||
@@ -48,6 +49,7 @@ export default async function RootLayout({ children, params }: Props) {
|
||||
>
|
||||
<QueryProvider>
|
||||
<LayoutShell>{children}</LayoutShell>
|
||||
<Toaster />
|
||||
</QueryProvider>
|
||||
</ThemeProvider>
|
||||
</NextIntlClientProvider>
|
||||
|
||||
11
src/app/[locale]/privacy-policy/page.tsx
Normal file
11
src/app/[locale]/privacy-policy/page.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import PrivacyPolicy from '@/features/privacy-policy/ui/PrivacyPlicy';
|
||||
|
||||
const page = () => {
|
||||
return (
|
||||
<div>
|
||||
<PrivacyPolicy />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default page;
|
||||
110
src/features/about/ui/AboutContent.tsx
Normal file
110
src/features/about/ui/AboutContent.tsx
Normal file
@@ -0,0 +1,110 @@
|
||||
import { Card } from '@/shared/ui/card';
|
||||
import Image from 'next/image';
|
||||
|
||||
export function AboutContent() {
|
||||
const features = [
|
||||
{
|
||||
number: '1',
|
||||
title: 'Sifatli Kontent',
|
||||
description:
|
||||
"Jahon oshpazlik san'ati va zamonaviy gastronomiya tendentsiyalari haqida chuqur maqolalar va tahlillar",
|
||||
},
|
||||
{
|
||||
number: '2',
|
||||
title: 'Professional Jamoa',
|
||||
description:
|
||||
'Tajribali kulinariya mutaxassislari va oshpazlar tomonidan tayyorlangan kontent',
|
||||
},
|
||||
{
|
||||
number: '3',
|
||||
title: 'Yangiliklar',
|
||||
description:
|
||||
"Gastronomiya sohasidagi so'nggi yangiliklar va eng yangi trendlar haqida xabarlar",
|
||||
},
|
||||
];
|
||||
|
||||
const images = [
|
||||
{
|
||||
url: '/professional-chef-cooking-gourmet-food.jpg',
|
||||
alt: 'Professional Oshpaz',
|
||||
},
|
||||
{
|
||||
url: '/fine-dining-restaurant-plating.jpg',
|
||||
alt: 'Fine Dining',
|
||||
},
|
||||
{
|
||||
url: '/fresh-ingredients-culinary-market.jpg',
|
||||
alt: 'Fresh Ingredients',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<section className="py-20 px-4">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Mission Section */}
|
||||
<div className="mb-20">
|
||||
<h2 className="text-4xl md:text-5xl font-bold text-center mb-16 text-balance">
|
||||
Bizning maqsadimiz
|
||||
</h2>
|
||||
<div className="grid md:grid-cols-3 gap-8">
|
||||
{features.map((feature) => (
|
||||
<Card
|
||||
key={feature.number}
|
||||
className="p-8 hover:shadow-lg transition-shadow"
|
||||
>
|
||||
<div className="text-6xl font-bold text-primary mb-4">
|
||||
{feature.number}
|
||||
</div>
|
||||
<h3 className="text-2xl font-semibold mb-4">{feature.title}</h3>
|
||||
<p className="text-muted-foreground leading-relaxed">
|
||||
{feature.description}
|
||||
</p>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* About Text */}
|
||||
<div className="mb-20 max-w-4xl mx-auto text-center">
|
||||
<h2 className="text-3xl md:text-4xl font-bold mb-8 text-balance">
|
||||
Innovatsiya, sifat va professionallik
|
||||
</h2>
|
||||
<p className="text-lg text-muted-foreground leading-relaxed mb-6">
|
||||
{`Gastro Market – bu gastronomiya dunyosidagi eng so'nggi
|
||||
yangiliklarni, retseptlarni va tendentsiyalarni taqdim etuvchi
|
||||
onlayn platforma. Biz o'quvchilarimizga sifatli va qiziqarli kontent
|
||||
taqdim etishga intilamiz.`}
|
||||
</p>
|
||||
<p className="text-lg text-muted-foreground leading-relaxed">
|
||||
{`Bizning jamoamiz tajribali kulinariya mutaxassislari, oshpazlar va
|
||||
gastronomiya sohasidagi ekspertlardan iborat. Biz har bir maqolada
|
||||
sifat va professionallikka e'tibor qaratamiz.`}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Image Gallery */}
|
||||
<div className="mb-20">
|
||||
<h3 className="text-3xl font-bold text-center mb-12 text-balance">
|
||||
Bizning dunyo
|
||||
</h3>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{images.map((image, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className="relative aspect-[4/3] overflow-hidden rounded-lg group"
|
||||
>
|
||||
<Image
|
||||
width={500}
|
||||
height={500}
|
||||
src={image.url || '/placeholder.svg'}
|
||||
alt={image.alt}
|
||||
className="w-full h-full object-cover transition-transform duration-500 group-hover:scale-110"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
27
src/features/about/ui/AboutHero.tsx
Normal file
27
src/features/about/ui/AboutHero.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import Image from 'next/image';
|
||||
|
||||
export function AboutHero() {
|
||||
return (
|
||||
<section className="relative h-[60vh] min-h-[500px] flex items-center justify-center overflow-hidden">
|
||||
<div className="absolute inset-0 z-0">
|
||||
<Image
|
||||
width={500}
|
||||
height={500}
|
||||
src="/gourmet-food-culinary-magazine-hero-image.jpg"
|
||||
alt="Gastro Market"
|
||||
className="w-full h-full object-cover brightness-50"
|
||||
/>
|
||||
</div>
|
||||
<div className="relative z-10 text-center px-4 max-w-4xl mx-auto">
|
||||
<h1 className="text-5xl md:text-7xl font-bold text-white mb-6 text-balance">
|
||||
Gastro Market
|
||||
</h1>
|
||||
<p className="text-xl md:text-2xl text-white/90 font-light leading-relaxed text-balance">
|
||||
{
|
||||
"Gastronomiya va kulinariya san'ati haqidagi yetakchi onlayn magazin"
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
274
src/features/about/ui/AboutPage.tsx
Normal file
274
src/features/about/ui/AboutPage.tsx
Normal file
@@ -0,0 +1,274 @@
|
||||
'use client';
|
||||
|
||||
import formatPhone from '@/shared/lib/formatPhone';
|
||||
import { Button } from '@/shared/ui/button';
|
||||
import { Card } from '@/shared/ui/card';
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from '@/shared/ui/form';
|
||||
import { Input } from '@/shared/ui/input';
|
||||
import { Label } from '@/shared/ui/label';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Upload } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { toast } from 'sonner';
|
||||
import * as z from 'zod';
|
||||
|
||||
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
|
||||
const ACCEPTED_FILE_TYPES = [
|
||||
'application/pdf',
|
||||
'application/msword',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
];
|
||||
|
||||
const partnershipFormSchema = z.object({
|
||||
companyName: z.string().min(2, {
|
||||
message: "Kompaniya nomi kamida 2 ta belgidan iborat bo'lishi kerak",
|
||||
}),
|
||||
website: z
|
||||
.string()
|
||||
.url({ message: "To'g'ri website manzilini kiriting" })
|
||||
.optional()
|
||||
.or(z.literal('')),
|
||||
contactPerson: z
|
||||
.string()
|
||||
.min(2, { message: "Ism kamida 2 ta belgidan iborat bo'lishi kerak" }),
|
||||
email: z
|
||||
.string()
|
||||
.email({ message: "To'g'ri email manzilini kiriting" })
|
||||
.optional(),
|
||||
phone: z
|
||||
.string()
|
||||
.min(9, { message: "To'g'ri telefon raqamini kiriting" })
|
||||
.regex(/^[\d\s+\-$$$$]+$/, {
|
||||
message: "Telefon raqami faqat raqamlardan iborat bo'lishi kerak",
|
||||
}),
|
||||
companyFile: z
|
||||
.custom<FileList>()
|
||||
.refine((files) => files?.length === 1, 'File yuklash majburiy')
|
||||
.refine(
|
||||
(files) => files?.[0]?.size <= MAX_FILE_SIZE,
|
||||
'File hajmi 5MB dan oshmasligi kerak',
|
||||
)
|
||||
.refine(
|
||||
(files) => ACCEPTED_FILE_TYPES.includes(files?.[0]?.type),
|
||||
'Faqat PDF yoki Word formatidagi fayllar qabul qilinadi',
|
||||
),
|
||||
});
|
||||
|
||||
type PartnershipFormValues = z.infer<typeof partnershipFormSchema>;
|
||||
|
||||
export function PartnershipForm() {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
const form = useForm<PartnershipFormValues>({
|
||||
resolver: zodResolver(partnershipFormSchema),
|
||||
defaultValues: {
|
||||
companyName: '',
|
||||
website: '',
|
||||
contactPerson: '',
|
||||
email: '',
|
||||
phone: '+998',
|
||||
},
|
||||
});
|
||||
|
||||
async function onSubmit(data: PartnershipFormValues) {
|
||||
console.log(data);
|
||||
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
toast.success("So'rov yuborildi!", {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
|
||||
form.reset();
|
||||
} catch {
|
||||
toast.error('Xatolik yuz berdi', {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="px-4 mb-5">
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<div className="text-center mb-12">
|
||||
<h2 className="text-4xl md:text-5xl font-bold mb-6 text-balance">
|
||||
{`Hamkor bo'ling`}
|
||||
</h2>
|
||||
<p className="text-lg text-muted-foreground leading-relaxed">
|
||||
{`Gastro Market bilan hamkorlik qilishni xohlaysizmi? Quyidagi formani
|
||||
to'ldiring va biz siz bilan tez orada bog'lanamiz.`}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Card className="p-8 md:p-12">
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="companyName"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label>Kompaniya nomi</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="Kompaniyangiz nomini kiriting"
|
||||
{...field}
|
||||
className="h-12"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="website"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label>Website</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="https://example.com"
|
||||
type="url"
|
||||
className="h-12"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="contactPerson"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label>Ism Familiya</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="Ism va familiya"
|
||||
className="h-12"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col justify-start">
|
||||
<Label>Email</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="example@email.com"
|
||||
type="email"
|
||||
className="h-12"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="phone"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col justify-start">
|
||||
<Label>Telefon raqami</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="+998 90 123 45 67"
|
||||
className="h-12"
|
||||
{...field}
|
||||
value={formatPhone(field.value)}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="companyFile"
|
||||
render={({ field: { onChange, value, ...field } }) => (
|
||||
<FormItem>
|
||||
<Label>Kompaniya hujjati</Label>
|
||||
<FormControl>
|
||||
<div>
|
||||
<Input
|
||||
type="file"
|
||||
id="company file"
|
||||
accept=".pdf,.doc,.docx"
|
||||
onChange={(e) => {
|
||||
const files = e.target.files;
|
||||
onChange(files);
|
||||
}}
|
||||
{...field}
|
||||
className="hidden"
|
||||
/>
|
||||
<FormLabel
|
||||
className="w-full flex justify-center items-center flex-col h-36 border border-gray-200 rounded-2xl cursor-pointer"
|
||||
htmlFor="company file"
|
||||
>
|
||||
<Upload className="size-10 text-muted-foreground" />
|
||||
<p className="text-muted-foreground text-lg">
|
||||
Faylni tanlang
|
||||
</p>
|
||||
{value && value.length > 0 && (
|
||||
<p className="mt-2 text-sm text-gray-500">
|
||||
Tanlangan fayl: {value[0].name}
|
||||
</p>
|
||||
)}
|
||||
</FormLabel>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
PDF yoki Word formatida (maksimal 5MB)
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
size="lg"
|
||||
className="w-full"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? 'Yuborilmoqda...' : "So'rov yuborish"}
|
||||
</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
11
src/features/cart/lib/form.ts
Normal file
11
src/features/cart/lib/form.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const orderForm = z.object({
|
||||
firstName: z.string().min(1, { message: 'Majburiy maydon' }),
|
||||
lastName: z.string().min(1, { message: 'Majburiy maydon' }),
|
||||
phone: z.string().min(12, { message: 'Xato raqam kiritildi' }),
|
||||
long: z.string().min(1, { message: 'Majburiy maydon' }),
|
||||
lat: z.string().min(1, { message: 'Majburiy maydon' }),
|
||||
city: z.string().optional(),
|
||||
});
|
||||
// 998901234567
|
||||
@@ -1,14 +1,24 @@
|
||||
'use client';
|
||||
|
||||
import formatPhone from '@/shared/lib/formatPhone';
|
||||
import { Button } from '@/shared/ui/button';
|
||||
import { Form, FormControl, FormField, FormItem } from '@/shared/ui/form';
|
||||
import { Input } from '@/shared/ui/input';
|
||||
import { Label } from '@/shared/ui/label';
|
||||
import { Textarea } from '@/shared/ui/textarea';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import {
|
||||
Map,
|
||||
Placemark,
|
||||
Polygon,
|
||||
YMaps,
|
||||
ZoomControl,
|
||||
} from '@pbe/react-yandex-maps';
|
||||
import {
|
||||
Building2,
|
||||
CheckCircle2,
|
||||
Clock,
|
||||
CreditCard,
|
||||
LocateFixed,
|
||||
MapPin,
|
||||
Package,
|
||||
Truck,
|
||||
@@ -16,17 +26,27 @@ import {
|
||||
Wallet,
|
||||
} from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import z from 'zod';
|
||||
import { orderForm } from '../lib/form';
|
||||
|
||||
interface CoordsData {
|
||||
lat: number;
|
||||
lon: number;
|
||||
polygon: [number, number][][];
|
||||
}
|
||||
|
||||
const OrderPage = () => {
|
||||
const [formData, setFormData] = useState({
|
||||
fullName: '',
|
||||
phone: '+998',
|
||||
email: '',
|
||||
city: '',
|
||||
address: '',
|
||||
postalCode: '',
|
||||
notes: '',
|
||||
const form = useForm<z.infer<typeof orderForm>>({
|
||||
resolver: zodResolver(orderForm),
|
||||
defaultValues: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
lat: '',
|
||||
long: '',
|
||||
phone: '',
|
||||
},
|
||||
});
|
||||
|
||||
const [paymentMethod, setPaymentMethod] = useState('cash');
|
||||
@@ -34,7 +54,6 @@ const OrderPage = () => {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [orderSuccess, setOrderSuccess] = useState(false);
|
||||
|
||||
// Cart items from previous page (in real app, this would come from context/store)
|
||||
const cartItems = [
|
||||
{
|
||||
id: 5,
|
||||
@@ -67,25 +86,109 @@ const OrderPage = () => {
|
||||
deliveryMethod === 'express' ? 25000 : subtotal > 50000 ? 0 : 15000;
|
||||
const total = subtotal + deliveryFee;
|
||||
|
||||
const handleInputChange = (
|
||||
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
||||
) => {
|
||||
setFormData({
|
||||
...formData,
|
||||
[e.target.name]: e.target.value,
|
||||
});
|
||||
const [coords, setCoords] = useState({
|
||||
latitude: 41.311081,
|
||||
longitude: 69.240562,
|
||||
zoom: 12,
|
||||
});
|
||||
|
||||
const [polygonCoords, setPolygonCoords] = useState<
|
||||
[number, number][][] | null
|
||||
>(null);
|
||||
|
||||
const getCoords = async (name: string): Promise<CoordsData | null> => {
|
||||
const res = await fetch(
|
||||
`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(name)}&format=json&polygon_geojson=1&limit=1`,
|
||||
);
|
||||
const data = await res.json();
|
||||
|
||||
if (data.length > 0 && data[0].geojson) {
|
||||
const lat = parseFloat(data[0].lat);
|
||||
const lon = parseFloat(data[0].lon);
|
||||
|
||||
let polygon: [number, number][][] = [];
|
||||
|
||||
if (data[0].geojson.type === 'Polygon') {
|
||||
polygon = data[0].geojson.coordinates.map((ring: [number, number][]) =>
|
||||
ring.map((coord: [number, number]) => [coord[1], coord[0]]),
|
||||
);
|
||||
} else if (data[0].geojson.type === 'MultiPolygon') {
|
||||
polygon = data[0].geojson.coordinates.map(
|
||||
(poly: [number, number][][]) =>
|
||||
poly[0].map((coord: [number, number]) => [coord[1], coord[0]]),
|
||||
);
|
||||
}
|
||||
|
||||
return { lat, lon, polygon };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
setIsSubmitting(true);
|
||||
const handleMapClick = (
|
||||
e: ymaps.IEvent<MouseEvent, { coords: [number, number] }>,
|
||||
) => {
|
||||
const [lat, lon] = e.get('coords');
|
||||
|
||||
setCoords({ latitude: lat, longitude: lon, zoom: 14 });
|
||||
|
||||
form.setValue('lat', lat.toString(), { shouldDirty: true });
|
||||
form.setValue('long', lon.toString(), { shouldDirty: true });
|
||||
};
|
||||
|
||||
const handleShowMyLocation = () => {
|
||||
if (!navigator.geolocation) {
|
||||
alert('Sizning brauzeringiz geolokatsiyani qo‘llab-quvvatlamaydi');
|
||||
return;
|
||||
}
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(position) => {
|
||||
const lat = position.coords.latitude;
|
||||
const lon = position.coords.longitude;
|
||||
setCoords({ latitude: lat, longitude: lon, zoom: 14 });
|
||||
form.setValue('lat', lat.toString());
|
||||
form.setValue('long', lon.toString());
|
||||
},
|
||||
(error) => {
|
||||
alert('Joylashuv aniqlanmadi: ' + error.message);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const cityValue = form.watch('city');
|
||||
|
||||
useEffect(() => {
|
||||
if (!cityValue || cityValue.length < 3) return;
|
||||
|
||||
const timeout = setTimeout(async () => {
|
||||
const result = await getCoords(cityValue);
|
||||
|
||||
if (!result) return;
|
||||
|
||||
setCoords({
|
||||
latitude: result.lat,
|
||||
longitude: result.lon,
|
||||
zoom: 12,
|
||||
});
|
||||
|
||||
setPolygonCoords(result.polygon);
|
||||
|
||||
form.setValue('lat', result.lat.toString(), { shouldDirty: true });
|
||||
form.setValue('long', result.lon.toString(), { shouldDirty: true });
|
||||
}, 700); // debounce
|
||||
|
||||
return () => clearTimeout(timeout);
|
||||
}, [cityValue]);
|
||||
|
||||
function onSubmit(value: z.infer<typeof orderForm>) {
|
||||
setIsSubmitting(true);
|
||||
console.log(value);
|
||||
|
||||
// Simulate API call
|
||||
setTimeout(() => {
|
||||
setIsSubmitting(false);
|
||||
setOrderSuccess(true);
|
||||
}, 2000);
|
||||
};
|
||||
}
|
||||
|
||||
if (orderSuccess) {
|
||||
return (
|
||||
@@ -133,302 +236,374 @@ const OrderPage = () => {
|
||||
</h1>
|
||||
<p className="text-gray-600">{"Ma'lumotlaringizni to'ldiring"}</p>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
{/* Left Column - Forms */}
|
||||
<div className="lg:col-span-2 space-y-6">
|
||||
{/* Contact Information */}
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<User className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">
|
||||
{"Shaxsiy ma'lumotlar"}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{"To'liq ism"}
|
||||
</Label>
|
||||
<Input
|
||||
type="text"
|
||||
name="fullName"
|
||||
value={formData.fullName}
|
||||
onChange={handleInputChange}
|
||||
required
|
||||
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="Ismingiz va familiyangiz"
|
||||
/>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
{/* Left Column - Forms */}
|
||||
<div className="lg:col-span-2 space-y-6">
|
||||
{/* Contact Information */}
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<User className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">
|
||||
{"Shaxsiy ma'lumotlar"}
|
||||
</h2>
|
||||
</div>
|
||||
<div>
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Telefon raqam
|
||||
</Label>
|
||||
<Input
|
||||
type="tel"
|
||||
name="phone"
|
||||
value={formatPhone(formData.phone)}
|
||||
onChange={handleInputChange}
|
||||
required
|
||||
className="w-full h-12 border border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="+998 90 123 45 67"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Delivery Address */}
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<MapPin className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">
|
||||
Yetkazib berish manzili
|
||||
</h2>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Shahar
|
||||
</Label>
|
||||
<Input
|
||||
type="text"
|
||||
name="city"
|
||||
value={formData.city}
|
||||
onChange={handleInputChange}
|
||||
required
|
||||
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="Toshkent"
|
||||
/>
|
||||
</div>
|
||||
<div className="md:col-span-2">
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{"To'liq manzil"}
|
||||
</Label>
|
||||
<Textarea
|
||||
name="address"
|
||||
value={formData.address}
|
||||
onChange={handleInputChange}
|
||||
required
|
||||
rows={3}
|
||||
className="w-full border min-h-32 max-h-44 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="Ko'cha, uy raqami, xonadon..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<Truck className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">
|
||||
Yetkazib berish usuli
|
||||
</h2>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="delivery"
|
||||
value="standard"
|
||||
checked={deliveryMethod === 'standard'}
|
||||
onChange={(e) => setDeliveryMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex-1">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="w-5 h-5 text-gray-600" />
|
||||
<span className="font-semibold">
|
||||
Standart yetkazib berish
|
||||
</span>
|
||||
</div>
|
||||
<span className="font-bold text-blue-600">
|
||||
{subtotal > 50000 ? 'Bepul' : "15,000 so'm"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
2-3 kun ichida
|
||||
</p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="delivery"
|
||||
value="express"
|
||||
checked={deliveryMethod === 'express'}
|
||||
onChange={(e) => setDeliveryMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex-1">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Package className="w-5 h-5 text-gray-600" />
|
||||
<span className="font-semibold">
|
||||
Tez yetkazib berish
|
||||
</span>
|
||||
</div>
|
||||
<span className="font-bold text-blue-600">
|
||||
{"25,000 so'm"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">1 kun ichida</p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<CreditCard className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">{"To'lov usuli"}</h2>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<Label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="payment"
|
||||
value="cash"
|
||||
checked={paymentMethod === 'cash'}
|
||||
onChange={(e) => setPaymentMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex items-center gap-3">
|
||||
<Wallet className="w-6 h-6 text-green-600" />
|
||||
<div>
|
||||
<span className="font-semibold">Naqd pul</span>
|
||||
<p className="text-sm text-gray-500">
|
||||
{"Yetkazib berishda to'lash"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Label>
|
||||
|
||||
<Label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="payment"
|
||||
value="card"
|
||||
checked={paymentMethod === 'card'}
|
||||
onChange={(e) => setPaymentMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex items-center gap-3">
|
||||
<CreditCard className="w-6 h-6 text-blue-600" />
|
||||
<div>
|
||||
<span className="font-semibold">Plastik karta</span>
|
||||
<p className="text-sm text-gray-500">
|
||||
{"Online to'lov"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Label>
|
||||
|
||||
<Label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="payment"
|
||||
value="terminal"
|
||||
checked={paymentMethod === 'terminal'}
|
||||
onChange={(e) => setPaymentMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex items-center gap-3">
|
||||
<Building2 className="w-6 h-6 text-purple-600" />
|
||||
<div>
|
||||
<span className="font-semibold">Terminal orqali</span>
|
||||
<p className="text-sm text-gray-500">
|
||||
Yetkazib berishda terminal
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right Column - Order Summary */}
|
||||
<div className="lg:col-span-1">
|
||||
<div className="bg-white rounded-lg shadow-md p-6 sticky top-4">
|
||||
<h3 className="text-xl font-bold mb-4">Mahsulotlar</h3>
|
||||
|
||||
{/* Cart Items */}
|
||||
<div className="space-y-3 mb-4 max-h-60 overflow-y-auto">
|
||||
{cartItems.map((item) => (
|
||||
<div key={item.id} className="flex gap-3 pb-3 border-b">
|
||||
<Image
|
||||
width={500}
|
||||
height={500}
|
||||
src={item.image}
|
||||
alt={item.name}
|
||||
className="w-16 h-16 object-contain bg-gray-100 rounded"
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<h4 className="font-medium text-sm">{item.name}</h4>
|
||||
<p className="text-sm text-gray-500">
|
||||
{item.quantity} x {item.price.toLocaleString()}{' '}
|
||||
{"so'm"}
|
||||
</p>
|
||||
<p className="font-semibold text-sm">
|
||||
{(item.price * item.quantity).toLocaleString()}{' '}
|
||||
{"so'm"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Pricing */}
|
||||
<div className="space-y-2 mb-4 pt-4 border-t">
|
||||
<div className="flex justify-between text-gray-600">
|
||||
<span>Mahsulotlar:</span>
|
||||
<span>
|
||||
{subtotal.toLocaleString()} {"so'm"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-gray-600">
|
||||
<span>Yetkazib berish:</span>
|
||||
<span>
|
||||
{deliveryFee === 0 ? (
|
||||
<span className="text-green-600 font-semibold">
|
||||
Bepul
|
||||
</span>
|
||||
) : (
|
||||
`${deliveryFee.toLocaleString()} so'm`
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="firstName"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{'Ism'}
|
||||
</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="Ismingiz"
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
</span>
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="lastName"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{'Familiya'}
|
||||
</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="Familiyangiz"
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="phone"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Telefon raqam
|
||||
</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
value={formatPhone(field.value ?? '')}
|
||||
onChange={(e) => field.onChange(e.target.value)}
|
||||
type="tel"
|
||||
required
|
||||
className="w-full h-12 border border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="+998 90 123 45 67"
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="border-t pt-4 mb-6">
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-lg font-semibold">Jami:</span>
|
||||
<span className="text-2xl font-bold text-blue-600">
|
||||
{total.toLocaleString()} {"so'm"}
|
||||
</span>
|
||||
{/* Delivery Address */}
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<MapPin className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">
|
||||
Yetkazib berish manzili
|
||||
</h2>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="city"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<Label className="block text-sm font-medium text-gray-700">
|
||||
Manzilni qidirish
|
||||
</Label>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||
placeholder="Toshkent"
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="md:col-span-2">
|
||||
<div className="relative h-80 border rounded-lg overflow-hidden">
|
||||
<YMaps query={{ lang: 'en_RU' }}>
|
||||
<Map
|
||||
key={`${coords.latitude}-${coords.longitude}`}
|
||||
state={{
|
||||
center: [coords.latitude, coords.longitude],
|
||||
zoom: coords.zoom,
|
||||
}}
|
||||
width="100%"
|
||||
height="100%"
|
||||
onClick={handleMapClick}
|
||||
>
|
||||
<ZoomControl
|
||||
options={{
|
||||
position: { right: '10px', bottom: '70px' },
|
||||
}}
|
||||
/>
|
||||
<Placemark
|
||||
geometry={[coords.latitude, coords.longitude]}
|
||||
/>
|
||||
{polygonCoords && (
|
||||
<Polygon
|
||||
geometry={polygonCoords}
|
||||
options={{
|
||||
fillColor: 'rgba(0, 150, 255, 0.2)',
|
||||
strokeColor: 'rgba(0, 150, 255, 0.8)',
|
||||
strokeWidth: 2,
|
||||
interactivityModel: 'default#transparent',
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Map>
|
||||
</YMaps>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
onClick={handleShowMyLocation}
|
||||
className="absolute bottom-3 right-2.5 shadow-md bg-white text-black hover:bg-gray-100"
|
||||
>
|
||||
<LocateFixed className="w-4 h-4 mr-1" />
|
||||
Mening joylashuvim
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
className="w-full bg-blue-600 text-white py-4 rounded-lg font-semibold hover:bg-blue-700 transition disabled:bg-gray-400 disabled:cursor-not-allowed"
|
||||
>
|
||||
{isSubmitting ? (
|
||||
<span className="flex items-center justify-center gap-2">
|
||||
<div className="w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin" />
|
||||
Yuborilmoqda...
|
||||
</span>
|
||||
) : (
|
||||
'Buyurtmani tasdiqlash'
|
||||
)}
|
||||
</button>
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<Truck className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">
|
||||
Yetkazib berish usuli
|
||||
</h2>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="delivery"
|
||||
value="standard"
|
||||
checked={deliveryMethod === 'standard'}
|
||||
onChange={(e) => setDeliveryMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex-1">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="w-5 h-5 text-gray-600" />
|
||||
<span className="font-semibold">
|
||||
Standart yetkazib berish
|
||||
</span>
|
||||
</div>
|
||||
<span className="font-bold text-blue-600">
|
||||
{subtotal > 50000 ? 'Bepul' : "15,000 so'm"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
2-3 kun ichida
|
||||
</p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="delivery"
|
||||
value="express"
|
||||
checked={deliveryMethod === 'express'}
|
||||
onChange={(e) => setDeliveryMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex-1">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Package className="w-5 h-5 text-gray-600" />
|
||||
<span className="font-semibold">
|
||||
Tez yetkazib berish
|
||||
</span>
|
||||
</div>
|
||||
<span className="font-bold text-blue-600">
|
||||
{"25,000 so'm"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
1 kun ichida
|
||||
</p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-lg shadow-md p-6">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<CreditCard className="w-5 h-5 text-blue-600" />
|
||||
<h2 className="text-xl font-semibold">{"To'lov usuli"}</h2>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<Label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="payment"
|
||||
value="cash"
|
||||
checked={paymentMethod === 'cash'}
|
||||
onChange={(e) => setPaymentMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex items-center gap-3">
|
||||
<Wallet className="w-6 h-6 text-green-600" />
|
||||
<div>
|
||||
<span className="font-semibold">Naqd pul</span>
|
||||
<p className="text-sm text-gray-500">
|
||||
{"Yetkazib berishda to'lash"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Label>
|
||||
|
||||
<Label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="payment"
|
||||
value="card"
|
||||
checked={paymentMethod === 'card'}
|
||||
onChange={(e) => setPaymentMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex items-center gap-3">
|
||||
<CreditCard className="w-6 h-6 text-blue-600" />
|
||||
<div>
|
||||
<span className="font-semibold">Plastik karta</span>
|
||||
<p className="text-sm text-gray-500">
|
||||
{"Online to'lov"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Label>
|
||||
|
||||
<Label className="flex items-center p-4 border-2 rounded-lg cursor-pointer transition hover:bg-gray-50">
|
||||
<Input
|
||||
type="radio"
|
||||
name="payment"
|
||||
value="terminal"
|
||||
checked={paymentMethod === 'terminal'}
|
||||
onChange={(e) => setPaymentMethod(e.target.value)}
|
||||
className="w-4 h-4 text-blue-600"
|
||||
/>
|
||||
<div className="ml-4 flex items-center gap-3">
|
||||
<Building2 className="w-6 h-6 text-purple-600" />
|
||||
<div>
|
||||
<span className="font-semibold">Terminal orqali</span>
|
||||
<p className="text-sm text-gray-500">
|
||||
Yetkazib berishda terminal
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right Column - Order Summary */}
|
||||
<div className="lg:col-span-1">
|
||||
<div className="bg-white rounded-lg shadow-md p-6 sticky top-4">
|
||||
<h3 className="text-xl font-bold mb-4">Mahsulotlar</h3>
|
||||
|
||||
{/* Cart Items */}
|
||||
<div className="space-y-3 mb-4 max-h-60 overflow-y-auto">
|
||||
{cartItems.map((item) => (
|
||||
<div key={item.id} className="flex gap-3 pb-3 border-b">
|
||||
<Image
|
||||
width={500}
|
||||
height={500}
|
||||
src={item.image}
|
||||
alt={item.name}
|
||||
className="w-16 h-16 object-contain bg-gray-100 rounded"
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<h4 className="font-medium text-sm">{item.name}</h4>
|
||||
<p className="text-sm text-gray-500">
|
||||
{item.quantity} x {item.price.toLocaleString()}{' '}
|
||||
{"so'm"}
|
||||
</p>
|
||||
<p className="font-semibold text-sm">
|
||||
{(item.price * item.quantity).toLocaleString()}{' '}
|
||||
{"so'm"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Pricing */}
|
||||
<div className="space-y-2 mb-4 pt-4 border-t">
|
||||
<div className="flex justify-between text-gray-600">
|
||||
<span>Mahsulotlar:</span>
|
||||
<span>
|
||||
{subtotal.toLocaleString()} {"so'm"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-gray-600">
|
||||
<span>Yetkazib berish:</span>
|
||||
<span>
|
||||
{deliveryFee === 0 ? (
|
||||
<span className="text-green-600 font-semibold">
|
||||
Bepul
|
||||
</span>
|
||||
) : (
|
||||
`${deliveryFee.toLocaleString()} so'm`
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="border-t pt-4 mb-6">
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-lg font-semibold">Jami:</span>
|
||||
<span className="text-2xl font-bold text-blue-600">
|
||||
{total.toLocaleString()} {"so'm"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
className="w-full bg-blue-600 text-white py-4 rounded-lg font-semibold hover:bg-blue-700 transition disabled:bg-gray-400 disabled:cursor-not-allowed"
|
||||
>
|
||||
{isSubmitting ? (
|
||||
<span className="flex items-center justify-center gap-2">
|
||||
<div className="w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin" />
|
||||
Yuborilmoqda...
|
||||
</span>
|
||||
) : (
|
||||
'Buyurtmani tasdiqlash'
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
167
src/features/faq/ui/Faq.tsx
Normal file
167
src/features/faq/ui/Faq.tsx
Normal file
@@ -0,0 +1,167 @@
|
||||
import {
|
||||
Accordion,
|
||||
AccordionContent,
|
||||
AccordionItem,
|
||||
AccordionTrigger,
|
||||
} from '@/shared/ui/accordion';
|
||||
import { Card, CardContent } from '@/shared/ui/card';
|
||||
|
||||
const Faq = () => {
|
||||
const faqCategories = [
|
||||
{
|
||||
category: 'Umumiy Savollar',
|
||||
questions: [
|
||||
{
|
||||
question: 'Gastro Market nima?',
|
||||
answer:
|
||||
"Gastro Market - bu gastronomiya dunyosidagi eng so'nggi yangiliklarni, retseptlarni va tendentsiyalarni taqdim etuvchi professional onlayn platforma. Biz o'quvchilarimizga sifatli va qiziqarli kontent taqdim etamiz.",
|
||||
},
|
||||
{
|
||||
question: 'Kontent qanday chastotada yangilanadi?',
|
||||
answer:
|
||||
"Biz haftada bir necha marta yangi maqolalar, retseptlar va gastronomiya sohasidagi yangiliklarni nashr qilamiz. Eng so'nggi yangilanishlardan xabardor bo'lish uchun bizning ijtimoiy tarmoqlarimizga obuna bo'ling.",
|
||||
},
|
||||
{
|
||||
question: 'Sizning kontentingiz bepulmi?',
|
||||
answer:
|
||||
"Ha, bizning barcha asosiy kontentimiz mutlaqo bepul. Ba'zi maxsus kontent va premium retseptlar premium obuna talab qilishi mumkin, lekin asosiy maqolalar va yangiliklarni hamma o'qiy oladi.",
|
||||
},
|
||||
{
|
||||
question: "Qanday qilib mualliflaringiz bilan bog'lanish mumkin?",
|
||||
answer:
|
||||
"Har bir maqola ostida muallif haqida ma'lumot va bog'lanish uchun email manzili ko'rsatilgan. Shuningdek, siz umumiy savollar uchun info@gastromarket.uz manziliga yozishingiz mumkin.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Hamkorlik',
|
||||
questions: [
|
||||
{
|
||||
question: 'Qanday qilib hamkorlik qilish mumkin?',
|
||||
answer:
|
||||
"Hamkorlik uchun bizning About sahifamizdagi formani to'ldiring yoki to'g'ridan-to'g'ri partnership@gastromarket.uz manziliga yozing. Biz sizning taklifingizni ko'rib chiqamiz va tez orada javob beramiz.",
|
||||
},
|
||||
{
|
||||
question: 'Qanday turdagi hamkorlikni qabul qilasiz?',
|
||||
answer:
|
||||
"Biz turli xil hamkorlik variantlarini ko'rib chiqamiz: reklama joylashtirish, sponsored content, mahsulot sharhlari, tadbirlar hamkorligi va boshqa formatlar. Har bir taklifni individual ko'rib chiqamiz.",
|
||||
},
|
||||
{
|
||||
question: "Hamkorlik so'roviga javob olish uchun qancha vaqt kerak?",
|
||||
answer:
|
||||
"Odatda biz 3-5 ish kuni ichida barcha hamkorlik so'rovlariga javob beramiz. Agar sizning taklifingiz tezkor javob talab qilsa, iltimos so'rovnomada buni ko'rsating.",
|
||||
},
|
||||
{
|
||||
question: 'Hamkorlik uchun minimal talablar bormi?',
|
||||
answer:
|
||||
"Biz har qanday o'lchamdagi kompaniyalar bilan hamkorlik qilishga tayyormiz. Asosiy talabimiz - bu gastronomiya sohasiga aloqadorlik va sifatli mahsulot/xizmat taklifi.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Kontent va Maqolalar',
|
||||
questions: [
|
||||
{
|
||||
question: "O'z retseptimni qanday qilib taklif qilishim mumkin?",
|
||||
answer:
|
||||
"Agar sizda qiziqarli retsept yoki maqola g'oyasi bo'lsa, content@gastromarket.uz manziliga yozing. Biz sizning taklifingizni ko'rib chiqamiz va agar u bizning standartlarimizga mos kelsa, nashr qilish imkoniyatini muhokama qilamiz.",
|
||||
},
|
||||
{
|
||||
question: 'Maqolalarni qayta nashr qilish mumkinmi?',
|
||||
answer:
|
||||
'Bizning maqolalarimizni qayta nashr qilish uchun oldindan ruxsat olishingiz kerak. Iltimos, permissions@gastromarket.uz manziliga murojaat qiling va qaysi maqolani qanday maqsadda ishlatmoqchi ekanligingizni yozing.',
|
||||
},
|
||||
{
|
||||
question:
|
||||
"Maqolalardagi ma'lumotlar ishonchli bo'lishi qanday kafolatlanadi?",
|
||||
answer:
|
||||
"Barcha maqolalarimiz professional oshpazlar va gastronomiya ekspertlari tomonidan tayyorlanadi va ko'rib chiqiladi. Biz faqat tekshirilgan manba va ma'lumotlardan foydalanamiz.",
|
||||
},
|
||||
{
|
||||
question: "Maxsus mavzu bo'yicha maqola yozishni so'rash mumkinmi?",
|
||||
answer:
|
||||
"Ha, albatta! Agar sizni qiziqtirgan maxsus mavzu bo'lsa, request@gastromarket.uz manziliga yozing. Biz sizning taklifingizni ko'rib chiqamiz va mumkin bo'lsa, kelajakdagi nashrlarga kiritamiz.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Texnik Savollar',
|
||||
questions: [
|
||||
{
|
||||
question:
|
||||
'Saytdan foydalanishda muammo yuzaga kelsa nima qilish kerak?',
|
||||
answer:
|
||||
"Agar texnik muammo yuzaga kelsa, iltimos support@gastromarket.uz manziliga yozing va muammoni batafsil tasvirlab bering. Qaysi brauzer va qurilmadan foydalanayotganingizni ham ko'rsating.",
|
||||
},
|
||||
{
|
||||
question: 'Mobil ilova bormi?',
|
||||
answer:
|
||||
"Hozircha bizda maxsus mobil ilova yo'q, lekin saytimiz barcha qurilmalarda yaxshi ishlaydi. Mobil ilovani kelajakda ishlab chiqishni rejalashtirmoqdamiz.",
|
||||
},
|
||||
{
|
||||
question: "Newsletter ga qanday obuna bo'lish mumkin?",
|
||||
answer:
|
||||
"Sayt pastki qismida newsletter obuna formasi mavjud. Email manzilingizni kiriting va bizning haftalik yangiliklardan xabardor bo'ling.",
|
||||
},
|
||||
{
|
||||
question: "Hisobimni qanday o'chirish mumkin?",
|
||||
answer:
|
||||
"Agar hisobingizni o'chirmoqchi bo'lsangiz, support@gastromarket.uz manziliga yozing. Biz sizning so'rovingizni 7 ish kuni ichida bajaramiz va barcha ma'lumotlaringiz o'chiriladi.",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<main className="custom-container">
|
||||
<section className="relative py-5 from-accent/5 to-background">
|
||||
<div className="container mx-auto max-w-4xl text-center">
|
||||
<h1 className="text-4xl md:text-5xl font-bold mb-4 text-balance">
|
||||
{"Tez-tez So'raladigan Savollar"}
|
||||
</h1>
|
||||
<p className="text-lg text-muted-foreground max-w-2xl mx-auto">
|
||||
{"Gastro Market haqida eng ko'p so'raladigan savollarga javoblar"}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="py-5">
|
||||
<>
|
||||
<div className="space-y-12">
|
||||
{faqCategories.map((category, idx) => (
|
||||
<div key={idx}>
|
||||
<h2 className="text-3xl font-bold mb-6 text-balance">
|
||||
{category.category}
|
||||
</h2>
|
||||
<Card>
|
||||
<CardContent className="pt-6">
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
{category.questions.map((faq, qIdx) => (
|
||||
<AccordionItem
|
||||
key={qIdx}
|
||||
value={`item-${idx}-${qIdx}`}
|
||||
className="border-b last:border-b-0"
|
||||
>
|
||||
<AccordionTrigger className="text-left hover:no-underline py-4">
|
||||
<span className="font-semibold text-lg">
|
||||
{faq.question}
|
||||
</span>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="text-muted-foreground leading-relaxed pb-4">
|
||||
{faq.answer}
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
))}
|
||||
</Accordion>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
export default Faq;
|
||||
@@ -13,7 +13,7 @@ const LIKED_PRODUCTS = [
|
||||
name: 'Samsung Galaxy S23 Ultra 256GB, Phantom Black',
|
||||
price: 12500000,
|
||||
oldPrice: 15000000,
|
||||
image: 'https://images.unsplash.com/photo-1610945415295-d9bbf067e59c?w=400',
|
||||
image: '/samsung-galaxy-s24-smartphone.jpg',
|
||||
rating: 4.8,
|
||||
reviews: 342,
|
||||
discount: 17,
|
||||
@@ -22,10 +22,10 @@ const LIKED_PRODUCTS = [
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Apple AirPods Pro 2-chi avlod (USB-C)',
|
||||
name: 'Apple Ipad Pro Tablet',
|
||||
price: 2850000,
|
||||
oldPrice: 3200000,
|
||||
image: 'https://images.unsplash.com/photo-1606841837239-c5a1a4a07af7?w=400',
|
||||
image: '/apple-ipad-pro-tablet.jpg',
|
||||
rating: 4.9,
|
||||
reviews: 567,
|
||||
discount: 11,
|
||||
@@ -34,10 +34,10 @@ const LIKED_PRODUCTS = [
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Sony PlayStation 5 Slim 1TB + 2 ta o'yin",
|
||||
name: 'Apple Watch Series 9',
|
||||
price: 7500000,
|
||||
oldPrice: 8500000,
|
||||
image: 'https://images.unsplash.com/photo-1606813907291-d86efa9b94db?w=400',
|
||||
image: '/apple-watch-series-9-smartwatch.jpg',
|
||||
rating: 4.7,
|
||||
reviews: 234,
|
||||
discount: 12,
|
||||
@@ -49,7 +49,7 @@ const LIKED_PRODUCTS = [
|
||||
name: 'MacBook Air 13 M2 chip, 8GB RAM, 256GB SSD',
|
||||
price: 14200000,
|
||||
oldPrice: 16000000,
|
||||
image: 'https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=400',
|
||||
image: '/apple-macbook-pro-laptop.jpg',
|
||||
rating: 4.9,
|
||||
reviews: 891,
|
||||
liked: true,
|
||||
@@ -61,7 +61,7 @@ const LIKED_PRODUCTS = [
|
||||
name: 'Dyson V15 Detect Simsiz Changyutgich',
|
||||
price: 6800000,
|
||||
oldPrice: 7800000,
|
||||
image: 'https://images.unsplash.com/photo-1558317374-067fb5f30001?w=400',
|
||||
image: '/dyson-v15-detect-vacuum-cleaner.jpg',
|
||||
rating: 4.6,
|
||||
reviews: 178,
|
||||
discount: 13,
|
||||
@@ -70,10 +70,10 @@ const LIKED_PRODUCTS = [
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'Nike Air Max 270 React Erkaklar Krosovkasi',
|
||||
name: 'Coca-Cola',
|
||||
price: 1250000,
|
||||
oldPrice: 1650000,
|
||||
image: 'https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=400',
|
||||
image: '/classic-coca-cola.png',
|
||||
rating: 4.5,
|
||||
liked: true,
|
||||
reviews: 423,
|
||||
|
||||
369
src/features/privacy-policy/ui/PrivacyPlicy.tsx
Normal file
369
src/features/privacy-policy/ui/PrivacyPlicy.tsx
Normal file
@@ -0,0 +1,369 @@
|
||||
import { Card, CardContent } from '@/shared/ui/card';
|
||||
import { Database, Eye, FileText, Lock, Shield, UserCheck } from 'lucide-react';
|
||||
|
||||
const PrivacyPolicy = () => {
|
||||
return (
|
||||
<main className="min-h-screen bg-background">
|
||||
{/* Hero Section */}
|
||||
<section className="relative py-20 px-4 bg-gradient-to-b from-primary/5 to-background">
|
||||
<div className="container mx-auto max-w-4xl text-center">
|
||||
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-6">
|
||||
<Shield className="w-8 h-8 text-primary" />
|
||||
</div>
|
||||
<h1 className="text-4xl md:text-5xl font-bold mb-4 text-balance">
|
||||
Maxfiylik Siyosati
|
||||
</h1>
|
||||
<p className="text-lg text-muted-foreground max-w-2xl mx-auto">
|
||||
{`Gastro Market sizning ma'lumotlaringiz xavfsizligini jiddiy qabul
|
||||
qiladi`}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground mt-4">
|
||||
Oxirgi yangilanish: 16 Dekabr 2025
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Main Content */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="container mx-auto max-w-4xl">
|
||||
{/* Introduction */}
|
||||
<div className="prose prose-lg max-w-none mb-12">
|
||||
<p className="text-muted-foreground leading-relaxed">
|
||||
{`Ushbu Maxfiylik Siyosati Gastro Market online magazinida siz
|
||||
tomonidan taqdim etilgan shaxsiy ma'lumotlarni qanday to'playmiz,
|
||||
ishlatamiz va himoya qilishimizni tushuntiradi. Xizmatlarimizdan
|
||||
foydalanish orqali siz ushbu siyosatda tasvirlangan amaliyotlarga
|
||||
rozilik bildirasiz.`}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Sections */}
|
||||
<div className="space-y-8">
|
||||
{/* Section 1 */}
|
||||
<Card className="border-l-4 border-l-primary">
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="flex-shrink-0">
|
||||
<div className="w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center">
|
||||
<Database className="w-6 h-6 text-primary" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
{"1. Biz To'playdigan Ma'lumotlar"}
|
||||
</h2>
|
||||
<div className="space-y-3 text-muted-foreground">
|
||||
<p className="leading-relaxed">
|
||||
{`Sizning tajribangizni yaxshilash uchun biz quyidagi
|
||||
ma'lumotlarni to'playmiz:`}
|
||||
</p>
|
||||
<ul className="space-y-2 ml-6 list-disc">
|
||||
<li>
|
||||
<strong>{`Shaxsiy Ma'lumotlar`}:</strong> Ism, email
|
||||
manzil, telefon raqami
|
||||
</li>
|
||||
<li>
|
||||
<strong>{"Kompaniya Ma'lumotlari"}:</strong> Kompaniya
|
||||
nomi, website, hamkorlik {"so'rovlari"}
|
||||
</li>
|
||||
<li>
|
||||
<strong>Fayllar:</strong> Hamkorlik uchun yuklangan
|
||||
hujjatlar
|
||||
</li>
|
||||
<li>
|
||||
<strong>{"Texnik Ma'lumotlar"}:</strong> IP manzil,
|
||||
brauzer turi, qurilma {"ma'lumotlari"}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 2 */}
|
||||
<Card className="border-l-4 border-l-accent">
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="flex-shrink-0">
|
||||
<div className="w-12 h-12 rounded-lg bg-accent/10 flex items-center justify-center">
|
||||
<Eye className="w-6 h-6 text-accent" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
2. {"Ma'lumotlardan Foydalanish"}
|
||||
</h2>
|
||||
<div className="space-y-3 text-muted-foreground">
|
||||
<p className="leading-relaxed">
|
||||
{`To'plangan ma'lumotlaringizdan quyidagi maqsadlarda
|
||||
foydalanamiz:`}
|
||||
</p>
|
||||
<ul className="space-y-2 ml-6 list-disc">
|
||||
<li>
|
||||
{
|
||||
"Hamkorlik so'rovlarini qayta ishlash va javob berish"
|
||||
}
|
||||
</li>
|
||||
<li>
|
||||
{`Sizga xizmatlarimiz va yangiliklar haqida ma'lumot
|
||||
berish`}
|
||||
</li>
|
||||
<li>
|
||||
{`Sayt xavfsizligini ta'minlash va firibgarlikka qarshi
|
||||
kurashish`}
|
||||
</li>
|
||||
<li>
|
||||
Foydalanuvchi tajribasini tahlil qilish va yaxshilash
|
||||
</li>
|
||||
<li>Qonuniy talablarni bajarish</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 3 */}
|
||||
<Card className="border-l-4 border-l-chart-2">
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="flex-shrink-0">
|
||||
<div className="w-12 h-12 rounded-lg bg-chart-2/10 flex items-center justify-center">
|
||||
<Lock className="w-6 h-6 text-chart-2" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
3. {"Ma'lumotlar Xavfsizligi"}
|
||||
</h2>
|
||||
<div className="space-y-3 text-muted-foreground">
|
||||
<p className="leading-relaxed">
|
||||
{`Biz sizning shaxsiy ma'lumotlaringizni himoya qilish
|
||||
uchun zamonaviy xavfsizlik choralarini qo'llaymiz:`}
|
||||
</p>
|
||||
<ul className="space-y-2 ml-6 list-disc">
|
||||
<li>
|
||||
{"SSL/TLS shifrlash orqali ma'lumotlar uzatish"}
|
||||
</li>
|
||||
<li>
|
||||
{"Xavfsiz serverlar va ma'lumotlar bazasida saqlash"}
|
||||
</li>
|
||||
<li>Cheklangan kirish huquqlari va autentifikatsiya</li>
|
||||
<li>Doimiy xavfsizlik monitoringi va yangilanishlar</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 4 */}
|
||||
<Card className="border-l-4 border-l-chart-3">
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="flex-shrink-0">
|
||||
<div className="w-12 h-12 rounded-lg bg-chart-3/10 flex items-center justify-center">
|
||||
<FileText className="w-6 h-6 text-chart-3" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
{"4. Ma'lumotlarni Ulashish"}
|
||||
</h2>
|
||||
<div className="space-y-3 text-muted-foreground">
|
||||
<p className="leading-relaxed">
|
||||
{`Biz sizning shaxsiy ma'lumotlaringizni uchinchi
|
||||
shaxslarga sotmaymiz. Ma'lumotlaringiz faqat quyidagi
|
||||
hollarda ulashilishi mumkin:`}
|
||||
</p>
|
||||
<ul className="space-y-2 ml-6 list-disc">
|
||||
<li>Sizning roziligingiz bilan</li>
|
||||
<li>{"Qonuniy talablar bo'yicha"}</li>
|
||||
<li>
|
||||
{`Xizmat ko'rsatuvchi ishonchli hamkorlar bilan
|
||||
(maxfiylik shartnomalari ostida)`}
|
||||
</li>
|
||||
<li>Kompaniya birlashuvi yoki sotilishi holatida</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 5 */}
|
||||
<Card className="border-l-4 border-l-chart-4">
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="flex-shrink-0">
|
||||
<div className="w-12 h-12 rounded-lg bg-chart-4/10 flex items-center justify-center">
|
||||
<UserCheck className="w-6 h-6 text-chart-4" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
5. Sizning Huquqlaringiz
|
||||
</h2>
|
||||
<div className="space-y-3 text-muted-foreground">
|
||||
<p className="leading-relaxed">
|
||||
Sizda quyidagi huquqlar mavjud:
|
||||
</p>
|
||||
<ul className="space-y-2 ml-6 list-disc">
|
||||
<li>
|
||||
<strong>Kirish Huquqi:</strong> {"O'zingiz haqidagi"}
|
||||
{"ma'lumotlarni ko'rish"}
|
||||
</li>
|
||||
<li>
|
||||
<strong>Tuzatish Huquqi:</strong>{' '}
|
||||
{`Noto'g'ri
|
||||
ma'lumotlarni tuzatish`}
|
||||
</li>
|
||||
<li>
|
||||
<strong>{"O'chirish Huquqi"}:</strong>{' '}
|
||||
{`Ma'lumotlaringizni
|
||||
o'chirishni so'rash`}
|
||||
</li>
|
||||
<li>
|
||||
<strong>Rad Etish Huquqi:</strong> Marketing
|
||||
xabarlaridan voz kechish
|
||||
</li>
|
||||
<li>
|
||||
<strong>Portativlik:</strong>{' '}
|
||||
{`Ma'lumotlaringizni
|
||||
boshqa joyga ko'chirish`}
|
||||
</li>
|
||||
</ul>
|
||||
<p className="mt-4 leading-relaxed">
|
||||
Ushbu huquqlardan foydalanish uchun biz bilan{' '}
|
||||
<a
|
||||
href="mailto:info@gastromarket.uz"
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
info@gastromarket.uz
|
||||
</a>{' '}
|
||||
{"orqali bog'laning."}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 6 - Cookies */}
|
||||
<Card>
|
||||
<CardContent className="pt-6">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
6. Cookies va Kuzatish Texnologiyalari
|
||||
</h2>
|
||||
<div className="space-y-3 text-muted-foreground">
|
||||
<p className="leading-relaxed">
|
||||
{`Saytimiz cookies va shunga o'xshash texnologiyalardan
|
||||
foydalanadi. Ulardan foydalanish maqsadi:`}
|
||||
</p>
|
||||
<ul className="space-y-2 ml-6 list-disc">
|
||||
<li>Siz tanlagan parametrlarni eslab qolish</li>
|
||||
<li>
|
||||
Sayt traffic va foydalanuvchi xatti-harakatlarini tahlil
|
||||
qilish
|
||||
</li>
|
||||
<li>
|
||||
{"Marketing kampaniyalarining samaradorligini o'lchash"}
|
||||
</li>
|
||||
</ul>
|
||||
<p className="mt-4 leading-relaxed">
|
||||
Brauzer sozlamalaridan cookies-ni boshqarishingiz mumkin.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 7 - Children */}
|
||||
<Card>
|
||||
<CardContent className="pt-6">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
7. Bolalar Maxfiyligi
|
||||
</h2>
|
||||
<p className="text-muted-foreground leading-relaxed">
|
||||
{`Bizning xizmatlarimiz 16 yoshdan kichik bolalarga
|
||||
mo'ljallanmagan. Agar siz 16 yoshdan kichik bo'lsangiz,
|
||||
iltimos, shaxsiy ma'lumotlaringizni taqdim etishdan oldin
|
||||
ota-onangiz yoki vasiyingizning roziligini oling.`}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Section 8 - Changes */}
|
||||
<Card>
|
||||
<CardContent className="pt-6">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
8. {"Siyosatdagi O'zgarishlar"}
|
||||
</h2>
|
||||
<p className="text-muted-foreground leading-relaxed">
|
||||
{`Biz vaqti-vaqti bilan ushbu Maxfiylik Siyosatini yangilashimiz
|
||||
mumkin. Barcha o'zgarishlar ushbu sahifada e'lon qilinadi va
|
||||
yuqorida "Oxirgi yangilanish" sanasi ko'rsatiladi. Muhim
|
||||
o'zgarishlar bo'lsa, sizni email orqali xabardor qilamiz.`}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Contact Section */}
|
||||
<Card className="bg-primary/5 border-primary/20">
|
||||
<CardContent className="pt-6">
|
||||
<h2 className="text-2xl font-bold mb-4">
|
||||
9. {"Biz Bilan Bog'lanish"}
|
||||
</h2>
|
||||
<p className="text-muted-foreground leading-relaxed mb-4">
|
||||
{`Ushbu Maxfiylik Siyosati yoki shaxsiy ma'lumotlaringiz haqida
|
||||
savollaringiz bo'lsa, biz bilan bog'laning:`}
|
||||
</p>
|
||||
<div className="space-y-2 text-muted-foreground">
|
||||
<p>
|
||||
<strong>Email:</strong>{' '}
|
||||
<a
|
||||
href="mailto:privacy@gastromarket.uz"
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
privacy@gastromarket.uz
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Telefon:</strong>{' '}
|
||||
<a
|
||||
href="tel:+998901234567"
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
+998 90 123 45 67
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Manzil:</strong> {"Toshkent, O'zbekiston"}
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Bottom CTA */}
|
||||
<section className="py-16 px-4 bg-muted/30">
|
||||
<div className="container mx-auto max-w-4xl text-center">
|
||||
<h2 className="text-3xl font-bold mb-4">Savollaringiz Bormi?</h2>
|
||||
<p className="text-muted-foreground mb-6 max-w-2xl mx-auto">
|
||||
{`Maxfiylik siyosati yoki ma'lumotlaringiz xavfsizligi haqida
|
||||
qo'shimcha ma'lumot olish uchun bizga murojaat qiling.`}
|
||||
</p>
|
||||
<a
|
||||
href="mailto:privacy@gastromarket.uz"
|
||||
className="inline-flex items-center justify-center px-6 py-3 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors font-medium"
|
||||
>
|
||||
{"Biz Bilan Bog'laning"}
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
export default PrivacyPolicy;
|
||||
@@ -36,6 +36,12 @@ const ProductDetail = () => {
|
||||
category: 'Ichimliklar',
|
||||
brand: 'Coca-Cola',
|
||||
volume: '1.5L',
|
||||
supplier: {
|
||||
name: 'Global Trade LLC',
|
||||
logo: '/generic-company-logo.png',
|
||||
phone: '+998 90 123 45 67',
|
||||
email: 'info@globaltrade.uz',
|
||||
},
|
||||
images: [
|
||||
'/classic-coca-cola.png',
|
||||
'/clear-soda-bottle.png',
|
||||
@@ -135,7 +141,7 @@ const ProductDetail = () => {
|
||||
<Image
|
||||
width={500}
|
||||
height={500}
|
||||
src={product.images[selectedImage]}
|
||||
src={product.images[selectedImage] || '/placeholder.svg'}
|
||||
alt={product.name}
|
||||
className="w-full h-full object-cover"
|
||||
/>
|
||||
@@ -175,7 +181,7 @@ const ProductDetail = () => {
|
||||
}`}
|
||||
>
|
||||
<Image
|
||||
src={img}
|
||||
src={img || '/placeholder.svg'}
|
||||
alt={`thumb-${index}`}
|
||||
width={150}
|
||||
height={150}
|
||||
@@ -209,7 +215,6 @@ const ProductDetail = () => {
|
||||
))}
|
||||
</div>
|
||||
<span className="text-gray-600">{product.rating}</span>
|
||||
<span className="text-gray-400">({product.reviews} sharh)</span>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
@@ -241,6 +246,26 @@ const ProductDetail = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Supplier/Agency Information Section */}
|
||||
<div className="border border-gray-200 rounded-lg mb-4 bg-gradient-to-r from-blue-50 to-indigo-50">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-fit h-full rounded-lg overflow-hidden">
|
||||
<Image
|
||||
src={product.supplier.logo || '/placeholder.svg'}
|
||||
alt={product.supplier.name}
|
||||
width={60}
|
||||
height={60}
|
||||
className="w-full h-full object-contain p-2"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h4 className="font-bold text-gray-800 text-lg mb-1">
|
||||
{product.supplier.name}
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Quantity Selector */}
|
||||
<div className="mb-6">
|
||||
<label className="text-gray-700 font-medium mb-2 block">
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { PartnershipForm } from '@/features/about/ui/AboutPage';
|
||||
import Faq from '@/features/faq/ui/Faq';
|
||||
import { useRouter } from '@/shared/config/i18n/navigation';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/shared/ui/avatar';
|
||||
import { Badge } from '@/shared/ui/badge';
|
||||
@@ -20,11 +22,13 @@ import {
|
||||
CreditCard,
|
||||
Edit3,
|
||||
Globe,
|
||||
Handshake,
|
||||
Heart,
|
||||
History,
|
||||
Home,
|
||||
LogOut,
|
||||
MapPin,
|
||||
MessageCircleQuestion,
|
||||
Moon,
|
||||
Package,
|
||||
Plus,
|
||||
@@ -236,6 +240,8 @@ const Profile = () => {
|
||||
{ id: 'overview', label: 'Umumiy', icon: Home },
|
||||
{ id: 'orders', label: 'Buyurtmalar', icon: ShoppingBag },
|
||||
{ id: 'history', label: 'Tarix', icon: History },
|
||||
{ id: 'agency', label: "Hamkor bo'lish", icon: Handshake },
|
||||
{ id: 'faq', label: 'Savol javoblar', icon: MessageCircleQuestion },
|
||||
];
|
||||
|
||||
const statistics = {
|
||||
@@ -719,6 +725,12 @@ const Profile = () => {
|
||||
</div>
|
||||
);
|
||||
|
||||
case 'agency':
|
||||
return <PartnershipForm />;
|
||||
|
||||
case 'faq':
|
||||
return <Faq />;
|
||||
|
||||
default:
|
||||
// Overview section
|
||||
return (
|
||||
|
||||
168
src/shared/ui/form.tsx
Normal file
168
src/shared/ui/form.tsx
Normal file
@@ -0,0 +1,168 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import type * as LabelPrimitive from '@radix-ui/react-label';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import {
|
||||
Controller,
|
||||
FormProvider,
|
||||
useFormContext,
|
||||
useFormState,
|
||||
type ControllerProps,
|
||||
type FieldPath,
|
||||
type FieldValues,
|
||||
} from 'react-hook-form';
|
||||
|
||||
import { cn } from '@/shared/lib/utils';
|
||||
import { Label } from '@/shared/ui/label';
|
||||
|
||||
const Form = FormProvider;
|
||||
|
||||
type FormFieldContextValue<
|
||||
TFieldValues extends FieldValues = FieldValues,
|
||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||
> = {
|
||||
name: TName;
|
||||
};
|
||||
|
||||
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
||||
{} as FormFieldContextValue,
|
||||
);
|
||||
|
||||
const FormField = <
|
||||
TFieldValues extends FieldValues = FieldValues,
|
||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||
>({
|
||||
...props
|
||||
}: ControllerProps<TFieldValues, TName>) => {
|
||||
return (
|
||||
<FormFieldContext.Provider value={{ name: props.name }}>
|
||||
<Controller {...props} />
|
||||
</FormFieldContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
const useFormField = () => {
|
||||
const fieldContext = React.useContext(FormFieldContext);
|
||||
const itemContext = React.useContext(FormItemContext);
|
||||
const { getFieldState } = useFormContext();
|
||||
const formState = useFormState({ name: fieldContext.name });
|
||||
const fieldState = getFieldState(fieldContext.name, formState);
|
||||
|
||||
if (!fieldContext) {
|
||||
throw new Error('useFormField should be used within <FormField>');
|
||||
}
|
||||
|
||||
const { id } = itemContext;
|
||||
|
||||
return {
|
||||
id,
|
||||
name: fieldContext.name,
|
||||
formItemId: `${id}-form-item`,
|
||||
formDescriptionId: `${id}-form-item-description`,
|
||||
formMessageId: `${id}-form-item-message`,
|
||||
...fieldState,
|
||||
};
|
||||
};
|
||||
|
||||
type FormItemContextValue = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
const FormItemContext = React.createContext<FormItemContextValue>(
|
||||
{} as FormItemContextValue,
|
||||
);
|
||||
|
||||
function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
const id = React.useId();
|
||||
|
||||
return (
|
||||
<FormItemContext.Provider value={{ id }}>
|
||||
<div
|
||||
data-slot="form-item"
|
||||
className={cn('grid gap-2', className)}
|
||||
{...props}
|
||||
/>
|
||||
</FormItemContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
function FormLabel({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
const { error, formItemId } = useFormField();
|
||||
|
||||
return (
|
||||
<Label
|
||||
data-slot="form-label"
|
||||
data-error={!!error}
|
||||
className={cn('data-[error=true]:text-destructive', className)}
|
||||
htmlFor={formItemId}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
|
||||
const { error, formItemId, formDescriptionId, formMessageId } =
|
||||
useFormField();
|
||||
|
||||
return (
|
||||
<Slot
|
||||
data-slot="form-control"
|
||||
id={formItemId}
|
||||
aria-describedby={
|
||||
!error
|
||||
? `${formDescriptionId}`
|
||||
: `${formDescriptionId} ${formMessageId}`
|
||||
}
|
||||
aria-invalid={!!error}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
||||
const { formDescriptionId } = useFormField();
|
||||
|
||||
return (
|
||||
<p
|
||||
data-slot="form-description"
|
||||
id={formDescriptionId}
|
||||
className={cn('text-muted-foreground text-sm', className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function FormMessage({ className, ...props }: React.ComponentProps<'p'>) {
|
||||
const { error, formMessageId } = useFormField();
|
||||
const body = error ? String(error?.message ?? '') : props.children;
|
||||
|
||||
if (!body) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<p
|
||||
data-slot="form-message"
|
||||
id={formMessageId}
|
||||
className={cn('text-destructive text-sm', className)}
|
||||
{...props}
|
||||
>
|
||||
{body}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
useFormField,
|
||||
Form,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormMessage,
|
||||
FormField,
|
||||
};
|
||||
40
src/shared/ui/sonner.tsx
Normal file
40
src/shared/ui/sonner.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
CircleCheckIcon,
|
||||
InfoIcon,
|
||||
Loader2Icon,
|
||||
OctagonXIcon,
|
||||
TriangleAlertIcon,
|
||||
} from 'lucide-react';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Toaster as Sonner, type ToasterProps } from 'sonner';
|
||||
|
||||
const Toaster = ({ ...props }: ToasterProps) => {
|
||||
const { theme = 'system' } = useTheme();
|
||||
|
||||
return (
|
||||
<Sonner
|
||||
theme={theme as ToasterProps['theme']}
|
||||
className="toaster group"
|
||||
icons={{
|
||||
success: <CircleCheckIcon className="size-4" />,
|
||||
info: <InfoIcon className="size-4" />,
|
||||
warning: <TriangleAlertIcon className="size-4" />,
|
||||
error: <OctagonXIcon className="size-4" />,
|
||||
loading: <Loader2Icon className="size-4 animate-spin" />,
|
||||
}}
|
||||
style={
|
||||
{
|
||||
'--normal-bg': 'var(--popover)',
|
||||
'--normal-text': 'var(--popover-foreground)',
|
||||
'--normal-border': 'var(--border)',
|
||||
'--border-radius': 'var(--radius)',
|
||||
} as React.CSSProperties
|
||||
}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export { Toaster };
|
||||
@@ -48,7 +48,7 @@ export function ProductCard({
|
||||
onClick={() => router.push(`/product/${product.id}`)}
|
||||
className="group relative p-0 overflow-hidden border border-slate-200 bg-white shadow-sm hover:shadow-xl transition-all duration-300 rounded-2xl hover:border-blue-400"
|
||||
>
|
||||
<CardContent className="!p-0">
|
||||
<CardContent className="p-0">
|
||||
<div className="relative overflow-hidden">
|
||||
{product.discount > 0 && (
|
||||
<div className="absolute top-3 left-3 z-10 bg-orange-500 text-white px-2.5 py-1 rounded-full text-sm font-bold">
|
||||
@@ -96,7 +96,7 @@ export function ProductCard({
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<h3 className="font-semibold text-base text-slate-800 line-clamp-2 min-h-[3rem] leading-snug hover:text-blue-600 transition-colors">
|
||||
<h3 className="font-semibold text-base text-slate-800 line-clamp-2 leading-snug hover:text-blue-600 transition-colors">
|
||||
{product.name}
|
||||
</h3>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Link } from '@/shared/config/i18n/navigation';
|
||||
import { PRODUCT_INFO } from '@/shared/constants/data';
|
||||
import formatPhone from '@/shared/lib/formatPhone';
|
||||
import { categoryList } from '@/widgets/welcome/lib/data';
|
||||
@@ -44,9 +45,9 @@ const Footer = () => {
|
||||
key={linkIdx}
|
||||
className="text-muted-foreground hover:text-blue-600 transition-colors cursor-pointer"
|
||||
>
|
||||
<a href={`/category/${link.name}/${e.name}`}>
|
||||
<Link href={`/category/${link.name}/${e.name}`}>
|
||||
{e.name}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</Fragment>
|
||||
@@ -57,13 +58,13 @@ const Footer = () => {
|
||||
<h3 className="mb-4 font-bold text-base text-black">Sahifalar</h3>
|
||||
<ul className="space-y-2 text-sm">
|
||||
<li className="text-muted-foreground hover:text-blue-600 transition-colors cursor-pointer">
|
||||
<a href={'#'}>Biz haqimizda</a>
|
||||
<Link href={'/about'}>Biz haqimizda</Link>
|
||||
</li>
|
||||
<li className="text-muted-foreground hover:text-blue-600 transition-colors cursor-pointer">
|
||||
<a href={'#'}>Mahfiylik siyosati</a>
|
||||
<Link href={'/privacy-policy'}>Maxfiylik siyosati</Link>
|
||||
</li>
|
||||
<li className="text-muted-foreground hover:text-blue-600 transition-colors cursor-pointer">
|
||||
<a href={'#'}>Savol va javoblar</a>
|
||||
<Link href={'/faq'}>Savol va javoblar</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user