تغییرات کلی در backend و frontend
This commit is contained in:
1 parent
a74f4bda48
commit
3dedc89ee1
41 files changed
+2373
-1957
No files matched your search
@@ -60,7 +60,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
const handleLogin = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!phoneNumber || !password) return toast.error("شماره موبایل و رمز عبور الزامی است");
|
||||
|
||||
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await authService.login(phoneNumber, password);
|
||||
@@ -171,7 +171,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
className="fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]"
|
||||
onClick={onClose}
|
||||
/>
|
||||
|
||||
|
||||
{/* Modal content */}
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
@@ -182,10 +182,10 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
>
|
||||
{/* Top highlight bar */}
|
||||
<div className="absolute top-0 left-0 w-full h-2 bg-gradient-to-r from-canino-blue to-indigo-500" />
|
||||
|
||||
|
||||
<div className="p-8 relative">
|
||||
{/* Close Button */}
|
||||
<button
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="absolute top-6 left-6 p-2 rounded-full hover:bg-medical-gray-50 text-medical-gray-400 hover:text-medical-gray-600 transition-colors"
|
||||
>
|
||||
@@ -198,10 +198,10 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
<ShieldCheck className="w-10 h-10 text-canino-blue" />
|
||||
</div>
|
||||
<h2 className="text-3xl font-black text-medical-gray-900 mb-2 italic">
|
||||
ورود به دنیای کانینو
|
||||
ورود به دنیای کانینو
|
||||
</h2>
|
||||
<p className="text-medical-gray-500 text-sm font-bold max-w-[280px]">
|
||||
{view === "otp"
|
||||
{view === "otp"
|
||||
? `کد تایید ارسال شده به شماره ${toPersian(phoneNumber)} را وارد کنید`
|
||||
: "برای دسترسی به پرونده سلامت و سفارشات وارد شوید"}
|
||||
</p>
|
||||
@@ -220,10 +220,10 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-bold text-medical-gray-500">شماره موبایل</label>
|
||||
<input
|
||||
type="tel"
|
||||
<input
|
||||
type="tel"
|
||||
maxLength={11}
|
||||
placeholder="مثال: ۰۹۱۲۳۴۵۶۷۸۹"
|
||||
placeholder="مثال: ۰۹۱۲۳۴۵۶۷۸۹"
|
||||
value={phoneNumber}
|
||||
onChange={(e) => setPhoneNumber(e.target.value.replace(/[^0-9]/g, ''))}
|
||||
disabled={isLoading}
|
||||
@@ -232,26 +232,26 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-bold text-medical-gray-500">رمز عبور</label>
|
||||
<input
|
||||
type="password"
|
||||
placeholder="رمز عبور خود را وارد کنید"
|
||||
<input
|
||||
type="password"
|
||||
placeholder="رمز عبور خود را وارد کنید"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-xl py-3 px-4 focus:ring-2 focus:ring-canino-blue/20 outline-none text-left"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex items-center justify-between pt-2">
|
||||
<button
|
||||
type="button"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setView("otp-phone")}
|
||||
className="text-xs font-bold text-canino-blue hover:underline"
|
||||
>
|
||||
ورود با کد یکبار مصرف (OTP)
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setView("register")}
|
||||
className="text-xs font-bold text-canino-blue hover:underline"
|
||||
>
|
||||
@@ -259,7 +259,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || !phoneNumber || !password}
|
||||
className="w-full py-4 mt-4 bg-canino-blue text-white rounded-xl font-black hover:bg-indigo-700 disabled:opacity-50 transition-all shadow-lg shadow-canino-blue/20 flex items-center justify-center gap-2 cursor-pointer"
|
||||
@@ -281,8 +281,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold text-medical-gray-500">نام</label>
|
||||
<input
|
||||
type="text"
|
||||
<input
|
||||
type="text"
|
||||
value={firstName}
|
||||
onChange={(e) => setFirstName(e.target.value)}
|
||||
disabled={isLoading}
|
||||
@@ -291,8 +291,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold text-medical-gray-500">نام خانوادگی</label>
|
||||
<input
|
||||
type="text"
|
||||
<input
|
||||
type="text"
|
||||
value={lastName}
|
||||
onChange={(e) => setLastName(e.target.value)}
|
||||
disabled={isLoading}
|
||||
@@ -300,11 +300,11 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold text-medical-gray-500">شماره موبایل *</label>
|
||||
<input
|
||||
type="tel"
|
||||
<input
|
||||
type="tel"
|
||||
maxLength={11}
|
||||
value={phoneNumber}
|
||||
onChange={(e) => setPhoneNumber(e.target.value.replace(/[^0-9]/g, ''))}
|
||||
@@ -315,8 +315,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold text-medical-gray-500">ایمیل (اختیاری)</label>
|
||||
<input
|
||||
type="email"
|
||||
<input
|
||||
type="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
disabled={isLoading}
|
||||
@@ -326,8 +326,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
|
||||
<div className="space-y-1">
|
||||
<label className="text-xs font-bold text-medical-gray-500">رمز عبور *</label>
|
||||
<input
|
||||
type="password"
|
||||
<input
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
@@ -336,8 +336,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</div>
|
||||
|
||||
<div className="flex justify-start pt-1">
|
||||
<button
|
||||
type="button"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setView("login")}
|
||||
className="text-xs font-bold text-canino-blue hover:underline"
|
||||
>
|
||||
@@ -345,7 +345,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || !phoneNumber || !password || !firstName || !lastName}
|
||||
className="w-full py-3 mt-2 bg-canino-blue text-white rounded-xl font-black hover:bg-indigo-700 disabled:opacity-50 transition-all flex items-center justify-center gap-2 cursor-pointer"
|
||||
@@ -367,8 +367,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between items-center">
|
||||
<label className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest">شماره موبایل</label>
|
||||
<button
|
||||
type="button"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setView("login")}
|
||||
className="text-[10px] font-black text-canino-blue hover:underline"
|
||||
>
|
||||
@@ -377,11 +377,11 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</div>
|
||||
<div className="relative">
|
||||
<Phone className="absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 text-medical-gray-400" />
|
||||
<input
|
||||
<input
|
||||
autoFocus
|
||||
type="tel"
|
||||
type="tel"
|
||||
maxLength={11}
|
||||
placeholder="مثال: ۰۹۱۲۳۴۵۶۷۸۹"
|
||||
placeholder="مثال: ۰۹۱۲۳۴۵۶۷۸۹"
|
||||
value={phoneNumber}
|
||||
onChange={(e) => setPhoneNumber(e.target.value.replace(/[^0-9]/g, ''))}
|
||||
disabled={isLoading}
|
||||
@@ -390,7 +390,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || phoneNumber.length < 11}
|
||||
className="w-full py-5 bg-canino-blue text-white rounded-2xl font-black text-xl hover:bg-indigo-700 disabled:opacity-50 transition-all shadow-xl shadow-canino-blue/20 flex items-center justify-center gap-3 cursor-pointer"
|
||||
@@ -419,8 +419,8 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between items-center">
|
||||
<label className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest">کد تایید پیامکی</label>
|
||||
<button
|
||||
type="button"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setView("otp-phone")}
|
||||
className="text-[10px] font-black text-canino-blue flex items-center gap-1 hover:underline"
|
||||
>
|
||||
@@ -430,11 +430,11 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
</div>
|
||||
<div className="relative">
|
||||
<Key className="absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 text-medical-gray-400" />
|
||||
<input
|
||||
<input
|
||||
ref={otpInputRef}
|
||||
type="text"
|
||||
type="text"
|
||||
maxLength={5}
|
||||
placeholder="کد ۵ رقمی"
|
||||
placeholder="کد ۵ رقمی"
|
||||
value={otpCode}
|
||||
onChange={(e) => setOtpCode(e.target.value.replace(/[^0-9]/g, ''))}
|
||||
disabled={isLoading}
|
||||
@@ -449,7 +449,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
ارسال مجدد کد پس از {toPersian(countdown)} ثانیه
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleResendOtp}
|
||||
disabled={isLoading}
|
||||
@@ -461,7 +461,7 @@ export default function AuthModal({ isOpen, onClose }: AuthModalProps) {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || otpCode.length < 5}
|
||||
className="w-full py-5 bg-canino-blue text-white rounded-2xl font-black text-xl hover:bg-indigo-700 disabled:opacity-50 transition-all shadow-xl shadow-canino-blue/20 flex items-center justify-center gap-3 cursor-pointer"
|
||||
|
||||
@@ -6,316 +6,316 @@ import { Product } from "../lib/data/products";
|
||||
import { productService } from "../lib/services/productService";
|
||||
|
||||
export interface BlogPost {
|
||||
id: string;
|
||||
slug: string;
|
||||
title: string;
|
||||
excerpt: string;
|
||||
image: string;
|
||||
date: string;
|
||||
author: string;
|
||||
content: string;
|
||||
id: string;
|
||||
slug: string;
|
||||
title: string;
|
||||
excerpt: string;
|
||||
image: string;
|
||||
date: string;
|
||||
author: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function BlogPage({ blogs = [] }: { blogs: BlogPost[] }) {
|
||||
const router = useRouter();
|
||||
const [selectedPost, setSelectedPost] = React.useState<BlogPost | null>(null);
|
||||
const [products, setProducts] = React.useState<Product[]>([]);
|
||||
const router = useRouter();
|
||||
const [selectedPost, setSelectedPost] = React.useState<BlogPost | null>(null);
|
||||
const [products, setProducts] = React.useState<Product[]>([]);
|
||||
|
||||
React.useEffect(() => {
|
||||
productService.getProducts().then(data => setProducts(data));
|
||||
}, []);
|
||||
React.useEffect(() => {
|
||||
productService.getProducts().then(data => setProducts(data));
|
||||
}, []);
|
||||
|
||||
if (selectedPost) {
|
||||
return (
|
||||
<div className="min-h-screen bg-medical-gray-50 pt-8 pb-20 px-4 font-vazir" dir="rtl">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Breadcrumbs */}
|
||||
<div className="flex items-center gap-2 text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-10">
|
||||
<span className="cursor-pointer hover:text-canino-blue" onClick={() => router.push('/')}>خانه</span>
|
||||
<ChevronRight className="w-2.5 h-2.5" />
|
||||
<span className="cursor-pointer hover:text-canino-blue" onClick={() => setSelectedPost(null)}>مجله سلامت</span>
|
||||
<ChevronRight className="w-2.5 h-2.5" />
|
||||
<span className="text-canino-blue">{selectedPost.title}</span>
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-12">
|
||||
<div className="lg:col-span-8">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="bg-white rounded-[3.5rem] border border-medical-gray-200 shadow-2xl overflow-hidden"
|
||||
>
|
||||
<div className="aspect-video w-full overflow-hidden">
|
||||
<img src={selectedPost.image} alt={selectedPost.title} className="w-full h-full object-cover" />
|
||||
</div>
|
||||
<div className="p-12">
|
||||
<div className="flex items-center gap-4 text-xs font-bold text-canino-blue mb-8">
|
||||
<div className="bg-canino-blue/10 px-4 py-1.5 rounded-full uppercase tracking-widest">تحقیق بالینی</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Calendar className="w-4 h-4" />
|
||||
{selectedPost.date}
|
||||
</div>
|
||||
</div>
|
||||
<h1 className="text-4xl lg:text-5xl font-black text-medical-gray-900 mb-10 leading-tight">
|
||||
{selectedPost.title}
|
||||
</h1>
|
||||
<div className="prose prose-lg max-w-none text-medical-gray-600 leading-[2] text-justify space-y-6">
|
||||
<p className="font-bold text-medical-gray-900 italic text-xl border-r-4 border-canino-blue pr-6 py-2">
|
||||
{selectedPost.excerpt}
|
||||
</p>
|
||||
<div className="whitespace-pre-line">
|
||||
{selectedPost.content}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-16 pt-10 border-t border-medical-gray-100 flex items-center justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-14 h-14 bg-medical-gray-100 rounded-full flex items-center justify-center text-medical-gray-400 border-2 border-white shadow-lg">
|
||||
<User className="w-8 h-8" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="font-black text-medical-gray-900 text-lg">{selectedPost.author}</div>
|
||||
<div className="font-bold text-medical-gray-400">تیم تحقیق و توسعه کانینو آلمان</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<button className="p-4 bg-medical-gray-100 rounded-2xl hover:bg-canino-blue hover:text-white transition-all text-medical-gray-400">
|
||||
<Sparkles className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-4 space-y-10">
|
||||
<div className="bg-canino-blue rounded-[3rem] p-10 text-white shadow-2xl relative overflow-hidden">
|
||||
<div className="absolute top-0 left-0 p-8 opacity-10">
|
||||
<Sparkles className="w-20 h-20" />
|
||||
</div>
|
||||
<h4 className="text-2xl font-black mb-6 italic relative z-10">محصولات پیشنهادی</h4>
|
||||
<div className="space-y-6 relative z-10">
|
||||
{products.slice(4, 7).map(p => (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => router.push(`/shop/${p.id}`)}
|
||||
className="bg-white/10 border border-white/20 p-4 rounded-3xl flex items-center gap-4 cursor-pointer hover:bg-white/20 transition-all group"
|
||||
>
|
||||
<div className="w-16 h-16 bg-white rounded-2xl p-2 shrink-0 group-hover:scale-110 transition-transform">
|
||||
<img src={p.image} alt={p.name} className="w-full h-full object-contain" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-[10px] font-black opacity-50 uppercase tracking-widest">{p.category}</div>
|
||||
<div className="text-sm font-black font-vazir text-white">{p.name}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
if (selectedPost) {
|
||||
return (
|
||||
<div className="min-h-screen bg-medical-gray-50 pt-8 pb-20 px-4 font-vazir" dir="rtl">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Breadcrumbs */}
|
||||
<div className="flex items-center gap-2 text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-10">
|
||||
<span className="cursor-pointer hover:text-canino-blue" onClick={() => router.push('/')}>خانه</span>
|
||||
<ChevronRight className="w-2.5 h-2.5" />
|
||||
<span className="cursor-pointer hover:text-canino-blue" onClick={() => setSelectedPost(null)}>مجله سلامت</span>
|
||||
<ChevronRight className="w-2.5 h-2.5" />
|
||||
<span className="text-canino-blue">{selectedPost.title}</span>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-[3rem] border border-medical-gray-200 p-10 shadow-xl">
|
||||
<h4 className="text-xl font-black italic mb-6">محبوبترین مقالات</h4>
|
||||
<div className="space-y-6">
|
||||
{blogs.map(p => (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => router.push(`/blog/${p.slug}`)}
|
||||
className="flex items-center gap-4 cursor-pointer group"
|
||||
>
|
||||
<div className="w-16 h-16 rounded-2xl overflow-hidden shrink-0">
|
||||
<img src={p.image} className="w-full h-full object-cover group-hover:scale-110 transition-transform" />
|
||||
</div>
|
||||
<div className="text-sm font-black text-medical-gray-900 group-hover:text-canino-blue transition-colors line-clamp-2">
|
||||
{p.title}
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid lg:grid-cols-12 gap-12">
|
||||
<div className="lg:col-span-8">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="bg-white rounded-[3.5rem] border border-medical-gray-200 shadow-2xl overflow-hidden"
|
||||
>
|
||||
<div className="aspect-video w-full overflow-hidden">
|
||||
<img src={selectedPost.image} alt={selectedPost.title} className="w-full h-full object-cover" />
|
||||
</div>
|
||||
<div className="p-12">
|
||||
<div className="flex items-center gap-4 text-xs font-bold text-canino-blue mb-8">
|
||||
<div className="bg-canino-blue/10 px-4 py-1.5 rounded-full uppercase tracking-widest">تحقیق بالینی</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Calendar className="w-4 h-4" />
|
||||
{selectedPost.date}
|
||||
</div>
|
||||
</div>
|
||||
<h1 className="text-4xl lg:text-5xl font-black text-medical-gray-900 mb-10 leading-tight">
|
||||
{selectedPost.title}
|
||||
</h1>
|
||||
<div className="prose prose-lg max-w-none text-medical-gray-600 leading-[2] text-justify space-y-6">
|
||||
<p className="font-bold text-medical-gray-900 italic text-xl border-r-4 border-canino-blue pr-6 py-2">
|
||||
{selectedPost.excerpt}
|
||||
</p>
|
||||
<div className="whitespace-pre-line">
|
||||
{selectedPost.content}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-16 pt-10 border-t border-medical-gray-100 flex items-center justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-14 h-14 bg-medical-gray-100 rounded-full flex items-center justify-center text-medical-gray-400 border-2 border-white shadow-lg">
|
||||
<User className="w-8 h-8" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="font-black text-medical-gray-900 text-lg">{selectedPost.author}</div>
|
||||
<div className="font-bold text-medical-gray-400">تیم تحقیق و توسعه کانینو آلمان</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<button className="p-4 bg-medical-gray-100 rounded-2xl hover:bg-canino-blue hover:text-white transition-all text-medical-gray-400">
|
||||
<Sparkles className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-4 space-y-10">
|
||||
<div className="bg-canino-blue rounded-[3rem] p-10 text-white shadow-2xl relative overflow-hidden">
|
||||
<div className="absolute top-0 left-0 p-8 opacity-10">
|
||||
<Sparkles className="w-20 h-20" />
|
||||
</div>
|
||||
<h4 className="text-2xl font-black mb-6 italic relative z-10">محصولات پیشنهادی</h4>
|
||||
<div className="space-y-6 relative z-10">
|
||||
{products.slice(4, 7).map(p => (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => router.push(`/shop/${p.id}`)}
|
||||
className="bg-white/10 border border-white/20 p-4 rounded-3xl flex items-center gap-4 cursor-pointer hover:bg-white/20 transition-all group"
|
||||
>
|
||||
<div className="w-16 h-16 bg-white rounded-2xl p-2 shrink-0 group-hover:scale-110 transition-transform">
|
||||
<img src={p.image} alt={p.name} className="w-full h-full object-contain" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-[10px] font-black opacity-50 uppercase tracking-widest">{p.category}</div>
|
||||
<div className="text-sm font-black font-vazir text-white">{p.name}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-[3rem] border border-medical-gray-200 p-10 shadow-xl">
|
||||
<h4 className="text-xl font-black italic mb-6">محبوبترین مقالات</h4>
|
||||
<div className="space-y-6">
|
||||
{blogs.map(p => (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => router.push(`/blog/${p.slug}`)}
|
||||
className="flex items-center gap-4 cursor-pointer group"
|
||||
>
|
||||
<div className="w-16 h-16 rounded-2xl overflow-hidden shrink-0">
|
||||
<img src={p.image} className="w-full h-full object-cover group-hover:scale-110 transition-transform" />
|
||||
</div>
|
||||
<div className="text-sm font-black text-medical-gray-900 group-hover:text-canino-blue transition-colors line-clamp-2">
|
||||
{p.title}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-medical-gray-50 pt-8 pb-20 px-4 font-vazir" dir="rtl">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Header */}
|
||||
<div className="flex flex-col md:flex-row items-center justify-between mb-16 gap-6">
|
||||
<div className="text-right">
|
||||
<div className="inline-flex items-center gap-2 px-3 py-1 bg-canino-blue/10 text-canino-blue rounded-full text-[10px] font-black uppercase tracking-widest mb-4">
|
||||
<BookOpen className="w-3 h-3" />
|
||||
Canino Science Blog
|
||||
</div>
|
||||
<h1 className="text-4xl lg:text-6xl font-black text-medical-gray-900 italic leading-tight">
|
||||
مجله تخصصی <span className="text-canino-blue">سلامت پتها</span>
|
||||
</h1>
|
||||
<p className="text-lg text-medical-gray-500 font-medium mt-4 max-w-xl">
|
||||
آخرین یافتههای علمی محققین کانینو آلمان در مورد تغذیه و سلامت پتها.
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="px-8 py-3 bg-white border border-medical-gray-200 rounded-2xl text-medical-gray-700 shadow-sm flex items-center gap-2 font-black hover:bg-medical-gray-50 transition-all"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
بازگشت به خانه
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Featured Post */}
|
||||
{blogs.length > 0 && (
|
||||
<div className="mb-20">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="bg-white rounded-[3.5rem] overflow-hidden border border-medical-gray-200 shadow-2xl flex flex-col lg:flex-row cursor-pointer group"
|
||||
onClick={() => router.push(`/blog/${blogs[0].slug}`)}
|
||||
>
|
||||
<div className="lg:w-1/2 aspect-video lg:aspect-auto">
|
||||
<img
|
||||
src={blogs[0].image}
|
||||
alt={blogs[0].title}
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
|
||||
/>
|
||||
</div>
|
||||
<div className="lg:w-1/2 p-12 flex flex-col justify-center">
|
||||
<div className="flex items-center gap-4 text-xs font-bold text-canino-blue mb-6">
|
||||
<div className="bg-canino-blue/10 px-3 py-1 rounded-full uppercase tracking-widest">تخصصی</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Calendar className="w-3 h-3" />
|
||||
{blogs[0].date}
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="text-3xl lg:text-4xl font-black text-medical-gray-900 mb-6 leading-tight group-hover:text-canino-blue transition-colors">
|
||||
{blogs[0].title}
|
||||
</h2>
|
||||
<p className="text-lg text-medical-gray-500 mb-8 leading-relaxed italic">
|
||||
{blogs[0].excerpt}
|
||||
</p>
|
||||
<div className="flex items-center justify-between pt-8 border-t border-medical-gray-100">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-medical-gray-100 rounded-full flex items-center justify-center text-medical-gray-400">
|
||||
<User className="w-6 h-6" />
|
||||
</div>
|
||||
<div className="text-sm">
|
||||
<div className="font-black text-medical-gray-900">{blogs[0].author}</div>
|
||||
<div className="font-bold text-medical-gray-400">نویسنده کانینو</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-canino-blue font-black">
|
||||
ادامه مطلب
|
||||
<ArrowLeft className="w-5 h-5 group-hover:-translate-x-2 transition-transform" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Post Grid */}
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
{blogs.slice(1).map((post, idx) => (
|
||||
<motion.div
|
||||
key={post.id}
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: idx * 0.1 }}
|
||||
className="bg-white rounded-[3rem] overflow-hidden border border-medical-gray-200 shadow-xl group hover:shadow-2xl transition-all cursor-pointer"
|
||||
onClick={() => router.push(`/blog/${post.slug}`)}
|
||||
>
|
||||
<div className="aspect-[16/9] overflow-hidden">
|
||||
<img
|
||||
src={post.image}
|
||||
alt={post.title}
|
||||
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-8">
|
||||
<div className="flex items-center gap-4 text-[10px] font-bold text-canino-blue mb-4">
|
||||
<div className="flex items-center gap-1">
|
||||
<Calendar className="w-3 h-3" />
|
||||
{post.date}
|
||||
</div>
|
||||
</div>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 mb-4 group-hover:text-canino-blue transition-colors">
|
||||
{post.title}
|
||||
</h3>
|
||||
<p className="text-sm text-medical-gray-500 mb-8 leading-relaxed line-clamp-2">
|
||||
{post.excerpt}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 text-medical-gray-900 font-bold group">
|
||||
مطالعه مقاله
|
||||
<ArrowLeft className="w-4 h-4 group-hover:-translate-x-1 transition-transform" />
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
))}
|
||||
|
||||
{/* Newsletter / CTA Box */}
|
||||
<div className="bg-canino-blue rounded-[3rem] p-10 text-white relative overflow-hidden flex flex-col justify-center">
|
||||
<div className="absolute top-0 right-0 p-8 opacity-20">
|
||||
<Sparkles className="w-24 h-24" />
|
||||
</div>
|
||||
<h3 className="text-3xl font-black mb-4 italic">مشترک خبرنامه علمی شوید</h3>
|
||||
<p className="text-white/80 mb-8 font-medium leading-relaxed">
|
||||
ماهانه یک ایمیل حاوی مهمترین نکات سلامت پتها و کدهای تخفیف اختصاصی دریافت کنید.
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
type="email"
|
||||
placeholder="آدرس ایمیل شما"
|
||||
className="flex-1 bg-white/10 border border-white/20 rounded-xl px-4 py-3 outline-none focus:bg-white/20 placeholder:text-white/40"
|
||||
/>
|
||||
<button className="bg-white text-canino-blue px-6 py-3 rounded-xl font-black">
|
||||
عضویت
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Synergy Products Cross-sell */}
|
||||
<section className="mt-32 p-12 bg-canino-blue rounded-[4rem] text-white overflow-hidden relative shadow-2xl">
|
||||
<div className="absolute inset-0 opacity-20 pointer-events-none">
|
||||
<div className="grid grid-cols-6 h-full w-full">
|
||||
{Array.from({ length: 36 }).map((_, i) => (
|
||||
<div key={i} className="border border-white/20" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-medical-gray-50 pt-8 pb-20 px-4 font-vazir" dir="rtl">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Header */}
|
||||
<div className="flex flex-col md:flex-row items-center justify-between mb-16 gap-6">
|
||||
<div className="text-right">
|
||||
<div className="inline-flex items-center gap-2 px-3 py-1 bg-canino-blue/10 text-canino-blue rounded-full text-[10px] font-black uppercase tracking-widest mb-4">
|
||||
<BookOpen className="w-3 h-3" />
|
||||
Canino Science Blog
|
||||
</div>
|
||||
<h1 className="text-4xl lg:text-6xl font-black text-medical-gray-900 italic leading-tight">
|
||||
مجله تخصصی <span className="text-canino-blue">سلامت پتها</span>
|
||||
</h1>
|
||||
<p className="text-lg text-medical-gray-500 font-medium mt-4 max-w-xl">
|
||||
آخرین یافتههای علمی محققین کانینو آلمان در مورد تغذیه و سلامت پتها.
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="px-8 py-3 bg-white border border-medical-gray-200 rounded-2xl text-medical-gray-700 shadow-sm flex items-center gap-2 font-black hover:bg-medical-gray-50 transition-all"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
بازگشت به خانه
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Featured Post */}
|
||||
{blogs.length > 0 && (
|
||||
<div className="mb-20">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="bg-white rounded-[3.5rem] overflow-hidden border border-medical-gray-200 shadow-2xl flex flex-col lg:flex-row cursor-pointer group"
|
||||
onClick={() => router.push(`/blog/${blogs[0].slug}`)}
|
||||
>
|
||||
<div className="lg:w-1/2 aspect-video lg:aspect-auto">
|
||||
<img
|
||||
src={blogs[0].image}
|
||||
alt={blogs[0].title}
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
|
||||
/>
|
||||
</div>
|
||||
<div className="lg:w-1/2 p-12 flex flex-col justify-center">
|
||||
<div className="flex items-center gap-4 text-xs font-bold text-canino-blue mb-6">
|
||||
<div className="bg-canino-blue/10 px-3 py-1 rounded-full uppercase tracking-widest">تخصصی</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Calendar className="w-3 h-3" />
|
||||
{blogs[0].date}
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="text-3xl lg:text-4xl font-black text-medical-gray-900 mb-6 leading-tight group-hover:text-canino-blue transition-colors">
|
||||
{blogs[0].title}
|
||||
</h2>
|
||||
<p className="text-lg text-medical-gray-500 mb-8 leading-relaxed italic">
|
||||
{blogs[0].excerpt}
|
||||
</p>
|
||||
<div className="flex items-center justify-between pt-8 border-t border-medical-gray-100">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-medical-gray-100 rounded-full flex items-center justify-center text-medical-gray-400">
|
||||
<User className="w-6 h-6" />
|
||||
</div>
|
||||
<div className="text-sm">
|
||||
<div className="font-black text-medical-gray-900">{blogs[0].author}</div>
|
||||
<div className="font-bold text-medical-gray-400">نویسنده کانینو</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-canino-blue font-black">
|
||||
ادامه مطلب
|
||||
<ArrowLeft className="w-5 h-5 group-hover:-translate-x-2 transition-transform" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Post Grid */}
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
{blogs.slice(1).map((post, idx) => (
|
||||
<motion.div
|
||||
key={post.id}
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: idx * 0.1 }}
|
||||
className="bg-white rounded-[3rem] overflow-hidden border border-medical-gray-200 shadow-xl group hover:shadow-2xl transition-all cursor-pointer"
|
||||
onClick={() => router.push(`/blog/${post.slug}`)}
|
||||
>
|
||||
<div className="aspect-[16/9] overflow-hidden">
|
||||
<img
|
||||
src={post.image}
|
||||
alt={post.title}
|
||||
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-8">
|
||||
<div className="flex items-center gap-4 text-[10px] font-bold text-canino-blue mb-4">
|
||||
<div className="flex items-center gap-1">
|
||||
<Calendar className="w-3 h-3" />
|
||||
{post.date}
|
||||
</div>
|
||||
</div>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 mb-4 group-hover:text-canino-blue transition-colors">
|
||||
{post.title}
|
||||
</h3>
|
||||
<p className="text-sm text-medical-gray-500 mb-8 leading-relaxed line-clamp-2">
|
||||
{post.excerpt}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 text-medical-gray-900 font-bold group">
|
||||
مطالعه مقاله
|
||||
<ArrowLeft className="w-4 h-4 group-hover:-translate-x-1 transition-transform" />
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
))}
|
||||
|
||||
{/* Newsletter / CTA Box */}
|
||||
<div className="bg-canino-blue rounded-[3rem] p-10 text-white relative overflow-hidden flex flex-col justify-center">
|
||||
<div className="absolute top-0 right-0 p-8 opacity-20">
|
||||
<Sparkles className="w-24 h-24" />
|
||||
</div>
|
||||
<h3 className="text-3xl font-black mb-4 italic">مشترک خبرنامه علمی شوید</h3>
|
||||
<p className="text-white/80 mb-8 font-medium leading-relaxed">
|
||||
ماهانه یک ایمیل حاوی مهمترین نکات سلامت پتها و کدهای تخفیف اختصاصی دریافت کنید.
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
type="email"
|
||||
placeholder="آدرس ایمیل شما"
|
||||
className="flex-1 bg-white/10 border border-white/20 rounded-xl px-4 py-3 outline-none focus:bg-white/20 placeholder:text-white/40"
|
||||
/>
|
||||
<button className="bg-white text-canino-blue px-6 py-3 rounded-xl font-black">
|
||||
عضویت
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Synergy Products Cross-sell */}
|
||||
<section className="mt-32 p-12 bg-canino-blue rounded-[4rem] text-white overflow-hidden relative shadow-2xl">
|
||||
<div className="absolute inset-0 opacity-20 pointer-events-none">
|
||||
<div className="grid grid-cols-6 h-full w-full">
|
||||
{Array.from({length: 36}).map((_, i) => (
|
||||
<div key={i} className="border border-white/20" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="relative z-10 flex flex-col lg:flex-row items-center gap-12">
|
||||
<div className="flex-1">
|
||||
<h3 className="text-3xl lg:text-4xl font-black italic mb-6">علم آلمانی در خدمت سلامت پت شما</h3>
|
||||
<p className="text-white/80 mb-8 leading-relaxed max-w-xl">
|
||||
تمامی مقالات این وبلاگ بر اساس کاتالوگهای رسمی و نتایج آزمایشگاهی کمپانی کانینو آلمان تدوین شده است.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => router.push('/shop')}
|
||||
className="bg-white text-canino-blue px-8 py-4 rounded-2xl font-black hover:scale-105 transition-transform"
|
||||
>
|
||||
مشاهده محصولات تخصصی
|
||||
</button>
|
||||
<div className="relative z-10 flex flex-col lg:flex-row items-center gap-12">
|
||||
<div className="flex-1">
|
||||
<h3 className="text-3xl lg:text-4xl font-black italic mb-6">علم آلمانی در خدمت سلامت پت شما</h3>
|
||||
<p className="text-white/80 mb-8 leading-relaxed max-w-xl">
|
||||
تمامی مقالات این وبلاگ بر اساس کاتالوگهای رسمی و نتایج آزمایشگاهی کمپانی کانینو آلمان تدوین شده است.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => router.push('/shop')}
|
||||
className="bg-white text-canino-blue px-8 py-4 rounded-2xl font-black hover:scale-105 transition-transform"
|
||||
>
|
||||
مشاهده محصولات تخصصی
|
||||
</button>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4 flex-shrink-0">
|
||||
{products.slice(0, 2).map((p) => (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => router.push(`/shop/${p.id}`)}
|
||||
className="bg-white/10 border border-white/20 p-6 rounded-3xl cursor-pointer hover:bg-white/20 transition-all text-center group"
|
||||
>
|
||||
<img src={p.image} alt={p.name} className="w-20 h-20 mx-auto mb-4 object-contain filter brightness-0 invert group-hover:scale-110 transition-transform" />
|
||||
<h5 className="text-[10px] font-black">{p.name}</h5>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4 flex-shrink-0">
|
||||
{products.slice(0, 2).map((p) => (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => router.push(`/shop/${p.id}`)}
|
||||
className="bg-white/10 border border-white/20 p-6 rounded-3xl cursor-pointer hover:bg-white/20 transition-all text-center group"
|
||||
>
|
||||
<img src={p.image} alt={p.name} className="w-20 h-20 mx-auto mb-4 object-contain filter brightness-0 invert group-hover:scale-110 transition-transform" />
|
||||
<h5 className="text-[10px] font-black">{p.name}</h5>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
}
|
||||
@@ -37,16 +37,16 @@ const MENU_ITEMS = [
|
||||
}
|
||||
];
|
||||
|
||||
export default function Header({
|
||||
onNavigate,
|
||||
onShopNavigate,
|
||||
export default function Header({
|
||||
onNavigate,
|
||||
onShopNavigate,
|
||||
currentView,
|
||||
onCartOpen,
|
||||
onSearch,
|
||||
onB2BOpen
|
||||
}: {
|
||||
onNavigate: (v: any) => void,
|
||||
onShopNavigate: (c?: string, s?: string) => void,
|
||||
}: {
|
||||
onNavigate: (v: any) => void,
|
||||
onShopNavigate: (c?: string, s?: string) => void,
|
||||
currentView: string,
|
||||
onCartOpen: () => void,
|
||||
onSearch: (q: string) => void,
|
||||
@@ -59,9 +59,9 @@ export default function Header({
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
||||
const [isMobileSolutionsOpen, setIsMobileSolutionsOpen] = useState(false);
|
||||
|
||||
|
||||
const petMenuRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
||||
const { getTotalItems } = useCartStore();
|
||||
const { pets, activePetId, setActivePet, getActivePet } = usePetStore();
|
||||
const { role, isLoggedIn, logout, profile } = useUserStore();
|
||||
@@ -88,175 +88,175 @@ export default function Header({
|
||||
|
||||
return (
|
||||
<>
|
||||
<AuthModal isOpen={isAuthModalOpen} onClose={() => setIsAuthModalOpen(false)} />
|
||||
|
||||
<div className="bg-canino-gold text-canino-dark text-xs font-black py-2.5 text-center font-vazir tracking-wider flex items-center justify-center gap-2">
|
||||
<span>🚚</span>
|
||||
<span>ارسال رایگان برای سفارشهای بالای ۱۵۰ هزار تومان</span>
|
||||
</div>
|
||||
|
||||
<header className="sticky top-0 z-50 bg-white/95 backdrop-blur-md border-b border-medical-gray-100 shadow-sm">
|
||||
<div className="max-w-7xl mx-auto h-24 flex items-center justify-between gap-4 px-4 sm:px-6 lg:px-8" dir="rtl">
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Mobile Menu Toggle */}
|
||||
<button
|
||||
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
|
||||
className="lg:hidden p-2 rounded-xl text-medical-gray-600 hover:bg-medical-gray-50 transition-all"
|
||||
aria-label="منو"
|
||||
>
|
||||
{isMobileMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
||||
</button>
|
||||
<AuthModal isOpen={isAuthModalOpen} onClose={() => setIsAuthModalOpen(false)} />
|
||||
|
||||
{/* Logo Section */}
|
||||
<div
|
||||
className="flex-shrink-0 flex items-center gap-3 cursor-pointer group"
|
||||
onClick={() => {
|
||||
onNavigate("home");
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<div className="w-12 h-12 bg-canino-blue rounded-2xl flex items-center justify-center text-white font-bold text-2xl group-hover:bg-medical-gray-900 transition-all shadow-xl shadow-canino-blue/20 italic">C</div>
|
||||
<div className="flex flex-col">
|
||||
<span className="text-canino-blue font-black text-2xl tracking-tighter leading-none italic font-inter">Canino <span className="text-sm not-italic font-medium border-l-2 border-medical-gray-100 pl-2 ml-2 font-vazir">ایران</span></span>
|
||||
<span className="text-[10px] text-medical-gray-400 font-bold uppercase tracking-widest leading-none mt-1.5 font-vazir">نماینده رسمی Canina Pharma GmbH آلمان</span>
|
||||
<div className="bg-canino-gold text-canino-dark text-xs font-black py-2.5 text-center font-vazir tracking-wider flex items-center justify-center gap-2">
|
||||
<span>🚚</span>
|
||||
<span>ارسال رایگان برای سفارشهای بالای ۱۵۰ هزار تومان</span>
|
||||
</div>
|
||||
|
||||
<header className="sticky top-0 z-50 bg-white/95 backdrop-blur-md border-b border-medical-gray-100 shadow-sm">
|
||||
<div className="max-w-7xl mx-auto h-24 flex items-center justify-between gap-4 px-4 sm:px-6 lg:px-8" dir="rtl">
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Mobile Menu Toggle */}
|
||||
<button
|
||||
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
|
||||
className="lg:hidden p-2 rounded-xl text-medical-gray-600 hover:bg-medical-gray-50 transition-all"
|
||||
aria-label="منو"
|
||||
>
|
||||
{isMobileMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
||||
</button>
|
||||
|
||||
{/* Logo Section */}
|
||||
<div
|
||||
className="flex-shrink-0 flex items-center gap-3 cursor-pointer group"
|
||||
onClick={() => {
|
||||
onNavigate("home");
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<div className="w-12 h-12 bg-canino-blue rounded-2xl flex items-center justify-center text-white font-bold text-2xl group-hover:bg-medical-gray-900 transition-all shadow-xl shadow-canino-blue/20 italic">C</div>
|
||||
<div className="flex flex-col">
|
||||
<span className="text-canino-blue font-black text-2xl tracking-tighter leading-none italic font-inter">Canino <span className="text-sm not-italic font-medium border-l-2 border-medical-gray-100 pl-2 ml-2 font-vazir">ایران</span></span>
|
||||
<span className="text-[10px] text-medical-gray-400 font-bold uppercase tracking-widest leading-none mt-1.5 font-vazir">نماینده رسمی Canina Pharma GmbH آلمان</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Navigation Items */}
|
||||
<nav className="hidden lg:flex items-center gap-1 flex-grow justify-center h-full">
|
||||
<div
|
||||
className="relative h-full flex items-center group"
|
||||
onMouseEnter={() => setIsMegaMenuOpen(true)}
|
||||
onMouseLeave={() => setIsMegaMenuOpen(false)}
|
||||
>
|
||||
<button className={`flex items-center justify-center gap-1.5 px-4 py-3 rounded-xl text-sm font-black transition-all whitespace-nowrap focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none min-h-[48px] ${isMegaMenuOpen ? 'bg-medical-gray-50 text-canino-blue' : 'text-medical-gray-600 hover:bg-medical-gray-50 hover:text-canino-blue'} font-vazir`}>
|
||||
راهکارهای درمانی
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMegaMenuOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
{/* Navigation Items */}
|
||||
<nav className="hidden lg:flex items-center gap-1 flex-grow justify-center h-full">
|
||||
<div
|
||||
className="relative h-full flex items-center group"
|
||||
onMouseEnter={() => setIsMegaMenuOpen(true)}
|
||||
onMouseLeave={() => setIsMegaMenuOpen(false)}
|
||||
>
|
||||
<button className={`flex items-center justify-center gap-1.5 px-4 py-3 rounded-xl text-sm font-black transition-all whitespace-nowrap focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none min-h-[48px] ${isMegaMenuOpen ? 'bg-medical-gray-50 text-canino-blue' : 'text-medical-gray-600 hover:bg-medical-gray-50 hover:text-canino-blue'} font-vazir`}>
|
||||
راهکارهای درمانی
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMegaMenuOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
|
||||
<AnimatePresence>
|
||||
{isMegaMenuOpen && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 15, scale: 0.98 }}
|
||||
animate={{ opacity: 1, y: 0, scale: 1 }}
|
||||
exit={{ opacity: 0, y: 15, scale: 0.98 }}
|
||||
className="absolute top-[80%] right-0 w-[640px] bg-white border border-medical-gray-100 shadow-2xl rounded-[2.5rem] p-10 grid grid-cols-2 gap-10 z-50 pointer-events-auto"
|
||||
>
|
||||
{MENU_ITEMS.map((item, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
<AnimatePresence>
|
||||
{isMegaMenuOpen && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 15, scale: 0.98 }}
|
||||
animate={{ opacity: 1, y: 0, scale: 1 }}
|
||||
exit={{ opacity: 0, y: 15, scale: 0.98 }}
|
||||
className="absolute top-[80%] right-0 w-[640px] bg-white border border-medical-gray-100 shadow-2xl rounded-[2.5rem] p-10 grid grid-cols-2 gap-10 z-50 pointer-events-auto"
|
||||
>
|
||||
{MENU_ITEMS.map((item, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className="group/item cursor-pointer"
|
||||
onClick={() => {
|
||||
onShopNavigate(item.id);
|
||||
setIsMegaMenuOpen(false);
|
||||
onShopNavigate(item.id);
|
||||
setIsMegaMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-4 mb-4">
|
||||
<div className="p-3 bg-medical-gray-50 rounded-2xl text-canino-blue group-hover/item:bg-canino-blue group-hover/item:text-white transition-all shadow-sm">
|
||||
{item.icon}
|
||||
>
|
||||
<div className="flex items-center gap-4 mb-4">
|
||||
<div className="p-3 bg-medical-gray-50 rounded-2xl text-canino-blue group-hover/item:bg-canino-blue group-hover/item:text-white transition-all shadow-sm">
|
||||
{item.icon}
|
||||
</div>
|
||||
<h4 className="font-black text-medical-gray-900 text-sm font-vazir whitespace-nowrap">{item.title}</h4>
|
||||
</div>
|
||||
<h4 className="font-black text-medical-gray-900 text-sm font-vazir whitespace-nowrap">{item.title}</h4>
|
||||
<ul className="space-y-2.5 border-r-2 border-medical-gray-50 pr-4">
|
||||
{item.solutions.map((sol, sIdx) => (
|
||||
<li
|
||||
key={sIdx}
|
||||
className="text-[12px] text-medical-gray-400 hover:text-canino-blue hover:translate-x-[-4px] transition-all font-bold cursor-pointer font-vazir whitespace-nowrap"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onShopNavigate(item.id, sol);
|
||||
setIsMegaMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
{sol}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<ul className="space-y-2.5 border-r-2 border-medical-gray-50 pr-4">
|
||||
{item.solutions.map((sol, sIdx) => (
|
||||
<li
|
||||
key={sIdx}
|
||||
className="text-[12px] text-medical-gray-400 hover:text-canino-blue hover:translate-x-[-4px] transition-all font-bold cursor-pointer font-vazir whitespace-nowrap"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onShopNavigate(item.id, sol);
|
||||
setIsMegaMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
{sol}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
|
||||
{[
|
||||
{ id: 'shop', label: 'محصولات تخصصی', action: () => onShopNavigate() },
|
||||
{ id: 'wiki', label: 'دانشنامه علمی', action: () => onNavigate('wiki') },
|
||||
{ id: 'blog', label: 'مجله سلامت پت', action: () => onNavigate('blog') },
|
||||
{ id: 'profile', label: 'شناسنامه پتها', action: () => onNavigate({ view: 'profile', subview: 'index' }) }
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={item.action}
|
||||
className={`px-4 py-3 rounded-xl text-sm font-black transition-all font-vazir whitespace-nowrap focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none min-h-[48px] ${currentView === item.id ? 'bg-canino-blue/5 text-canino-blue' : 'text-medical-gray-600 hover:bg-medical-gray-50 hover:text-canino-blue'}`}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
))}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
|
||||
{/* Action Area */}
|
||||
<div className="flex items-center gap-4 flex-shrink-0 justify-end h-16 pl-2">
|
||||
|
||||
{/* Elastic Search */}
|
||||
<div className="relative flex items-center justify-end z-20">
|
||||
<AnimatePresence>
|
||||
{isSearchFocused && (
|
||||
<motion.div
|
||||
initial={{ width: 0, opacity: 0 }}
|
||||
animate={{ width: 350, opacity: 1 }}
|
||||
exit={{ width: 0, opacity: 0 }}
|
||||
transition={{ type: "spring", damping: 20, stiffness: 200 }}
|
||||
className="absolute right-0 top-1/2 -translate-y-1/2 bg-white border-2 border-canino-blue rounded-2xl shadow-xl overflow-hidden h-12 flex items-center pr-10"
|
||||
>
|
||||
<form onSubmit={handleSearch} className="w-full flex items-center">
|
||||
<input
|
||||
autoFocus
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={e => setSearchQuery(e.target.value)}
|
||||
onBlur={() => !searchQuery && setIsSearchFocused(false)}
|
||||
placeholder="جستجوی محصولات، مقالات سلامت و..."
|
||||
className="w-full bg-transparent px-4 py-2 text-[12px] font-bold outline-none font-vazir text-medical-gray-900"
|
||||
/>
|
||||
<button type="submit" className="px-4 py-2 bg-canino-blue text-white text-[10px] font-black hover:bg-medical-gray-900 transition-colors">
|
||||
جستجو
|
||||
</button>
|
||||
</form>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
|
||||
<HeaderButton
|
||||
variant={isSearchFocused ? "primary" : "secondary"}
|
||||
className={cn("w-12 h-12 transition-all duration-300", isSearchFocused ? "z-30 bg-canino-blue text-white" : "")}
|
||||
onClick={() => setIsSearchFocused(!isSearchFocused)}
|
||||
>
|
||||
<Search className="w-5 h-5" />
|
||||
</HeaderButton>
|
||||
</div>
|
||||
{[
|
||||
{ id: 'shop', label: 'محصولات تخصصی', action: () => onShopNavigate() },
|
||||
{ id: 'wiki', label: 'دانشنامه علمی', action: () => onNavigate('wiki') },
|
||||
{ id: 'blog', label: 'مجله سلامت پت', action: () => onNavigate('blog') },
|
||||
{ id: 'profile', label: 'شناسنامه پتها', action: () => onNavigate({ view: 'profile', subview: 'index' }) }
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={item.action}
|
||||
className={`px-4 py-3 rounded-xl text-sm font-black transition-all font-vazir whitespace-nowrap focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none min-h-[48px] ${currentView === item.id ? 'bg-canino-blue/5 text-canino-blue' : 'text-medical-gray-600 hover:bg-medical-gray-50 hover:text-canino-blue'}`}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="flex gap-2 items-center h-12">
|
||||
{isLoggedIn ? (
|
||||
<div className="flex items-center h-full gap-2 p-1.5 bg-medical-gray-50/50 border border-medical-gray-100 rounded-3xl">
|
||||
{/* User Name (Direct link to dashboard) */}
|
||||
<div
|
||||
className="flex items-center gap-2.5 px-4 py-2 hover:bg-white rounded-2xl cursor-pointer transition-all border border-transparent hover:border-medical-gray-200"
|
||||
onClick={() => onNavigate("user-dashboard")}
|
||||
>
|
||||
<User className="w-5 h-5 text-canino-blue" />
|
||||
<span className="text-[14px] font-black font-vazir text-medical-gray-900 leading-none">
|
||||
{profile.firstName}
|
||||
</span>
|
||||
</div>
|
||||
{/* Action Area */}
|
||||
<div className="flex items-center gap-4 flex-shrink-0 justify-end h-16 pl-2">
|
||||
|
||||
{/* Separator Line */}
|
||||
<div className="w-[1.5px] h-5 bg-medical-gray-200" />
|
||||
{/* Elastic Search */}
|
||||
<div className="relative flex items-center justify-end z-20">
|
||||
<AnimatePresence>
|
||||
{isSearchFocused && (
|
||||
<motion.div
|
||||
initial={{ width: 0, opacity: 0 }}
|
||||
animate={{ width: 350, opacity: 1 }}
|
||||
exit={{ width: 0, opacity: 0 }}
|
||||
transition={{ type: "spring", damping: 20, stiffness: 200 }}
|
||||
className="absolute right-0 top-1/2 -translate-y-1/2 bg-white border-2 border-canino-blue rounded-2xl shadow-xl overflow-hidden h-12 flex items-center pr-10"
|
||||
>
|
||||
<form onSubmit={handleSearch} className="w-full flex items-center">
|
||||
<input
|
||||
autoFocus
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={e => setSearchQuery(e.target.value)}
|
||||
onBlur={() => !searchQuery && setIsSearchFocused(false)}
|
||||
placeholder="جستجوی محصولات، مقالات سلامت و..."
|
||||
className="w-full bg-transparent px-4 py-2 text-[12px] font-bold outline-none font-vazir text-medical-gray-900"
|
||||
/>
|
||||
<button type="submit" className="px-4 py-2 bg-canino-blue text-white text-[10px] font-black hover:bg-medical-gray-900 transition-colors">
|
||||
جستجو
|
||||
</button>
|
||||
</form>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
|
||||
{/* Pet Name & Switcher */}
|
||||
<div className="relative h-full flex items-center" ref={petMenuRef}>
|
||||
<div
|
||||
<HeaderButton
|
||||
variant={isSearchFocused ? "primary" : "secondary"}
|
||||
className={cn("w-12 h-12 transition-all duration-300", isSearchFocused ? "z-30 bg-canino-blue text-white" : "")}
|
||||
onClick={() => setIsSearchFocused(!isSearchFocused)}
|
||||
>
|
||||
<Search className="w-5 h-5" />
|
||||
</HeaderButton>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 items-center h-12">
|
||||
{isLoggedIn ? (
|
||||
<div className="flex items-center h-full gap-2 p-1.5 bg-medical-gray-50/50 border border-medical-gray-100 rounded-3xl">
|
||||
{/* User Name (Direct link to dashboard) */}
|
||||
<div
|
||||
className="flex items-center gap-2.5 px-4 py-2 hover:bg-white rounded-2xl cursor-pointer transition-all border border-transparent hover:border-medical-gray-200"
|
||||
onClick={() => onNavigate("user-dashboard")}
|
||||
>
|
||||
<User className="w-5 h-5 text-canino-blue" />
|
||||
<span className="text-[14px] font-black font-vazir text-medical-gray-900 leading-none">
|
||||
{profile.firstName}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Separator Line */}
|
||||
<div className="w-[1.5px] h-5 bg-medical-gray-200" />
|
||||
|
||||
{/* Pet Name & Switcher */}
|
||||
<div className="relative h-full flex items-center" ref={petMenuRef}>
|
||||
<div
|
||||
className={cn(
|
||||
"flex items-center gap-2.5 px-4 py-2 rounded-2xl transition-all cursor-pointer",
|
||||
isPetSwitcherOpen ? "bg-canino-blue text-white shadow-lg shadow-canino-blue/20" : "text-canino-blue hover:bg-white"
|
||||
@@ -292,7 +292,7 @@ export default function Header({
|
||||
activePetId === pet.id ? "bg-canino-blue/5 text-canino-blue" : "hover:bg-medical-gray-50 text-medical-gray-600"
|
||||
)}
|
||||
>
|
||||
<div
|
||||
<div
|
||||
className="flex items-center gap-3 flex-1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setActivePet(pet.id);
|
||||
@@ -308,7 +308,7 @@ export default function Header({
|
||||
</div>
|
||||
<span className="text-[13px] font-bold font-vazir">{pet.name}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex items-center gap-1">
|
||||
{activePetId === pet.id && <Check className="w-4 h-4 ml-2" />}
|
||||
<button
|
||||
@@ -327,173 +327,172 @@ export default function Header({
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
||||
<div className="pt-4 border-t border-medical-gray-100 space-y-1">
|
||||
<button
|
||||
<button
|
||||
onClick={() => { onNavigate({ view: "profile", subview: "add" }); setIsPetSwitcherOpen(false); }}
|
||||
className="w-full flex items-center gap-3 p-3 text-canino-blue hover:bg-canino-blue/5 rounded-xl transition-all text-[12px] font-black font-vazir"
|
||||
>
|
||||
<PlusCircle className="w-5 h-5" />
|
||||
ثبت همدم (Pet) جدید
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
onClick={() => { onNavigate({ view: "user-dashboard" }); setIsPetSwitcherOpen(false); }}
|
||||
className="w-full flex items-center gap-3 p-3 text-medical-gray-600 hover:bg-medical-gray-50 rounded-xl transition-all text-[12px] font-bold font-vazir"
|
||||
>
|
||||
<Wallet className="w-5 h-5" />
|
||||
کیف پول و سفارشات
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
onClick={() => { logout(); setIsPetSwitcherOpen(false); }}
|
||||
className="w-full flex items-center gap-3 p-3 text-red-500 hover:bg-red-50 rounded-xl transition-all text-[12px] font-bold font-vazir mt-1"
|
||||
>
|
||||
<LogOut className="w-5 h-5" />
|
||||
خروج از حساب کانینو
|
||||
خروج از حساب کانینو
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<HeaderButton
|
||||
variant="outline"
|
||||
className="px-6 h-12 text-sm font-black"
|
||||
onClick={() => setIsAuthModalOpen(true)}
|
||||
icon={<LogIn className="w-5 h-5" />}
|
||||
>
|
||||
ورود / ثبتنام
|
||||
</HeaderButton>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<HeaderButton
|
||||
variant="outline"
|
||||
className="px-6 h-12 text-sm font-black"
|
||||
onClick={() => setIsAuthModalOpen(true)}
|
||||
icon={<LogIn className="w-5 h-5" />}
|
||||
>
|
||||
ورود / ثبتنام
|
||||
</HeaderButton>
|
||||
)}
|
||||
|
||||
<HeaderButton
|
||||
<HeaderButton
|
||||
variant="primary"
|
||||
className="w-16 h-12"
|
||||
onClick={onCartOpen}
|
||||
badge={getTotalItems()}
|
||||
icon={<ShoppingBag className="w-6 h-6" />}
|
||||
>
|
||||
>
|
||||
<div className="text-[8px] font-black tracking-tight whitespace-nowrap mt-0.5">سبد خرید</div>
|
||||
</HeaderButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</HeaderButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Mobile Drawer Menu */}
|
||||
<AnimatePresence>
|
||||
{isMobileMenuOpen && (
|
||||
<>
|
||||
{/* Backdrop */}
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 0.5 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
className="fixed inset-0 bg-black z-40 lg:hidden"
|
||||
/>
|
||||
{/* Drawer */}
|
||||
<motion.div
|
||||
initial={{ x: "100%" }}
|
||||
animate={{ x: 0 }}
|
||||
exit={{ x: "100%" }}
|
||||
transition={{ type: "spring", damping: 25, stiffness: 200 }}
|
||||
className="fixed top-0 right-0 bottom-0 w-80 max-w-[85vw] bg-white z-50 shadow-2xl p-6 flex flex-col gap-6 overflow-y-auto lg:hidden"
|
||||
dir="rtl"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-medical-gray-100 pb-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-canino-blue rounded-xl flex items-center justify-center text-white font-bold text-xl italic">C</div>
|
||||
<span className="text-canino-blue font-black text-xl italic font-inter">Canino</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
className="p-2 rounded-xl hover:bg-medical-gray-50 text-medical-gray-600 transition-all"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
{/* Mobile Drawer Menu */}
|
||||
<AnimatePresence>
|
||||
{isMobileMenuOpen && (
|
||||
<>
|
||||
{/* Backdrop */}
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 0.5 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
className="fixed inset-0 bg-black z-40 lg:hidden"
|
||||
/>
|
||||
{/* Drawer */}
|
||||
<motion.div
|
||||
initial={{ x: "100%" }}
|
||||
animate={{ x: 0 }}
|
||||
exit={{ x: "100%" }}
|
||||
transition={{ type: "spring", damping: 25, stiffness: 200 }}
|
||||
className="fixed top-0 right-0 bottom-0 w-80 max-w-[85vw] bg-white z-50 shadow-2xl p-6 flex flex-col gap-6 overflow-y-auto lg:hidden"
|
||||
dir="rtl"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-medical-gray-100 pb-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-canino-blue rounded-xl flex items-center justify-center text-white font-bold text-xl italic">C</div>
|
||||
<span className="text-canino-blue font-black text-xl italic font-inter">Canino</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
className="p-2 rounded-xl hover:bg-medical-gray-50 text-medical-gray-600 transition-all"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Navigation Links */}
|
||||
<nav className="flex flex-col gap-2">
|
||||
{/* Treatment Solutions accordion */}
|
||||
<div className="flex flex-col">
|
||||
<button
|
||||
onClick={() => setIsMobileSolutionsOpen(!isMobileSolutionsOpen)}
|
||||
className="w-full flex items-center justify-between px-4 py-3 rounded-xl text-sm font-black text-medical-gray-600 hover:bg-medical-gray-50 transition-all font-vazir"
|
||||
>
|
||||
<span>راهکارهای درمانی</span>
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMobileSolutionsOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
<AnimatePresence>
|
||||
{isMobileSolutionsOpen && (
|
||||
<motion.div
|
||||
initial={{ height: 0, opacity: 0 }}
|
||||
animate={{ height: "auto", opacity: 1 }}
|
||||
exit={{ height: 0, opacity: 0 }}
|
||||
className="overflow-hidden mr-4 pr-2 border-r-2 border-medical-gray-100 mt-1 space-y-3"
|
||||
>
|
||||
{MENU_ITEMS.map((item, idx) => (
|
||||
<div key={idx} className="py-1">
|
||||
<div
|
||||
className="text-[13px] font-bold text-medical-gray-800 font-vazir hover:text-canino-blue cursor-pointer flex items-center gap-2"
|
||||
onClick={() => {
|
||||
onShopNavigate(item.id);
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<span className="text-canino-blue/80">{item.icon}</span>
|
||||
<span>{item.title}</span>
|
||||
</div>
|
||||
<ul className="mt-1 space-y-1 mr-6">
|
||||
{item.solutions.map((sol, sIdx) => (
|
||||
<li
|
||||
key={sIdx}
|
||||
className="text-[11px] text-medical-gray-500 hover:text-canino-blue cursor-pointer py-1 font-vazir"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onShopNavigate(item.id, sol);
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
{sol}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
{/* Navigation Links */}
|
||||
<nav className="flex flex-col gap-2">
|
||||
{/* Treatment Solutions accordion */}
|
||||
<div className="flex flex-col">
|
||||
<button
|
||||
onClick={() => setIsMobileSolutionsOpen(!isMobileSolutionsOpen)}
|
||||
className="w-full flex items-center justify-between px-4 py-3 rounded-xl text-sm font-black text-medical-gray-600 hover:bg-medical-gray-50 transition-all font-vazir"
|
||||
>
|
||||
<span>راهکارهای درمانی</span>
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMobileSolutionsOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
<AnimatePresence>
|
||||
{isMobileSolutionsOpen && (
|
||||
<motion.div
|
||||
initial={{ height: 0, opacity: 0 }}
|
||||
animate={{ height: "auto", opacity: 1 }}
|
||||
exit={{ height: 0, opacity: 0 }}
|
||||
className="overflow-hidden mr-4 pr-2 border-r-2 border-medical-gray-100 mt-1 space-y-3"
|
||||
>
|
||||
{MENU_ITEMS.map((item, idx) => (
|
||||
<div key={idx} className="py-1">
|
||||
<div
|
||||
className="text-[13px] font-bold text-medical-gray-800 font-vazir hover:text-canino-blue cursor-pointer flex items-center gap-2"
|
||||
onClick={() => {
|
||||
onShopNavigate(item.id);
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<span className="text-canino-blue/80">{item.icon}</span>
|
||||
<span>{item.title}</span>
|
||||
</div>
|
||||
<ul className="mt-1 space-y-1 mr-6">
|
||||
{item.solutions.map((sol, sIdx) => (
|
||||
<li
|
||||
key={sIdx}
|
||||
className="text-[11px] text-medical-gray-500 hover:text-canino-blue cursor-pointer py-1 font-vazir"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onShopNavigate(item.id, sol);
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
{sol}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
|
||||
{[
|
||||
{ id: 'shop', label: 'محصولات تخصصی', action: () => onShopNavigate() },
|
||||
{ id: 'wiki', label: 'دانشنامه علمی', action: () => onNavigate('wiki') },
|
||||
{ id: 'blog', label: 'مجله سلامت پت', action: () => onNavigate('blog') },
|
||||
{ id: 'profile', label: 'شناسنامه پتها', action: () => onNavigate({ view: 'profile', subview: 'index' }) }
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={() => {
|
||||
item.action();
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
className={`w-full text-right px-4 py-3 rounded-xl text-sm font-black transition-all font-vazir ${
|
||||
currentView === item.id
|
||||
? 'bg-canino-blue/5 text-canino-blue'
|
||||
: 'text-medical-gray-600 hover:bg-medical-gray-50'
|
||||
}`}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</motion.div>
|
||||
</>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</>
|
||||
);
|
||||
}
|
||||
{[
|
||||
{ id: 'shop', label: 'محصولات تخصصی', action: () => onShopNavigate() },
|
||||
{ id: 'wiki', label: 'دانشنامه علمی', action: () => onNavigate('wiki') },
|
||||
{ id: 'blog', label: 'مجله سلامت پت', action: () => onNavigate('blog') },
|
||||
{ id: 'profile', label: 'شناسنامه پتها', action: () => onNavigate({ view: 'profile', subview: 'index' }) }
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={() => {
|
||||
item.action();
|
||||
setIsMobileMenuOpen(false);
|
||||
}}
|
||||
className={`w-full text-right px-4 py-3 rounded-xl text-sm font-black transition-all font-vazir ${currentView === item.id
|
||||
? 'bg-canino-blue/5 text-canino-blue'
|
||||
: 'text-medical-gray-600 hover:bg-medical-gray-50'
|
||||
}`}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</motion.div>
|
||||
</>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -9,8 +9,8 @@ function StatCounter({ target }: { target: number }) {
|
||||
const [displayValue, setDisplayValue] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const controls = animate(0, target, {
|
||||
duration: 3,
|
||||
const controls = animate(0, target, {
|
||||
duration: 3,
|
||||
ease: [0.16, 1, 0.3, 1], // Custom cubic-bezier for a more polished feel
|
||||
onUpdate: (latest) => setDisplayValue(Math.round(latest))
|
||||
});
|
||||
@@ -18,7 +18,7 @@ function StatCounter({ target }: { target: number }) {
|
||||
}, [target]);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ scale: 0.8, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
transition={{ duration: 2.5, ease: "easeOut" }}
|
||||
@@ -50,7 +50,7 @@ function Typewriter({ text }: { text: string }) {
|
||||
<div className="text-4xl lg:text-6xl font-black text-canino-blue font-vazir flex flex-row-reverse items-center">
|
||||
<span className="relative">
|
||||
{toPersian(displayText)}
|
||||
<motion.span
|
||||
<motion.span
|
||||
animate={{ opacity: [0, 1, 0] }}
|
||||
transition={{ duration: 0.8, repeat: Infinity }}
|
||||
className="absolute -left-1 top-0 h-full w-[3px] bg-canino-blue"
|
||||
@@ -92,13 +92,13 @@ export default function Hero({ banners = [] }: { banners?: any[] }) {
|
||||
<span className="w-2 h-2 rounded-full bg-canino-blue animate-pulse" />
|
||||
<span className="text-canino-blue text-xs font-bold uppercase tracking-widest leading-none">{getText('hero_badge', "تخصص دارویی از آلمان")}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<h1 className="text-4xl lg:text-7xl font-black text-medical-gray-900 leading-[1.1] mb-6">
|
||||
{titleParts[0]} <br />
|
||||
{titleParts[1] && <span className="text-canino-blue font-vazir">{titleParts[1]}</span>}
|
||||
</h1>
|
||||
|
||||
<p
|
||||
|
||||
<p
|
||||
className="text-lg lg:text-xl text-medical-gray-600 mb-10 max-w-2xl mx-auto lg:mx-0 leading-relaxed font-vazir animate-fade-in"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: subtitle
|
||||
@@ -106,7 +106,7 @@ export default function Hero({ banners = [] }: { banners?: any[] }) {
|
||||
/>
|
||||
|
||||
<div className="flex flex-wrap justify-center lg:justify-start gap-4 sm:gap-6">
|
||||
<button
|
||||
<button
|
||||
onClick={() => {
|
||||
const element = document.getElementById('canino-advisor');
|
||||
if (element) {
|
||||
@@ -118,7 +118,7 @@ export default function Hero({ banners = [] }: { banners?: any[] }) {
|
||||
{getText('hero_btn_advisor', "دستیار سلامت پت")}
|
||||
<ChevronLeft className="w-5 h-5 group-hover:-translate-x-1 transition-transform" />
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
onClick={() => router.push('/shop')}
|
||||
className="bg-white border-2 border-medical-gray-200 text-medical-gray-700 px-10 py-5 rounded-full font-bold text-lg hover:border-canino-blue hover:text-canino-blue focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all font-vazir min-h-[48px]"
|
||||
>
|
||||
@@ -136,12 +136,19 @@ export default function Hero({ banners = [] }: { banners?: any[] }) {
|
||||
transition={{ duration: 1, ease: "easeOut" }}
|
||||
className="relative z-10"
|
||||
>
|
||||
<div className="aspect-square bg-medical-gray-100 rounded-[2rem] overflow-hidden border-4 border-white shadow-2xl relative">
|
||||
<img
|
||||
<div className="aspect-square bg-gradient-to-br from-slate-200 to-slate-300 rounded-[2rem] overflow-hidden border-4 border-white shadow-2xl relative">
|
||||
<img
|
||||
src={banners.length > 0 && banners[0].imageUrl ? banners[0].imageUrl : "https://images.unsplash.com/photo-1583337130417-3346a1be7dee?auto=format&fit=crop&q=80&w=800"}
|
||||
alt={banners.length > 0 ? banners[0].title : "German Veterinary Expert"}
|
||||
alt={banners.length > 0 ? banners[0].title : "German Veterinary Expert"}
|
||||
className="w-full h-full object-cover grayscale-[20%] hover:grayscale-0 transition-all duration-700"
|
||||
referrerPolicy="no-referrer"
|
||||
loading="eager"
|
||||
crossOrigin="anonymous"
|
||||
onError={(e) => {
|
||||
const target = e.currentTarget;
|
||||
target.style.display = 'none';
|
||||
// Show gradient fallback
|
||||
target.parentElement!.style.background = 'linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%)';
|
||||
}}
|
||||
/>
|
||||
<div className="absolute bottom-0 left-0 right-0 p-8 bg-gradient-to-t from-black/80 to-transparent text-white text-right">
|
||||
<div className="text-sm font-medium mb-1 opacity-80 uppercase tracking-widest text-[10px]">{getText('hero_image_badge', "سرآمد علمی در پزشکی پتها")}</div>
|
||||
@@ -166,14 +173,14 @@ export default function Hero({ banners = [] }: { banners?: any[] }) {
|
||||
|
||||
{/* Stats - Centered, full-width row under Hero content to decrease cognitive load */}
|
||||
<div className="max-w-7xl mx-auto px-4 relative">
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: 0.8, duration: 0.6 }}
|
||||
className="grid grid-cols-1 md:grid-cols-3 gap-8 py-12 border-t border-medical-gray-150"
|
||||
>
|
||||
<div className="flex flex-col items-center justify-center text-center">
|
||||
<Typewriter text={getText('hero_stat_founded', "۱۹۸۴ سال تأسیس")} />
|
||||
<Typewriter text={getText('hero_stat_founded', "سال تأسیس ۱۹۸۴")} />
|
||||
</div>
|
||||
<div className="flex flex-col items-center justify-center text-center">
|
||||
<StatCounter target={40} />
|
||||
@@ -181,12 +188,12 @@ export default function Hero({ banners = [] }: { banners?: any[] }) {
|
||||
</div>
|
||||
<div className="flex flex-col items-center justify-center text-center">
|
||||
<div className="relative overflow-hidden group">
|
||||
<motion.div
|
||||
className="text-4xl lg:text-6xl font-black text-canino-blue font-vazir relative z-10"
|
||||
<motion.div
|
||||
className="text-4xl lg:text-6xl font-black text-canino-blue font-vazir relative z-10"
|
||||
>
|
||||
۱۰۰٪
|
||||
</motion.div>
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ x: "-100%" }}
|
||||
animate={{ x: "200%" }}
|
||||
transition={{ duration: 3, repeat: Infinity, ease: "linear" }}
|
||||
|
||||
@@ -120,16 +120,16 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
{isOpen && (
|
||||
<div className="fixed inset-0 z-[200] flex items-center justify-center p-4">
|
||||
{/* Backdrop */}
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={onClose}
|
||||
className="absolute inset-0 bg-medical-gray-900/60 backdrop-blur-md"
|
||||
/>
|
||||
|
||||
|
||||
{/* Modal Container */}
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
@@ -138,9 +138,9 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
>
|
||||
{/* Top color indicator */}
|
||||
<div className="absolute top-0 left-0 w-full h-2 bg-gradient-to-r from-canino-blue to-indigo-500" />
|
||||
|
||||
|
||||
{/* Close Button */}
|
||||
<button
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="absolute top-8 left-8 p-2 rounded-full hover:bg-medical-gray-50 text-medical-gray-400 hover:text-medical-gray-600 transition-colors"
|
||||
>
|
||||
@@ -153,7 +153,7 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
<ShieldCheck className="w-10 h-10 text-canino-blue" />
|
||||
</div>
|
||||
<h3 className="text-3xl font-black text-medical-gray-900 mb-2 italic">
|
||||
ورود به کانینو
|
||||
ورود به کانینو
|
||||
</h3>
|
||||
{isAdvisorContext ? (
|
||||
<p className="text-medical-gray-500 font-bold leading-relaxed px-2 text-sm">
|
||||
@@ -167,7 +167,7 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
{/* Step-based Forms */}
|
||||
<AnimatePresence mode="wait">
|
||||
{step === "phone" ? (
|
||||
<motion.form
|
||||
<motion.form
|
||||
key="phone-form"
|
||||
initial={{ opacity: 0, x: 20 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
@@ -179,11 +179,11 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
<label className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest block">شماره موبایل</label>
|
||||
<div className="relative">
|
||||
<Phone className="absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 text-medical-gray-400" />
|
||||
<input
|
||||
<input
|
||||
autoFocus
|
||||
type="tel"
|
||||
type="tel"
|
||||
maxLength={11}
|
||||
placeholder="مثال: ۰۹۱۲۳۴۵۶۷۸۹"
|
||||
placeholder="مثال: ۰۹۱۲۳۴۵۶۷۸۹"
|
||||
value={phoneNumber}
|
||||
onChange={(e) => setPhoneNumber(e.target.value.replace(/[^0-9]/g, ''))}
|
||||
disabled={isLoading}
|
||||
@@ -192,7 +192,7 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || phoneNumber.length < 11}
|
||||
className="w-full py-5 bg-canino-blue text-white rounded-2xl font-black text-xl hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed transition-all shadow-xl shadow-canino-blue/20 flex items-center justify-center gap-3 cursor-pointer"
|
||||
@@ -208,7 +208,7 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
</button>
|
||||
</motion.form>
|
||||
) : (
|
||||
<motion.form
|
||||
<motion.form
|
||||
key="otp-form"
|
||||
initial={{ opacity: 0, x: 20 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
@@ -219,8 +219,8 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between items-center">
|
||||
<label className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest">کد تایید پیامکی</label>
|
||||
<button
|
||||
type="button"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setStep("phone")}
|
||||
className="text-[10px] font-black text-canino-blue flex items-center gap-1 hover:underline"
|
||||
>
|
||||
@@ -230,11 +230,11 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
</div>
|
||||
<div className="relative">
|
||||
<Key className="absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 text-medical-gray-400" />
|
||||
<input
|
||||
<input
|
||||
ref={otpInputRef}
|
||||
type="text"
|
||||
type="text"
|
||||
maxLength={5}
|
||||
placeholder="کد ۵ رقمی"
|
||||
placeholder="کد ۵ رقمی"
|
||||
value={otpCode}
|
||||
onChange={(e) => setOtpCode(e.target.value.replace(/[^0-9]/g, ''))}
|
||||
disabled={isLoading}
|
||||
@@ -252,7 +252,7 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
ارسال مجدد کد پس از {toPersian(countdown)} ثانیه
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleResendOtp}
|
||||
disabled={isLoading}
|
||||
@@ -264,7 +264,7 @@ export default function LoginModal({ isOpen, onClose, onLogin, petName, isAdviso
|
||||
)}
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || otpCode.length < 5}
|
||||
className="w-full py-5 bg-canino-blue text-white rounded-2xl font-black text-xl hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed transition-all shadow-xl shadow-canino-blue/20 flex items-center justify-center gap-3 cursor-pointer"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import {
|
||||
X,
|
||||
Printer,
|
||||
Download,
|
||||
Package,
|
||||
import {
|
||||
X,
|
||||
Printer,
|
||||
Download,
|
||||
Package,
|
||||
ShoppingBag,
|
||||
MapPin,
|
||||
Calendar,
|
||||
Clock,
|
||||
MapPin,
|
||||
Calendar,
|
||||
Clock,
|
||||
CreditCard,
|
||||
CheckCircle2,
|
||||
AlertCircle,
|
||||
@@ -62,7 +62,7 @@ export default function OrderDetailsModal({ isOpen, onClose, order }: OrderDetai
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="logo">CANINO | کانینو</div>
|
||||
<div class="logo">CANINO | کانینو</div>
|
||||
<div>تاریخ: ${toPersian(new Date(order.date).toLocaleDateString('fa-IR'))}</div>
|
||||
</div>
|
||||
<div class="info">
|
||||
@@ -122,14 +122,14 @@ export default function OrderDetailsModal({ isOpen, onClose, order }: OrderDetai
|
||||
<AnimatePresence>
|
||||
{isOpen && (
|
||||
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={onClose}
|
||||
className="absolute inset-0 bg-medical-gray-900/60 backdrop-blur-md"
|
||||
/>
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
@@ -138,124 +138,124 @@ export default function OrderDetailsModal({ isOpen, onClose, order }: OrderDetai
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="bg-medical-gray-50 px-10 py-8 flex items-center justify-between border-b border-medical-gray-100">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-14 h-14 bg-canino-blue rounded-2xl flex items-center justify-center text-white shadow-lg">
|
||||
<Package className="w-7 h-7" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 italic">جزئیات سفارش {toPersian(order.id)}</h3>
|
||||
<p className="text-xs font-bold text-medical-gray-400">ثبت شده در {toPersian(orderDate.toLocaleDateString("fa-IR"))}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white border border-medical-gray-200 text-medical-gray-400 hover:text-red-500 transition-all"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-14 h-14 bg-canino-blue rounded-2xl flex items-center justify-center text-white shadow-lg">
|
||||
<Package className="w-7 h-7" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 italic">جزئیات سفارش {toPersian(order.id)}</h3>
|
||||
<p className="text-xs font-bold text-medical-gray-400">ثبت شده در {toPersian(orderDate.toLocaleDateString("fa-IR"))}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white border border-medical-gray-200 text-medical-gray-400 hover:text-red-500 transition-all"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Content Scrollable */}
|
||||
<div className="max-h-[70vh] overflow-y-auto px-10 py-8 space-y-10 custom-scrollbar">
|
||||
{/* Summary Stats */}
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div className="bg-medical-gray-50 p-4 rounded-2xl">
|
||||
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-widest mb-1">وضعیت تحویل</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{getStatusIcon(order.status)}
|
||||
<span className="text-sm font-black text-medical-gray-900">{getStatusLabel(order.status)}</span>
|
||||
</div>
|
||||
{/* Summary Stats */}
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div className="bg-medical-gray-50 p-4 rounded-2xl">
|
||||
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-widest mb-1">وضعیت تحویل</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{getStatusIcon(order.status)}
|
||||
<span className="text-sm font-black text-medical-gray-900">{getStatusLabel(order.status)}</span>
|
||||
</div>
|
||||
<div className="bg-medical-gray-50 p-4 rounded-2xl">
|
||||
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-widest mb-1">کد رهگیری</div>
|
||||
<div className="text-sm font-mono font-bold text-canino-blue">{toPersian(order.trackingNumber)}</div>
|
||||
</div>
|
||||
<div className="bg-medical-gray-50 p-4 rounded-2xl">
|
||||
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-widest mb-1">کد رهگیری</div>
|
||||
<div className="text-sm font-mono font-bold text-canino-blue">{toPersian(order.trackingNumber)}</div>
|
||||
</div>
|
||||
<div className="bg-medical-gray-50 p-4 rounded-2xl">
|
||||
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-widest mb-1">زمان ثبت</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="w-4 h-4 text-medical-gray-400" />
|
||||
<span className="text-sm font-black text-medical-gray-900">{toPersian(orderDate.toLocaleTimeString("fa-IR", { hour: '2-digit', minute: '2-digit' }))}</span>
|
||||
</div>
|
||||
<div className="bg-medical-gray-50 p-4 rounded-2xl">
|
||||
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-widest mb-1">زمان ثبت</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="w-4 h-4 text-medical-gray-400" />
|
||||
<span className="text-sm font-black text-medical-gray-900">{toPersian(orderDate.toLocaleTimeString("fa-IR", { hour: '2-digit', minute: '2-digit' }))}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Items List */}
|
||||
<div>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 mb-6 flex items-center gap-2">
|
||||
<ShoppingBag className="w-4 h-4 text-canino-blue" />
|
||||
سبد محصولات خریده شده
|
||||
{/* Items List */}
|
||||
<div>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 mb-6 flex items-center gap-2">
|
||||
<ShoppingBag className="w-4 h-4 text-canino-blue" />
|
||||
سبد محصولات خریده شده
|
||||
</h4>
|
||||
<div className="space-y-4">
|
||||
{(order.items || []).map((item: any) => (
|
||||
<div key={item.product.id} className="flex items-center justify-between p-4 border border-medical-gray-100 rounded-2xl hover:border-canino-blue transition-all">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-16 h-16 bg-medical-gray-50 rounded-xl p-2 flex items-center justify-center shrink-0">
|
||||
<SafeImage
|
||||
src={item.product.image}
|
||||
alt={item.product.name}
|
||||
className="w-full h-full"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h5 className="font-black text-medical-gray-900 leading-tight mb-1">{item.product.name}</h5>
|
||||
<div className="text-[10px] font-bold text-medical-gray-400">{toPersian(item.quantity)} عدد × {toPersian(item.product.priceValue.toLocaleString())} تومان</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<div className="text-lg font-black text-canino-blue italic">{toPersian((item.product.priceValue * item.quantity).toLocaleString())} <span className="text-[10px] not-italic">تومان</span></div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Shipping & Payment */}
|
||||
<div className="grid md:grid-cols-2 gap-8 pt-6 border-t border-medical-gray-100">
|
||||
<div>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 mb-4 flex items-center gap-2">
|
||||
<MapPin className="w-4 h-4 text-canino-blue" />
|
||||
اطلاعات ارسال
|
||||
</h4>
|
||||
<div className="space-y-4">
|
||||
{(order.items || []).map((item: any) => (
|
||||
<div key={item.product.id} className="flex items-center justify-between p-4 border border-medical-gray-100 rounded-2xl hover:border-canino-blue transition-all">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-16 h-16 bg-medical-gray-50 rounded-xl p-2 flex items-center justify-center shrink-0">
|
||||
<SafeImage
|
||||
src={item.product.image}
|
||||
alt={item.product.name}
|
||||
className="w-full h-full"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h5 className="font-black text-medical-gray-900 leading-tight mb-1">{item.product.name}</h5>
|
||||
<div className="text-[10px] font-bold text-medical-gray-400">{toPersian(item.quantity)} عدد × {toPersian(item.product.priceValue.toLocaleString())} تومان</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<div className="text-lg font-black text-canino-blue italic">{toPersian((item.product.priceValue * item.quantity).toLocaleString())} <span className="text-[10px] not-italic">تومان</span></div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<p className="text-xs font-bold text-medical-gray-500 leading-relaxed">
|
||||
تهران، خیابان ولیعصر، بالاتر از میدان ونک، بنبست آفتاب، پلاک ۱۲، واحد ۳
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 mb-4 flex items-center gap-2">
|
||||
<CreditCard className="w-4 h-4 text-canino-blue" />
|
||||
جزئیات پرداخت
|
||||
</h4>
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between text-xs font-bold text-medical-gray-400">
|
||||
<span>جمع ناخالص</span>
|
||||
<span>{toPersian(order.total.toLocaleString())} تومان</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-xs font-bold text-red-500">
|
||||
<span>تخفیف هوشمند</span>
|
||||
<span>{toPersian("۰")} تومان</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-base font-black text-medical-gray-900 pt-2 border-t border-medical-gray-50 italic">
|
||||
<span>مبلغ نهایی</span>
|
||||
<span>{toPersian(order.total.toLocaleString())} تومان</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Shipping & Payment */}
|
||||
<div className="grid md:grid-cols-2 gap-8 pt-6 border-t border-medical-gray-100">
|
||||
<div>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 mb-4 flex items-center gap-2">
|
||||
<MapPin className="w-4 h-4 text-canino-blue" />
|
||||
اطلاعات ارسال
|
||||
</h4>
|
||||
<p className="text-xs font-bold text-medical-gray-500 leading-relaxed">
|
||||
تهران، خیابان ولیعصر، بالاتر از میدان ونک، بنبست آفتاب، پلاک ۱۲، واحد ۳
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 mb-4 flex items-center gap-2">
|
||||
<CreditCard className="w-4 h-4 text-canino-blue" />
|
||||
جزئیات پرداخت
|
||||
</h4>
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between text-xs font-bold text-medical-gray-400">
|
||||
<span>جمع ناخالص</span>
|
||||
<span>{toPersian(order.total.toLocaleString())} تومان</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-xs font-bold text-red-500">
|
||||
<span>تخفیف هوشمند</span>
|
||||
<span>{toPersian("۰")} تومان</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-base font-black text-medical-gray-900 pt-2 border-t border-medical-gray-50 italic">
|
||||
<span>مبلغ نهایی</span>
|
||||
<span>{toPersian(order.total.toLocaleString())} تومان</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer Actions */}
|
||||
<div className="p-10 bg-medical-gray-50 border-t border-medical-gray-100 flex gap-4">
|
||||
<button
|
||||
onClick={handlePrint}
|
||||
className="flex-1 py-5 bg-white border border-medical-gray-200 text-medical-gray-900 rounded-2xl font-black text-sm flex items-center justify-center gap-3 hover:bg-medical-gray-100 transition-all shadow-sm"
|
||||
>
|
||||
<Download className="w-5 h-5" />
|
||||
دانلود فاکتور رسمی
|
||||
</button>
|
||||
<button className="flex items-center justify-center w-14 h-14 bg-medical-gray-900 text-white rounded-2xl hover:bg-canino-blue transition-all shadow-lg shadow-black/10">
|
||||
<Printer className="w-6 h-6" />
|
||||
</button>
|
||||
<button
|
||||
onClick={handlePrint}
|
||||
className="flex-1 py-5 bg-white border border-medical-gray-200 text-medical-gray-900 rounded-2xl font-black text-sm flex items-center justify-center gap-3 hover:bg-medical-gray-100 transition-all shadow-sm"
|
||||
>
|
||||
<Download className="w-5 h-5" />
|
||||
دانلود فاکتور رسمی
|
||||
</button>
|
||||
<button className="flex items-center justify-center w-14 h-14 bg-medical-gray-900 text-white rounded-2xl hover:bg-canino-blue transition-all shadow-lg shadow-black/10">
|
||||
<Printer className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,15 +1,15 @@
|
||||
"use client";
|
||||
import { useState, useMemo, useEffect } from "react";
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import {
|
||||
ArrowRight,
|
||||
Calculator as CalcIcon,
|
||||
ChevronLeft,
|
||||
ShieldCheck,
|
||||
CheckCircle2,
|
||||
Clock,
|
||||
FlaskConical,
|
||||
Stethoscope,
|
||||
import {
|
||||
ArrowRight,
|
||||
Calculator as CalcIcon,
|
||||
ChevronLeft,
|
||||
ShieldCheck,
|
||||
CheckCircle2,
|
||||
Clock,
|
||||
FlaskConical,
|
||||
Stethoscope,
|
||||
Info,
|
||||
CalendarDays,
|
||||
Dog,
|
||||
@@ -162,28 +162,28 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Mobile Header with Back Button */}
|
||||
<div className="flex items-center justify-between mb-6 md:hidden">
|
||||
<button
|
||||
onClick={() => router.back()}
|
||||
className="p-3 bg-white border border-medical-gray-200 rounded-2xl text-medical-gray-700 shadow-sm flex items-center gap-2 font-vazir text-sm font-bold"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
بازگشت
|
||||
</button>
|
||||
<div className="text-[10px] font-black text-canino-blue bg-canino-blue/5 px-4 py-2 rounded-xl font-vazir whitespace-nowrap">
|
||||
کانینو ایران
|
||||
</div>
|
||||
<button
|
||||
onClick={() => router.back()}
|
||||
className="p-3 bg-white border border-medical-gray-200 rounded-2xl text-medical-gray-700 shadow-sm flex items-center gap-2 font-vazir text-sm font-bold"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
بازگشت
|
||||
</button>
|
||||
<div className="text-[10px] font-black text-canino-blue bg-canino-blue/5 px-4 py-2 rounded-xl font-vazir whitespace-nowrap">
|
||||
کانینو ایران
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Breadcrumbs */}
|
||||
<nav className="hidden md:flex items-center gap-2 text-xs font-bold text-medical-gray-400 mb-8 overflow-x-auto whitespace-nowrap py-2">
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="hover:text-canino-blue transition-colors font-vazir cursor-pointer"
|
||||
>
|
||||
خانه
|
||||
</button>
|
||||
<ChevronLeft className="w-3 h-3 flex-shrink-0" />
|
||||
<button
|
||||
<button
|
||||
onClick={() => router.push(`/shop?category=${product.category}`)}
|
||||
className="hover:text-canino-blue cursor-pointer font-vazir"
|
||||
>
|
||||
@@ -238,12 +238,12 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
const Icon = ICON_MAP[benefit.icon] || CheckCircle2;
|
||||
return (
|
||||
<div key={i} className="bg-white border border-medical-gray-100 rounded-[2rem] p-8 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all group overflow-hidden relative">
|
||||
<div className="absolute -top-10 -left-10 w-24 h-24 bg-canino-blue/5 rounded-full group-hover:scale-150 transition-transform duration-700" />
|
||||
<div className="w-12 h-12 bg-medical-gray-50 rounded-2xl flex items-center justify-center text-canino-blue mb-6 group-hover:bg-canino-blue group-hover:text-white transition-all">
|
||||
<Icon className="w-6 h-6" />
|
||||
</div>
|
||||
<h4 className="text-xl font-black text-medical-gray-900 mb-2 font-vazir">{benefit.title}</h4>
|
||||
<p className="text-sm text-medical-gray-500 font-bold font-vazir">{benefit.description}</p>
|
||||
<div className="absolute -top-10 -left-10 w-24 h-24 bg-canino-blue/5 rounded-full group-hover:scale-150 transition-transform duration-700" />
|
||||
<div className="w-12 h-12 bg-medical-gray-50 rounded-2xl flex items-center justify-center text-canino-blue mb-6 group-hover:bg-canino-blue group-hover:text-white transition-all">
|
||||
<Icon className="w-6 h-6" />
|
||||
</div>
|
||||
<h4 className="text-xl font-black text-medical-gray-900 mb-2 font-vazir">{benefit.title}</h4>
|
||||
<p className="text-sm text-medical-gray-500 font-bold font-vazir">{benefit.description}</p>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@@ -251,7 +251,7 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
</section>
|
||||
)}
|
||||
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.95 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
className="bg-white rounded-[3.5rem] p-12 border border-medical-gray-200 shadow-xl relative group overflow-hidden"
|
||||
@@ -265,8 +265,8 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
گرید دارویی اختصاصی
|
||||
</div>
|
||||
</div>
|
||||
<SafeImage
|
||||
src={product.image}
|
||||
<SafeImage
|
||||
src={product.image}
|
||||
alt={product.name}
|
||||
className="w-full max-w-md mx-auto h-auto drop-shadow-2xl group-hover:scale-105 transition-transform duration-700"
|
||||
/>
|
||||
@@ -291,11 +291,11 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
return (
|
||||
<div key={idx} className="bg-medical-gray-50 border border-medical-gray-100 px-5 py-3 rounded-2xl flex items-center gap-3 group hover:border-canino-blue/30 transition-all">
|
||||
<span className="text-sm font-bold text-medical-gray-700 font-vazir">
|
||||
{termKey ? (
|
||||
<Tooltip termKey={termKey} onWikiNavigate={(id) => router.push(`/wiki?term=${id}`)}>
|
||||
{ing}
|
||||
</Tooltip>
|
||||
) : ing}
|
||||
{termKey ? (
|
||||
<Tooltip termKey={termKey} onWikiNavigate={(id) => router.push(`/wiki?term=${id}`)}>
|
||||
{ing}
|
||||
</Tooltip>
|
||||
) : ing}
|
||||
</span>
|
||||
<Sparkles className="w-3 h-3 text-canino-blue opacity-40 group-hover:opacity-100 transition-opacity" />
|
||||
</div>
|
||||
@@ -306,38 +306,38 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
|
||||
{/* Analysis Cards Grid */}
|
||||
<div className="space-y-6">
|
||||
<div className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-4 font-vazir">تخمین اتمام بسته (هوش مصنوعی)</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{Object.entries(product.analysis).map(([key, value]) => (
|
||||
<div key={key} className="bg-canino-blue text-white p-8 rounded-[2rem] border-b-2 border-white/20 shadow-xl group hover:scale-[1.02] transition-all duration-300">
|
||||
<div className="text-[10px] font-black text-white/80 uppercase tracking-widest mb-3 font-vazir whitespace-nowrap">{key}</div>
|
||||
<div className="text-3xl font-black font-vazir tracking-tighter text-white">{toPersian(value)}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-4 font-vazir">تخمین اتمام بسته (هوش مصنوعی)</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{Object.entries(product.analysis).map(([key, value]) => (
|
||||
<div key={key} className="bg-canino-blue text-white p-8 rounded-[2rem] border-b-2 border-white/20 shadow-xl group hover:scale-[1.02] transition-all duration-300">
|
||||
<div className="text-[10px] font-black text-white/80 uppercase tracking-widest mb-3 font-vazir whitespace-nowrap">{key}</div>
|
||||
<div className="text-3xl font-black font-vazir tracking-tighter text-white">{toPersian(value)}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Feeding Section */}
|
||||
<section className="bg-canino-blue/5 border border-canino-blue/10 rounded-[3rem] p-10">
|
||||
<div className="flex items-center gap-4 mb-8">
|
||||
<div className="w-10 h-10 bg-canino-blue text-white rounded-xl flex items-center justify-center">
|
||||
<CalendarDays className="w-6 h-6" />
|
||||
</div>
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 italic font-vazir">توصیه غذایی و نحوه مصرف</h3>
|
||||
</div>
|
||||
<p className="text-medical-gray-700 leading-relaxed text-sm md:text-base font-medium font-vazir">
|
||||
{product.feedingAdvice}
|
||||
</p>
|
||||
<div className="flex items-center gap-4 mb-8">
|
||||
<div className="w-10 h-10 bg-canino-blue text-white rounded-xl flex items-center justify-center">
|
||||
<CalendarDays className="w-6 h-6" />
|
||||
</div>
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 italic font-vazir">توصیه غذایی و نحوه مصرف</h3>
|
||||
</div>
|
||||
<p className="text-medical-gray-700 leading-relaxed text-sm md:text-base font-medium font-vazir">
|
||||
{product.feedingAdvice}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
{/* Specialist Note */}
|
||||
<section className="bg-white rounded-[3rem] p-10 border border-medical-gray-200">
|
||||
{product.specialist && (
|
||||
{product.specialist && (
|
||||
<div className="flex flex-col md:flex-row gap-10 items-start">
|
||||
<img
|
||||
src={product.specialist.image}
|
||||
<img
|
||||
src={product.specialist.image}
|
||||
alt={product.specialist.name}
|
||||
className="w-32 h-32 rounded-[2.5rem] object-cover border-4 border-medical-gray-50 shadow-xl"
|
||||
/>
|
||||
@@ -352,19 +352,19 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
"{product.specialist.message}"
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* Specialized Landing Banner */}
|
||||
<section>
|
||||
<div
|
||||
<div
|
||||
className="relative bg-canino-blue rounded-[3rem] p-12 overflow-hidden group cursor-pointer"
|
||||
onClick={() => toast.info("بزودی: صفحه فرود تخصصی این محصول در حال آمادهسازی است")}
|
||||
>
|
||||
<div className="absolute top-0 right-0 w-full h-full bg-[url('https://www.transparenttextures.com/patterns/cubes.png')] opacity-10" />
|
||||
<div className="absolute -bottom-20 -left-20 w-80 h-80 bg-white/10 rounded-full blur-3xl group-hover:bg-white/20 transition-all duration-700" />
|
||||
|
||||
|
||||
<div className="relative z-10 flex flex-col md:flex-row items-center justify-between gap-8">
|
||||
<div className="text-center md:text-right">
|
||||
<h3 className="text-3xl lg:text-4xl font-black text-white mb-4 italic">مشاهده بررسی تخصصی و نتایج درمانی</h3>
|
||||
@@ -373,13 +373,13 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
</p>
|
||||
</div>
|
||||
<div className="bg-white text-canino-blue px-8 py-4 rounded-2xl font-black shadow-2xl hover:scale-105 transition-transform flex items-center gap-3">
|
||||
ورود به آزمایشگاه علمی
|
||||
<ArrowRight className="w-5 h-5 rotate-180" />
|
||||
ورود به آزمایشگاه علمی
|
||||
<ArrowRight className="w-5 h-5 rotate-180" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
{/* FAQ Section */}
|
||||
{product.faqs && (
|
||||
<section className="pt-10">
|
||||
@@ -393,11 +393,11 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
{product.faqs.map((faq, i) => (
|
||||
<details key={i} className="group bg-white border border-medical-gray-200 rounded-3xl overflow-hidden hover:border-canino-blue/30 transition-all">
|
||||
<summary className="flex items-center justify-between p-6 cursor-pointer list-none">
|
||||
<span className="font-bold text-medical-gray-900 font-vazir">{faq.question}</span>
|
||||
<ChevronDown className="w-5 h-5 text-canino-blue group-open:rotate-180 transition-transform" />
|
||||
<span className="font-bold text-medical-gray-900 font-vazir">{faq.question}</span>
|
||||
<ChevronDown className="w-5 h-5 text-canino-blue group-open:rotate-180 transition-transform" />
|
||||
</summary>
|
||||
<div className="px-6 pb-6 text-sm text-medical-gray-500 font-medium leading-relaxed font-vazir border-t border-medical-gray-50 pt-4">
|
||||
{faq.answer}
|
||||
{faq.answer}
|
||||
</div>
|
||||
</details>
|
||||
))}
|
||||
@@ -409,111 +409,111 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
{/* Sticky Sidebar */}
|
||||
<div className="lg:col-span-4 lg:sticky lg:top-24 space-y-8">
|
||||
<div className="bg-white rounded-[3rem] border-2 border-medical-gray-100 p-8 shadow-2xl relative overflow-hidden">
|
||||
<div className="absolute top-0 right-0 w-24 h-24 bg-canino-blue/5 rounded-full -mr-12 -mt-12" />
|
||||
|
||||
<div className="text-4xl font-black font-vazir text-medical-gray-900 tracking-tighter mb-4">
|
||||
{toPersian(product.price)}
|
||||
</div>
|
||||
<div className="absolute top-0 right-0 w-24 h-24 bg-canino-blue/5 rounded-full -mr-12 -mt-12" />
|
||||
|
||||
{/* Refill Auto-Calculator */}
|
||||
<div className="bg-canino-blue rounded-[2rem] p-6 text-white mb-8 border-b-8 border-white/20 shadow-2xl">
|
||||
<div className="flex items-center gap-2 mb-4 opacity-90">
|
||||
<Clock className="w-4 h-4 text-white" />
|
||||
<span className="text-[10px] font-bold uppercase tracking-widest font-vazir text-white">هوش مصنوعی تکرار خرید</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<div className="text-2xl font-black font-vazir text-white">{toPersian(calculation.duration)} روز</div>
|
||||
<div className="text-[9px] font-bold text-white/80 font-vazir whitespace-nowrap">تخمین اتمام برای {toPersian(weight)} کیلوگرم</div>
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<div className="text-xl font-black font-vazir text-white">{toPersian(calculation.dailyDose)}</div>
|
||||
<div className="text-[9px] font-bold text-white/80 font-vazir whitespace-nowrap">دوز روزانه ({calculation.unit === 'g' ? 'گرم' : calculation.unit})</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-4xl font-black font-vazir text-medical-gray-900 tracking-tighter mb-4">
|
||||
{toPersian(product.price)}
|
||||
</div>
|
||||
|
||||
{/* Manual Calculator (Mini) */}
|
||||
<div className="bg-medical-gray-50 rounded-2xl p-6 border border-medical-gray-100 mb-8 space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-[10px] font-black text-medical-gray-400 font-vazir">وزن پت (کیلوگرم)</span>
|
||||
<span className="text-sm font-black text-canino-blue font-vazir">{toPersian(weight)}</span>
|
||||
{/* Refill Auto-Calculator */}
|
||||
<div className="bg-canino-blue rounded-[2rem] p-6 text-white mb-8 border-b-8 border-white/20 shadow-2xl">
|
||||
<div className="flex items-center gap-2 mb-4 opacity-90">
|
||||
<Clock className="w-4 h-4 text-white" />
|
||||
<span className="text-[10px] font-bold uppercase tracking-widest font-vazir text-white">هوش مصنوعی تکرار خرید</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<div className="text-2xl font-black font-vazir text-white">{toPersian(calculation.duration)} روز</div>
|
||||
<div className="text-[9px] font-bold text-white/80 font-vazir whitespace-nowrap">تخمین اتمام برای {toPersian(weight)} کیلوگرم</div>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
min="1" max="100"
|
||||
value={weight}
|
||||
onChange={(e) => setWeight(parseInt(e.target.value))}
|
||||
className="w-full h-1.5 bg-medical-gray-200 rounded-lg appearance-none cursor-pointer accent-canino-blue"
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => setPetType("young")} className={`flex-1 py-2 rounded-xl text-[10px] font-black transition-all ${petType === "young" ? 'bg-canino-blue text-white shadow-lg' : 'bg-white text-medical-gray-400'}`}>جوان</button>
|
||||
<button onClick={() => setPetType("adult")} className={`flex-1 py-2 rounded-xl text-[10px] font-black transition-all ${petType === "adult" ? 'bg-canino-blue text-white shadow-lg' : 'bg-white text-medical-gray-400'}`}>بالغ</button>
|
||||
<div className="text-left">
|
||||
<div className="text-xl font-black font-vazir text-white">{toPersian(calculation.dailyDose)}</div>
|
||||
<div className="text-[9px] font-bold text-white/80 font-vazir whitespace-nowrap">دوز روزانه ({calculation.unit === 'g' ? 'گرم' : calculation.unit})</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 mb-6">
|
||||
{/* Quantity Selector - 40% Width */}
|
||||
<div className="flex items-center gap-4 bg-medical-gray-50 border border-medical-gray-100 rounded-2xl p-2 h-16 w-[40%]">
|
||||
<button
|
||||
onClick={() => setItemQuantity(Math.max(1, itemQuantity - 1))}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white text-medical-gray-900 border border-medical-gray-200 hover:bg-canino-blue hover:text-white hover:border-canino-blue transition-all shadow-sm"
|
||||
>
|
||||
<Minus className="w-4 h-4" />
|
||||
</button>
|
||||
<span className="text-xl font-black text-medical-gray-900 flex-1 text-center font-vazir">
|
||||
{toPersian(itemQuantity)}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => setItemQuantity(itemQuantity + 1)}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white text-medical-gray-900 border border-medical-gray-200 hover:bg-canino-blue hover:text-white hover:border-canino-blue transition-all shadow-sm"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
{/* Manual Calculator (Mini) */}
|
||||
<div className="bg-medical-gray-50 rounded-2xl p-6 border border-medical-gray-100 mb-8 space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-[10px] font-black text-medical-gray-400 font-vazir">وزن پت (کیلوگرم)</span>
|
||||
<span className="text-sm font-black text-canino-blue font-vazir">{toPersian(weight)}</span>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
min="1" max="100"
|
||||
value={weight}
|
||||
onChange={(e) => setWeight(parseInt(e.target.value))}
|
||||
className="w-full h-1.5 bg-medical-gray-200 rounded-lg appearance-none cursor-pointer accent-canino-blue"
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => setPetType("young")} className={`flex-1 py-2 rounded-xl text-[10px] font-black transition-all ${petType === "young" ? 'bg-canino-blue text-white shadow-lg' : 'bg-white text-medical-gray-400'}`}>جوان</button>
|
||||
<button onClick={() => setPetType("adult")} className={`flex-1 py-2 rounded-xl text-[10px] font-black transition-all ${petType === "adult" ? 'bg-canino-blue text-white shadow-lg' : 'bg-white text-medical-gray-400'}`}>بالغ</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Add to Cart Button - 60% Width */}
|
||||
<button
|
||||
onClick={() => {
|
||||
addItem(product, itemQuantity, { quantity: calculation.dailyDose, unit: calculation.unit });
|
||||
toast.success(`${toPersian(itemQuantity)} عدد ${product.name} به سبد خرید اضافه شد`);
|
||||
}}
|
||||
className="w-[60%] flex items-center justify-center gap-1.5 px-4 bg-medical-gray-900 text-white rounded-2xl h-16 font-black text-sm hover:bg-canino-blue transition-all shadow-xl shadow-black/10 font-vazir whitespace-nowrap"
|
||||
<div className="flex gap-4 mb-6">
|
||||
{/* Quantity Selector - 40% Width */}
|
||||
<div className="flex items-center gap-4 bg-medical-gray-50 border border-medical-gray-100 rounded-2xl p-2 h-16 w-[40%]">
|
||||
<button
|
||||
onClick={() => setItemQuantity(Math.max(1, itemQuantity - 1))}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white text-medical-gray-900 border border-medical-gray-200 hover:bg-canino-blue hover:text-white hover:border-canino-blue transition-all shadow-sm"
|
||||
>
|
||||
<ShoppingBag className="w-5 h-5 mb-1" />
|
||||
افزودن به سبد خرید
|
||||
<Minus className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 flex flex-col gap-3">
|
||||
<div className="flex items-center gap-2 text-[10px] font-bold text-medical-gray-400 font-vazir">
|
||||
<ShieldCheck className="w-4 h-4 text-green-500" />
|
||||
ضمانت اصالت محصول (Made in Germany)
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-[10px] font-bold text-medical-gray-400 font-vazir">
|
||||
<Clock className="w-4 h-4 text-canino-blue" />
|
||||
آماده ارسال (تحویل حداکثر ۴۸ ساعت)
|
||||
</div>
|
||||
</div>
|
||||
<span className="text-xl font-black text-medical-gray-900 flex-1 text-center font-vazir">
|
||||
{toPersian(itemQuantity)}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => setItemQuantity(itemQuantity + 1)}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white text-medical-gray-900 border border-medical-gray-200 hover:bg-canino-blue hover:text-white hover:border-canino-blue transition-all shadow-sm"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Add to Cart Button - 60% Width */}
|
||||
<button
|
||||
onClick={() => {
|
||||
addItem(product, itemQuantity, { quantity: calculation.dailyDose, unit: calculation.unit });
|
||||
toast.success(`${toPersian(itemQuantity)} عدد ${product.name} به سبد خرید اضافه شد`);
|
||||
}}
|
||||
className="w-[60%] flex items-center justify-center gap-1.5 px-4 bg-medical-gray-900 text-white rounded-2xl h-16 font-black text-sm hover:bg-canino-blue transition-all shadow-xl shadow-black/10 font-vazir whitespace-nowrap"
|
||||
>
|
||||
<ShoppingBag className="w-5 h-5 mb-1" />
|
||||
افزودن به سبد خرید
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 flex flex-col gap-3">
|
||||
<div className="flex items-center gap-2 text-[10px] font-bold text-medical-gray-400 font-vazir">
|
||||
<ShieldCheck className="w-4 h-4 text-green-500" />
|
||||
ضمانت اصالت محصول (Made in Germany)
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-[10px] font-bold text-medical-gray-400 font-vazir">
|
||||
<Clock className="w-4 h-4 text-canino-blue" />
|
||||
آماده ارسال (تحویل حداکثر ۴۸ ساعت)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* expected results box */}
|
||||
{product.expectedResults && (
|
||||
<div className="bg-white rounded-[2.5rem] border border-medical-gray-200 p-8">
|
||||
<h4 className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-6 font-vazir">تغییرات قابل انتظار</h4>
|
||||
<div className="space-y-4">
|
||||
{product.expectedResults.map((res, i) => {
|
||||
const Icon = ICON_MAP[res.icon] || Sparkles;
|
||||
return (
|
||||
<div key={i} className="flex items-center gap-4 group">
|
||||
<div className="w-10 h-10 bg-medical-gray-50 rounded-xl flex items-center justify-center text-canino-blue group-hover:bg-canino-blue group-hover:text-white transition-all">
|
||||
<Icon className="w-5 h-5" />
|
||||
</div>
|
||||
<span className="text-xs font-bold text-medical-gray-700 font-vazir">{res.text}</span>
|
||||
<h4 className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-6 font-vazir">تغییرات قابل انتظار</h4>
|
||||
<div className="space-y-4">
|
||||
{product.expectedResults.map((res, i) => {
|
||||
const Icon = ICON_MAP[res.icon] || Sparkles;
|
||||
return (
|
||||
<div key={i} className="flex items-center gap-4 group">
|
||||
<div className="w-10 h-10 bg-medical-gray-50 rounded-xl flex items-center justify-center text-canino-blue group-hover:bg-canino-blue group-hover:text-white transition-all">
|
||||
<Icon className="w-5 h-5" />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<span className="text-xs font-bold text-medical-gray-700 font-vazir">{res.text}</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -533,37 +533,37 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-2 gap-8">
|
||||
{product.relatedProducts.map(relId => {
|
||||
const relProduct = allProducts.find(p => p.id === relId);
|
||||
if (!relProduct) return null;
|
||||
return (
|
||||
<motion.div
|
||||
{product.relatedProducts.map(relId => {
|
||||
const relProduct = allProducts.find(p => p.id === relId);
|
||||
if (!relProduct) return null;
|
||||
return (
|
||||
<motion.div
|
||||
key={relId}
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
className="bg-white rounded-[3rem] p-8 border border-medical-gray-200 flex flex-col md:flex-row gap-8 items-center cursor-pointer hover:shadow-2xl transition-all"
|
||||
onClick={() => router.push(`/shop/${relProduct.id}`)}
|
||||
>
|
||||
<div className="w-40 h-40 bg-medical-gray-50 rounded-[2rem] p-4 flex items-center justify-center">
|
||||
<SafeImage src={relProduct.image} alt={relProduct.name} className="w-full h-full object-contain drop-shadow-xl" />
|
||||
</div>
|
||||
<div className="flex-1 text-center md:text-right">
|
||||
<h4 className="text-xl font-black text-medical-gray-900 mb-2">{relProduct.name}</h4>
|
||||
<p className="text-sm text-medical-gray-500 mb-6">{relProduct.description}</p>
|
||||
<div className="flex items-center justify-center md:justify-start gap-4">
|
||||
<span className="text-lg font-black text-canino-blue">{relProduct.price}</span>
|
||||
<ArrowRight className="w-4 h-4 text-medical-gray-300" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-px h-24 bg-medical-gray-100 hidden md:block" />
|
||||
<div className="flex items-center justify-center gap-1 group">
|
||||
<span className="text-xs font-black text-medical-gray-400 group-hover:text-canino-blue transition-colors">مشاهده محصول مکمل</span>
|
||||
<ChevronLeft className="w-4 h-4 text-medical-gray-300 group-hover:text-canino-blue group-hover:-translate-x-1 transition-all rtl:group-hover:translate-x-1" />
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
>
|
||||
<div className="w-40 h-40 bg-medical-gray-50 rounded-[2rem] p-4 flex items-center justify-center">
|
||||
<SafeImage src={relProduct.image} alt={relProduct.name} className="w-full h-full object-contain drop-shadow-xl" />
|
||||
</div>
|
||||
<div className="flex-1 text-center md:text-right">
|
||||
<h4 className="text-xl font-black text-medical-gray-900 mb-2">{relProduct.name}</h4>
|
||||
<p className="text-sm text-medical-gray-500 mb-6">{relProduct.description}</p>
|
||||
<div className="flex items-center justify-center md:justify-start gap-4">
|
||||
<span className="text-lg font-black text-canino-blue">{relProduct.price}</span>
|
||||
<ArrowRight className="w-4 h-4 text-medical-gray-300" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-px h-24 bg-medical-gray-100 hidden md:block" />
|
||||
<div className="flex items-center justify-center gap-1 group">
|
||||
<span className="text-xs font-black text-medical-gray-400 group-hover:text-canino-blue transition-colors">مشاهده محصول مکمل</span>
|
||||
<ChevronLeft className="w-4 h-4 text-medical-gray-300 group-hover:text-canino-blue group-hover:-translate-x-1 transition-all rtl:group-hover:translate-x-1" />
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
@@ -573,59 +573,59 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
<AnimatePresence>
|
||||
{showRefillModal && (
|
||||
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="absolute inset-0 bg-medical-gray-900/60 backdrop-blur-md"
|
||||
/>
|
||||
<motion.div
|
||||
/>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
className="bg-white w-full max-w-lg rounded-[3rem] p-10 relative z-10 shadow-2xl overflow-hidden"
|
||||
>
|
||||
<div className="absolute top-0 left-0 w-full h-2 bg-gradient-to-r from-canino-blue via-blue-400 to-canino-blue" />
|
||||
<button
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="absolute top-6 left-6 text-medical-gray-400 hover:text-medical-gray-600 transition-colors"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
>
|
||||
<div className="absolute top-0 left-0 w-full h-2 bg-gradient-to-r from-canino-blue via-blue-400 to-canino-blue" />
|
||||
<button
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="absolute top-6 left-6 text-medical-gray-400 hover:text-medical-gray-600 transition-colors"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
|
||||
<div className="text-center">
|
||||
<div className="w-20 h-20 bg-canino-blue/10 rounded-[2rem] flex items-center justify-center mx-auto mb-8">
|
||||
<Bell className="w-10 h-10 text-canino-blue animate-bounce" />
|
||||
</div>
|
||||
<h3 className="text-3xl font-black text-medical-gray-900 mb-4 leading-tight italic">سیستم یادآوری هوشمند</h3>
|
||||
<div className="bg-medical-gray-50 border border-medical-gray-100 rounded-3xl p-6 mb-8 text-right">
|
||||
<p className="text-medical-gray-700 leading-relaxed font-medium font-vazir">
|
||||
بر اساس وزن <span className="text-canino-blue font-bold">{toPersian(weight)} کیلوگرمی</span> {activePet ? `برای ${activePet.name}` : 'سگ شما'}، این بسته {toPersian(product.packageSize)} تایی دقیقاً <span className="text-canino-blue font-bold">{toPersian(calculation.duration)} روز</span> دیگر تمام میشود.
|
||||
</p>
|
||||
<div className="mt-4 flex items-center gap-2 text-xs font-bold text-medical-gray-500 font-vazir">
|
||||
<ShieldCheck className="w-4 h-4 text-green-500" />
|
||||
آیا مایلید سیستم ۵ روز قبل از اتمام، به شما پیامک یادآوری ارسال کند؟
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3">
|
||||
<button
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="w-full bg-canino-blue text-white py-5 rounded-2xl font-black text-lg hover:shadow-xl hover:shadow-canino-blue/20 transition-all flex items-center justify-center gap-2"
|
||||
>
|
||||
<CheckCircle2 className="w-5 h-5" />
|
||||
بله، پیامک یادآوری فعال شود
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="w-full py-4 text-medical-gray-400 font-bold text-sm hover:text-medical-gray-600 transition-colors"
|
||||
>
|
||||
خیر، فقط محصول را به سبد خرید اضافه کن
|
||||
</button>
|
||||
<div className="text-center">
|
||||
<div className="w-20 h-20 bg-canino-blue/10 rounded-[2rem] flex items-center justify-center mx-auto mb-8">
|
||||
<Bell className="w-10 h-10 text-canino-blue animate-bounce" />
|
||||
</div>
|
||||
<h3 className="text-3xl font-black text-medical-gray-900 mb-4 leading-tight italic">سیستم یادآوری هوشمند</h3>
|
||||
<div className="bg-medical-gray-50 border border-medical-gray-100 rounded-3xl p-6 mb-8 text-right">
|
||||
<p className="text-medical-gray-700 leading-relaxed font-medium font-vazir">
|
||||
بر اساس وزن <span className="text-canino-blue font-bold">{toPersian(weight)} کیلوگرمی</span> {activePet ? `برای ${activePet.name}` : 'سگ شما'}، این بسته {toPersian(product.packageSize)} تایی دقیقاً <span className="text-canino-blue font-bold">{toPersian(calculation.duration)} روز</span> دیگر تمام میشود.
|
||||
</p>
|
||||
<div className="mt-4 flex items-center gap-2 text-xs font-bold text-medical-gray-500 font-vazir">
|
||||
<ShieldCheck className="w-4 h-4 text-green-500" />
|
||||
آیا مایلید سیستم ۵ روز قبل از اتمام، به شما پیامک یادآوری ارسال کند؟
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
<div className="flex flex-col gap-3">
|
||||
<button
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="w-full bg-canino-blue text-white py-5 rounded-2xl font-black text-lg hover:shadow-xl hover:shadow-canino-blue/20 transition-all flex items-center justify-center gap-2"
|
||||
>
|
||||
<CheckCircle2 className="w-5 h-5" />
|
||||
بله، پیامک یادآوری فعال شود
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setShowRefillModal(false)}
|
||||
className="w-full py-4 text-medical-gray-400 font-bold text-sm hover:text-medical-gray-600 transition-colors"
|
||||
>
|
||||
خیر، فقط محصول را به سبد خرید اضافه کن
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
import React, { useState } from "react";
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import {
|
||||
Dog,
|
||||
Cat,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ShieldCheck,
|
||||
Activity,
|
||||
Bone,
|
||||
Sparkles,
|
||||
import {
|
||||
Dog,
|
||||
Cat,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ShieldCheck,
|
||||
Activity,
|
||||
Bone,
|
||||
Sparkles,
|
||||
Pill,
|
||||
Sparkle
|
||||
} from "lucide-react";
|
||||
@@ -53,7 +53,7 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
}, [texts]);
|
||||
|
||||
const [step, setStep] = useState(1);
|
||||
|
||||
|
||||
// Step 1 Data
|
||||
const [name, setName] = useState("");
|
||||
const [type, setType] = useState<"سگ" | "گربه">("سگ");
|
||||
@@ -71,7 +71,7 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
const handleBack = () => setStep(s => s - 1);
|
||||
|
||||
const handleSubmit = () => {
|
||||
const data = {
|
||||
const data = {
|
||||
name, type, breed, age, weight, activityLevel, medicalConditions
|
||||
};
|
||||
if (onComplete) {
|
||||
@@ -92,7 +92,7 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
<section id="canino-advisor" className="py-24 bg-white">
|
||||
<div className="max-w-4xl mx-auto px-4">
|
||||
<div className="text-center mb-12">
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
className="inline-flex items-center gap-2 px-4 py-2 bg-canino-blue/5 rounded-full mb-6"
|
||||
@@ -100,24 +100,24 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
<Sparkle className="w-4 h-4 text-canino-blue" />
|
||||
<span className="text-canino-blue text-xs font-black uppercase tracking-widest font-vazir">تکنولوژی پایش هوشمند</span>
|
||||
</motion.div>
|
||||
<h2 className="text-4xl lg:text-5xl font-black text-medical-gray-900 mb-4 font-vazir italic">دستیار سلامت کانینو</h2>
|
||||
<h2 className="text-4xl lg:text-5xl font-black text-medical-gray-900 mb-4 font-vazir italic">دستیار سلامت کانینو</h2>
|
||||
<p className="text-medical-gray-600 font-bold text-lg font-vazir">فقط چند قدم تا صدور شناسنامه هوشمند و دریافت پیشنهادات تخصصی</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="bg-medical-gray-50 rounded-[3.5rem] border border-medical-gray-100 p-8 lg:p-12 shadow-2xl shadow-medical-gray-200/50 relative overflow-hidden">
|
||||
{/* Progress Indicator */}
|
||||
<div className="absolute top-0 left-0 w-full h-2 bg-medical-gray-200">
|
||||
<motion.div
|
||||
className="h-full bg-canino-blue"
|
||||
<motion.div
|
||||
className="h-full bg-canino-blue"
|
||||
initial={{ width: "0%" }}
|
||||
animate={{ width: `${(step / 3) * 100}%` }}
|
||||
transition={{ duration: 0.5 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<AnimatePresence mode="wait">
|
||||
{step === 1 && (
|
||||
<motion.div
|
||||
<motion.div
|
||||
key="step1"
|
||||
initial={{ opacity: 0, x: 20 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
@@ -128,16 +128,16 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 mb-2 font-vazir uppercase italic tracking-tight">گام اول: هویت بصری</h3>
|
||||
<p className="text-medical-gray-600 font-bold font-vazir">همدم شما رو با چه اسمی صدا میزنید؟</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<button
|
||||
<button
|
||||
onClick={() => setType("سگ")}
|
||||
className={`flex flex-col items-center gap-4 p-8 rounded-[2.5rem] border-4 transition-all focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none ${type === "سگ" ? 'border-canino-blue bg-white shadow-xl shadow-canino-blue/10 scale-105' : 'border-transparent bg-white/50 text-medical-gray-400 hover:bg-white'}`}
|
||||
>
|
||||
<Dog className={`w-12 h-12 ${type === "سگ" ? 'text-canino-blue' : 'text-current'}`} />
|
||||
<span className="text-lg font-black font-vazir">سگ</span>
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
onClick={() => setType("گربه")}
|
||||
className={`flex flex-col items-center gap-4 p-8 rounded-[2.5rem] border-4 transition-all focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none ${type === "گربه" ? 'border-canino-blue bg-white shadow-xl shadow-canino-blue/10 scale-105' : 'border-transparent bg-white/50 text-medical-gray-400 hover:bg-white'}`}
|
||||
>
|
||||
@@ -145,12 +145,12 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
<span className="text-lg font-black font-vazir">گربه</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-600 pr-2">نام پت</label>
|
||||
<input
|
||||
type="text"
|
||||
<input
|
||||
type="text"
|
||||
value={name}
|
||||
onChange={e => setName(e.target.value)}
|
||||
placeholder="لوسی، تدی..."
|
||||
@@ -159,8 +159,8 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-600 pr-2">نژاد</label>
|
||||
<input
|
||||
type="text"
|
||||
<input
|
||||
type="text"
|
||||
value={breed}
|
||||
onChange={e => setBreed(e.target.value)}
|
||||
placeholder="ژرمن، پرشین..."
|
||||
@@ -168,11 +168,11 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
|
||||
<button
|
||||
onClick={handleNext}
|
||||
disabled={!name || !breed}
|
||||
className="w-full py-6 bg-medical-gray-900 text-white rounded-3xl font-black text-lg hover:bg-canino-blue focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all shadow-xl shadow-medical-gray-900/10 flex items-center justify-center gap-3 font-vazir disabled:bg-medical-gray-200 disabled:text-medical-gray-500 disabled:cursor-not-allowed disabled:shadow-none min-h-[48px]"
|
||||
className="w-full py-6 bg-medical-gray-900 text-white rounded-3xl font-black text-lg hover:bg-canino-blue focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all shadow-xl shadow-medical-gray-900/10 flex items-center justify-center gap-3 font-vazir disabled:bg-gray-300 disabled:text-gray-500 disabled:cursor-not-allowed disabled:shadow-none min-h-[48px] disabled:border disabled:border-gray-400"
|
||||
>
|
||||
ثبت هویت و ادامه
|
||||
<ChevronLeft className="w-5 h-5" />
|
||||
@@ -184,9 +184,9 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
)}
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
|
||||
{step === 2 && (
|
||||
<motion.div
|
||||
<motion.div
|
||||
key="step2"
|
||||
initial={{ opacity: 0, x: 20 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
@@ -197,31 +197,31 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 mb-2 font-vazir uppercase italic tracking-tight">گام دوم: پایش فیزیکی</h3>
|
||||
<p className="text-medical-gray-600 font-bold font-vazir">اطلاعات فیزیکی دقیق به دوزبندی صحیح مکملها کمک میکند</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div className="space-y-4">
|
||||
<label className="block text-center text-xs font-black text-medical-gray-600 uppercase tracking-widest font-vazir">سن (سال)</label>
|
||||
<div className="flex items-center gap-4 bg-white rounded-3xl p-2 border border-medical-gray-200">
|
||||
<label className="block text-center text-xs font-black text-medical-gray-600 uppercase tracking-widest font-vazir">سن حیوان <span className="normal-case">(سال)</span></label>
|
||||
<div className="flex items-center gap-4 bg-white rounded-3xl p-2 border-2 border-medical-gray-200">
|
||||
<button onClick={() => setAge(Math.max(0, age - 1))} className="w-12 h-12 flex items-center justify-center bg-medical-gray-50 rounded-xl text-medical-gray-900 hover:bg-canino-blue hover:text-white focus-visible:ring-2 focus-visible:ring-canino-blue focus-visible:outline-none transition-all shadow-sm font-black text-lg">-</button>
|
||||
<span className="flex-1 text-center text-2xl font-black text-canino-blue font-vazir">{toPersian(age.toString())}</span>
|
||||
<span className="flex-1 text-center text-2xl font-black text-canino-blue font-vazir">{toPersian(age.toString())} <span className="text-sm font-bold text-medical-gray-400">سال</span></span>
|
||||
<button onClick={() => setAge(age + 1)} className="w-12 h-12 flex items-center justify-center bg-medical-gray-50 rounded-xl text-medical-gray-900 hover:bg-canino-blue hover:text-white focus-visible:ring-2 focus-visible:ring-canino-blue focus-visible:outline-none transition-all shadow-sm font-black text-lg">+</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
<label className="block text-center text-xs font-black text-medical-gray-600 uppercase tracking-widest font-vazir">وزن (کیلوگرم)</label>
|
||||
<div className="flex items-center gap-4 bg-white rounded-3xl p-2 border border-medical-gray-200">
|
||||
<label className="block text-center text-xs font-black text-medical-gray-600 uppercase tracking-widest font-vazir">وزن حیوان <span className="normal-case">(کیلوگرم)</span></label>
|
||||
<div className="flex items-center gap-4 bg-white rounded-3xl p-2 border-2 border-medical-gray-200">
|
||||
<button onClick={() => setWeight(Math.max(1, weight - 1))} className="w-12 h-12 flex items-center justify-center bg-medical-gray-50 rounded-xl text-medical-gray-900 hover:bg-canino-blue hover:text-white focus-visible:ring-2 focus-visible:ring-canino-blue focus-visible:outline-none transition-all shadow-sm font-black text-lg">-</button>
|
||||
<span className="flex-1 text-center text-2xl font-black text-canino-blue font-vazir">{toPersian(weight.toString())}</span>
|
||||
<span className="flex-1 text-center text-2xl font-black text-canino-blue font-vazir">{toPersian(weight.toString())} <span className="text-sm font-bold text-medical-gray-400">kg</span></span>
|
||||
<button onClick={() => setWeight(weight + 1)} className="w-12 h-12 flex items-center justify-center bg-medical-gray-50 rounded-xl text-medical-gray-900 hover:bg-canino-blue hover:text-white focus-visible:ring-2 focus-visible:ring-canino-blue focus-visible:outline-none transition-all shadow-sm font-black text-lg">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="space-y-4">
|
||||
<label className="block text-center text-xs font-black text-medical-gray-600 uppercase tracking-widest font-vazir">سطح فعالیت روزانه</label>
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
{["کم", "متوسط", "زیاد"].map(level => (
|
||||
<button
|
||||
<button
|
||||
key={level}
|
||||
onClick={() => setActivityLevel(level as any)}
|
||||
className={`py-4 rounded-2xl border-2 transition-all font-black italic focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none min-h-[48px] ${activityLevel === level ? 'border-canino-blue bg-white text-canino-blue shadow-lg' : 'border-transparent bg-white/50 text-medical-gray-500 hover:bg-white'}`}
|
||||
@@ -231,16 +231,16 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex gap-4 pt-4">
|
||||
<button
|
||||
<button
|
||||
onClick={handleBack}
|
||||
className="flex-1 py-6 bg-medical-gray-100 text-medical-gray-600 rounded-3xl font-black text-lg hover:bg-medical-gray-200 focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all flex items-center justify-center gap-3 font-vazir min-h-[48px]"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
قبلی
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
onClick={handleNext}
|
||||
className="flex-[2] py-6 bg-medical-gray-900 text-white rounded-3xl font-black text-lg hover:bg-canino-blue focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all shadow-xl shadow-medical-gray-900/10 flex items-center justify-center gap-3 font-vazir min-h-[48px]"
|
||||
>
|
||||
@@ -250,9 +250,9 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
|
||||
{step === 3 && (
|
||||
<motion.div
|
||||
<motion.div
|
||||
key="step3"
|
||||
initial={{ opacity: 0, x: 20 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
@@ -263,13 +263,13 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 mb-2 font-vazir uppercase italic tracking-tight">گام آخر: سوابق و حساسیتها</h3>
|
||||
<p className="text-medical-gray-600 font-bold font-vazir">در صورت وجود هر یک از موارد زیر، آن را تیک بزنید</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{medicalOptions.map((opt) => (
|
||||
<button
|
||||
<button
|
||||
key={opt.id}
|
||||
onClick={() => {
|
||||
setMedicalConditions(prev =>
|
||||
setMedicalConditions(prev =>
|
||||
prev.includes(opt.condition) ? prev.filter(c => c !== opt.condition) : [...prev, opt.condition]
|
||||
);
|
||||
}}
|
||||
@@ -282,16 +282,16 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex gap-4 pt-4">
|
||||
<button
|
||||
<button
|
||||
onClick={handleBack}
|
||||
className="flex-1 py-6 bg-medical-gray-100 text-medical-gray-600 rounded-3xl font-black text-lg hover:bg-medical-gray-200 focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all flex items-center justify-center gap-3 font-vazir min-h-[48px]"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
قبلی
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
className="flex-[2] py-6 bg-canino-blue text-white rounded-3xl font-black text-lg hover:bg-indigo-700 focus-visible:ring-4 focus-visible:ring-canino-blue/30 focus-visible:outline-none transition-all shadow-xl shadow-canino-blue/20 flex items-center justify-center gap-3 font-vazir min-h-[48px]"
|
||||
>
|
||||
|
||||
@@ -59,14 +59,14 @@ export default function TopUpModal({ isOpen, onClose, onConfirm }: TopUpModalPro
|
||||
<AnimatePresence>
|
||||
{isOpen && (
|
||||
<div className="fixed inset-0 z-[110] flex items-center justify-center p-4">
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={onClose}
|
||||
className="absolute inset-0 bg-medical-gray-900/60 backdrop-blur-md"
|
||||
/>
|
||||
<motion.div
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.9, y: 20 }}
|
||||
@@ -80,7 +80,7 @@ export default function TopUpModal({ isOpen, onClose, onConfirm }: TopUpModalPro
|
||||
</div>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 italic">شارژ سریع کیف پول</h3>
|
||||
</div>
|
||||
<button
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl bg-white border border-medical-gray-200 text-medical-gray-400 hover:text-red-500 transition-all"
|
||||
>
|
||||
@@ -99,8 +99,8 @@ export default function TopUpModal({ isOpen, onClose, onConfirm }: TopUpModalPro
|
||||
onClick={() => handlePresetSelect(preset.value)}
|
||||
className={cn(
|
||||
"px-6 py-3 rounded-2xl text-sm font-black transition-all border",
|
||||
selectedPreset === preset.value
|
||||
? "bg-canino-blue text-white border-canino-blue shadow-lg shadow-canino-blue/20"
|
||||
selectedPreset === preset.value
|
||||
? "bg-canino-blue text-white border-canino-blue shadow-lg shadow-canino-blue/20"
|
||||
: "bg-white text-medical-gray-700 border-medical-gray-100 hover:border-canino-blue"
|
||||
)}
|
||||
>
|
||||
@@ -128,8 +128,8 @@ export default function TopUpModal({ isOpen, onClose, onConfirm }: TopUpModalPro
|
||||
</div>
|
||||
|
||||
<div className="bg-blue-50 border border-blue-100 rounded-2xl p-4 flex gap-3">
|
||||
<Sparkles className="w-5 h-5 text-canino-blue shrink-0" />
|
||||
<p className="text-[10px] font-bold text-canino-blue leading-relaxed">با شارژ کیف پول، از هدیههای هوشمند کانینو و اولویت در ارسال سفارشها بهرهمند شوید.</p>
|
||||
<Sparkles className="w-5 h-5 text-canino-blue shrink-0" />
|
||||
<p className="text-[10px] font-bold text-canino-blue leading-relaxed">با شارژ کیف پول، از هدیههای هوشمند کانینو و اولویت در ارسال سفارشها بهرهمند شوید.</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
|
||||
@@ -19,13 +19,13 @@ export default function UserDashboard() {
|
||||
const { profile, logout, addAddress, updateAddress, deleteAddress, setDefaultAddress, topUpWallet } = useUserStore();
|
||||
const { orders } = useCartStore();
|
||||
const [activeTab, setActiveTab] = React.useState<"profile" | "orders" | "wallet" | "addresses">("profile");
|
||||
const [isLoadingOrders, setIsLoadingOrders] = useState(true);
|
||||
const [isLoadingOrders, setIsLoadingOrders] = useState(false);
|
||||
|
||||
// Fetch fresh profile data (which includes orders) whenever orders tab is opened
|
||||
React.useEffect(() => {
|
||||
if (activeTab === "orders") {
|
||||
setIsLoadingOrders(true);
|
||||
const timer = setTimeout(() => setIsLoadingOrders(false), 800);
|
||||
return () => clearTimeout(timer);
|
||||
useUserStore.getState().fetchProfile().finally(() => setIsLoadingOrders(false));
|
||||
}
|
||||
}, [activeTab]);
|
||||
const [selectedOrder, setSelectedOrder] = useState<any>(null);
|
||||
|
||||
Reference in new issue
Block a user