feat: core pages and components migrated to Next.js (Home, Shop, Product)
This commit is contained in:
1 parent
72d2a5600a
commit
3de0408e6f
11 files changed
+246
-138
No files matched your search
@@ -12,12 +12,13 @@ import LoginModal from "../components/LoginModal";
|
||||
import B2BPortal from "../components/B2BPortal";
|
||||
import { useUserStore } from "../lib/store/userStore";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import { useUIStore } from "../lib/store/uiStore";
|
||||
|
||||
export default function ClientLayout({ children }: { children: React.ReactNode }) {
|
||||
const [isCartOpen, setIsCartOpen] = useState(false);
|
||||
const [showB2B, setShowB2B] = useState(false);
|
||||
const [showLoginModal, setShowLoginModal] = useState(false);
|
||||
const [advisorData, setAdvisorData] = useState<any>(null);
|
||||
const {
|
||||
isCartOpen, isLoginModalOpen, isB2BPortalOpen, advisorData,
|
||||
setCartOpen, setLoginModalOpen, setB2BPortalOpen, clearAdvisorData
|
||||
} = useUIStore();
|
||||
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
@@ -72,30 +73,30 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
|
||||
onNavigate={handleNavigate}
|
||||
onShopNavigate={navigateToShop}
|
||||
currentView={currentView}
|
||||
onCartOpen={() => setIsCartOpen(true)}
|
||||
onCartOpen={() => setCartOpen(true)}
|
||||
onSearch={handleSearch}
|
||||
onB2BOpen={() => setShowB2B(true)}
|
||||
onB2BOpen={() => setB2BPortalOpen(true)}
|
||||
/>
|
||||
<main className="min-h-screen">
|
||||
{children}
|
||||
</main>
|
||||
<Footer onNavigate={handleNavigate} onShopNavigate={navigateToShop} onB2BOpen={() => setShowB2B(true)} />
|
||||
<Footer onNavigate={handleNavigate} onShopNavigate={navigateToShop} onB2BOpen={() => setB2BPortalOpen(true)} />
|
||||
|
||||
{showB2B && <B2BPortal onClose={() => setShowB2B(false)} />}
|
||||
{isB2BPortalOpen && <B2BPortal onClose={() => setB2BPortalOpen(false)} />}
|
||||
<CartDrawer
|
||||
isOpen={isCartOpen}
|
||||
onClose={() => setIsCartOpen(false)}
|
||||
onCheckout={() => { setIsCartOpen(false); router.push('/checkout'); }}
|
||||
onClose={() => setCartOpen(false)}
|
||||
onCheckout={() => { setCartOpen(false); router.push('/checkout'); }}
|
||||
onShopNavigate={navigateToShop}
|
||||
/>
|
||||
<LoginModal
|
||||
isOpen={showLoginModal}
|
||||
isOpen={isLoginModalOpen}
|
||||
onClose={() => {
|
||||
setShowLoginModal(false);
|
||||
setAdvisorData(null);
|
||||
setLoginModalOpen(false);
|
||||
clearAdvisorData();
|
||||
}}
|
||||
onLogin={() => {
|
||||
setShowLoginModal(false);
|
||||
setLoginModalOpen(false);
|
||||
}}
|
||||
petName={advisorData?.name}
|
||||
isAdvisorContext={!!advisorData}
|
||||
|
||||
@@ -1,65 +1,116 @@
|
||||
import Image from "next/image";
|
||||
import Hero from "../components/Hero";
|
||||
import SmartAdvisor from "../components/SmartAdvisor";
|
||||
import FeaturedProducts from "../components/FeaturedProducts";
|
||||
import VetGallery from "../components/VetGallery";
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<>
|
||||
<Hero />
|
||||
{/* SmartAdvisor uses uiStore/userStore internally and handles routing automatically */}
|
||||
<SmartAdvisor />
|
||||
<FeaturedProducts />
|
||||
<VetGallery onNavigate={() => {}} />
|
||||
|
||||
{/* Navigation to Sections */}
|
||||
<section className="py-20 bg-medical-gray-50 border-y border-medical-gray-100">
|
||||
<div className="max-w-7xl mx-auto px-4 grid md:grid-cols-2 gap-8">
|
||||
<Link
|
||||
href="/shop"
|
||||
className="bg-white p-12 rounded-[3.5rem] border border-medical-gray-200 shadow-sm hover:shadow-2xl hover:-translate-y-2 transition-all cursor-pointer group block"
|
||||
>
|
||||
<h3 className="text-3xl font-black text-medical-gray-900 mb-4 group-hover:text-canina-blue transition-colors italic">فروشگاه تخصصی</h3>
|
||||
<p className="text-medical-gray-500 mb-8 leading-relaxed">دسترسی به تمامی محصولات بر اساس علائم بالینی و نیازهای پت شما.</p>
|
||||
<div className="flex items-center gap-2 text-canina-blue font-black tracking-widest uppercase text-xs">
|
||||
کاتالوگ کامل محصولات
|
||||
<span className="text-lg">←</span>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
href="/wiki"
|
||||
className="bg-medical-gray-900 p-12 rounded-[3.5rem] text-white hover:shadow-2xl hover:-translate-y-2 transition-all cursor-pointer group block"
|
||||
>
|
||||
<h3 className="text-3xl font-black mb-4 group-hover:text-canina-blue transition-colors italic">دانشنامه علمی</h3>
|
||||
<p className="text-white/60 mb-8 leading-relaxed">آشنایی با ترکیبات نایاب و استانداردهای دارویی محصولات آلمانی کانینا.</p>
|
||||
<div className="flex items-center gap-2 text-canina-blue font-black tracking-widest uppercase text-xs">
|
||||
مطالعه مقالات تخصصی
|
||||
<span className="text-lg">←</span>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* About Section Teaser */}
|
||||
<section className="py-24 bg-white overflow-hidden">
|
||||
<div className="max-w-7xl mx-auto px-4 grid lg:grid-cols-2 gap-16 items-center">
|
||||
<div className="relative">
|
||||
<div className="absolute -top-10 -right-10 w-40 h-40 bg-canina-blue/5 rounded-full blur-3xl" />
|
||||
<img
|
||||
src="/assets/images/regenerated_image_1779109861747.png"
|
||||
alt="Laboratory"
|
||||
className="rounded-[3rem] shadow-2xl relative z-10 grayscale-[10%]"
|
||||
/>
|
||||
<div className="absolute -bottom-6 -left-6 bg-canina-blue text-white p-8 rounded-3xl shadow-xl z-20">
|
||||
<div className="text-4xl font-black mb-1 italic">کیفیت</div>
|
||||
<div className="text-xs uppercase tracking-widest font-bold opacity-80">استانداردهای فوقدارویی</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-canina-blue text-xs font-bold uppercase tracking-[0.2em] mb-4">میراث ما از آلمان</div>
|
||||
<h2 className="text-3xl lg:text-5xl font-black text-medical-gray-900 leading-[1.2] mb-8">
|
||||
چرا برند آلمانی Canina مرجع دامپزشکان است؟
|
||||
</h2>
|
||||
<div className="space-y-6">
|
||||
{[
|
||||
{ title: 'مواد اولیه نایاب', desc: 'استفاده از پودر صدف لبسبز اصل نیوزیلند و مواد ارگانیک با گرید دارویی.' },
|
||||
{ title: 'فاقد مواد نگهدارنده', desc: 'تمامی محصولات ۱۰۰٪ طبیعی و فاقد رنگهای مصنوعی و طعمدهندههای شیمیایی هستند.' },
|
||||
{ title: 'تاییدیه اروپا', desc: 'مطابق با سختگیرانهترین استانداردهای ایمنی مواد غذایی و دارویی در اتحادیه اروپا.' }
|
||||
].map((item, idx) => (
|
||||
<div key={idx} className="flex gap-4">
|
||||
<div className="w-12 h-12 rounded-2xl bg-medical-gray-50 flex items-center justify-center flex-shrink-0 text-canina-blue font-bold">
|
||||
{idx + 1}
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-lg font-bold text-medical-gray-900 mb-1">{item.title}</h4>
|
||||
<p className="text-sm text-medical-gray-500 leading-relaxed font-medium">{item.desc}</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Call to Action */}
|
||||
<section className="bg-canina-blue py-20 relative overflow-hidden">
|
||||
<div className="absolute inset-0 opacity-10">
|
||||
<div className="grid grid-cols-10 h-full w-full">
|
||||
{Array.from({length: 100}).map((_, i) => (
|
||||
<div key={i} className="border border-white/20" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="max-w-4xl mx-auto px-4 text-center relative z-10">
|
||||
<h2 className="text-3xl lg:text-5xl font-black text-white mb-8 leading-tight">
|
||||
میخواهید بدانید کدام محصول برای پت شما مناسبتر است؟
|
||||
</h2>
|
||||
<p className="text-white/80 text-lg mb-10 leading-relaxed">
|
||||
تیم متخصص دامپزشکی کانینا ایران آماده پاسخگویی به سوالات شماست.
|
||||
</p>
|
||||
<div className="flex flex-wrap justify-center gap-4">
|
||||
<button className="bg-white text-canina-blue px-12 py-5 rounded-full font-black text-xl hover:scale-105 transition-transform shadow-2xl shadow-black/20">
|
||||
دریافت رژیم مکمل رایگان
|
||||
</button>
|
||||
<Link
|
||||
href="/shop"
|
||||
className="bg-canina-blue/20 backdrop-blur-md border-2 border-white text-white px-12 py-5 rounded-full font-black text-xl hover:bg-white hover:text-canina-blue transition-all"
|
||||
>
|
||||
ورود به محصولات تخصصی
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import ProductPage from "../../../components/ProductPage";
|
||||
|
||||
export default async function ShopProductPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const resolvedParams = await params;
|
||||
return <ProductPage productId={resolvedParams.id} />;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import ArchivePage from "../../components/ArchivePage";
|
||||
|
||||
export default async function Shop({ searchParams }: { searchParams: Promise<{ [key: string]: string | string[] | undefined }> }) {
|
||||
const resolvedParams = await searchParams;
|
||||
const category = typeof resolvedParams.category === 'string' ? resolvedParams.category : "all";
|
||||
const search = typeof resolvedParams.search === 'string' ? resolvedParams.search : "";
|
||||
|
||||
return <ArchivePage initialCategory={category} initialSearch={search} />;
|
||||
}
|
||||
Reference in new issue
Block a user