Merge version_3 into main #5
@@ -1,20 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import ReactLenis from "lenis/react";
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import { useBlogPosts } from "@/hooks/useBlogPosts";
|
||||
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
|
||||
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
|
||||
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
|
||||
|
||||
// Define common navigation items for sub-pages to maintain consistency
|
||||
const ALL_NAV_ITEMS_SUB_PAGES = [
|
||||
const navItemsForSubPages = [
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Products", id: "/products" },
|
||||
{ name: "Shop", id: "/shop" },
|
||||
{ name: "Blog", id: "/blog" },
|
||||
{ name: "About", id: "/#about" },
|
||||
{ name: "Testimonials", id: "/#testimonials" },
|
||||
{ name: "FAQs", id: "/#faqs" }
|
||||
{ name: "FAQs", id: "/#faqs" },
|
||||
{ name: "Contact", id: "/#contact" },
|
||||
];
|
||||
|
||||
export default function BlogPage() {
|
||||
@@ -33,36 +30,33 @@ export default function BlogPage() {
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Shop Now", href: "/products" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForSubPages}
|
||||
button={{ text: "Shop Now", href: "/shop" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="w-full mx-auto py-40 text-center">
|
||||
<p className="text-foreground">Loading posts...</p>
|
||||
</div>
|
||||
) : (
|
||||
<div id="blog" data-section="blog">
|
||||
<BlogCardThree
|
||||
blogs={posts.map(post => ({ ...post, onBlogClick: () => {} }))}
|
||||
title="Latest Articles"
|
||||
description="Insights and updates from our team"
|
||||
animationType="slide-up"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground={false}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="w-content-width mx-auto py-20 text-center">
|
||||
<p className="text-foreground">Loading posts...</p>
|
||||
</div>
|
||||
) : (
|
||||
<div id="blog" data-section="blog">
|
||||
<BlogCardTwo
|
||||
blogs={posts}
|
||||
title="Latest Articles"
|
||||
description="Insights and updates from our team"
|
||||
animationType="slide-up"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground={false}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</ReactLenis>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ export const metadata: Metadata = {
|
||||
openGraph: {
|
||||
title: "Nano Mango - Unique & Sustainable Cups Store", description: "Discover Nano Mango's exquisite collection of unique and sustainable cups for every beverage. Elevate your sipping experience with our beautifully crafted designs.", url: "https://nanomango.com", siteName: "Nano Mango", images: [
|
||||
{
|
||||
url: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_34my1kGeblbsCcwUUCcjBY9WFkg/uploaded-1770649506170-pxkn8ubj.mp4", alt: "Assortment of stylish cups and mugs from Nano Mango"},
|
||||
url: "/og-image.jpg", alt: "Assortment of stylish cups and mugs from Nano Mango"},
|
||||
],
|
||||
type: "website"},
|
||||
twitter: {
|
||||
card: "summary_large_image", title: "Nano Mango - Unique & Sustainable Cups Store", description: "Discover Nano Mango's exquisite collection of unique and sustainable cups for every beverage. Elevate your sipping experience with our beautifully crafted designs.", images: ["https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_34my1kGeblbsCcwUUCcjBY9WFkg/uploaded-1770649506170-pxkn8ubj.mp4"],
|
||||
card: "summary_large_image", title: "Nano Mango - Unique & Sustainable Cups Store", description: "Discover Nano Mango's exquisite collection of unique and sustainable cups for every beverage. Elevate your sipping experience with our beautifully crafted designs.", images: ["/twitter-image.jpg"],
|
||||
},
|
||||
robots: {
|
||||
index: true,
|
||||
@@ -35,15 +35,12 @@ export default function RootLayout({
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<ServiceWrapper>
|
||||
<body
|
||||
className={`${notoSans.variable} antialiased`}
|
||||
>
|
||||
<body className={`${notoSans.variable} antialiased`}>
|
||||
<Tag />
|
||||
{children}
|
||||
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function() {
|
||||
if (window.self === window.top) return;
|
||||
|
||||
@@ -167,7 +164,7 @@ export default function RootLayout({
|
||||
|
||||
const backgroundImage = computedStyle.backgroundImage;
|
||||
if (backgroundImage && backgroundImage !== 'none') {
|
||||
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?/);
|
||||
const urlMatch = backgroundImage.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||
if (urlMatch && urlMatch[1] && !urlMatch[1].includes('gradient')) {
|
||||
const area = element.offsetWidth * element.offsetHeight;
|
||||
const hasReasonableSize = area > 1000;
|
||||
@@ -337,7 +334,7 @@ export default function RootLayout({
|
||||
const computedStyle = window.getComputedStyle(element);
|
||||
const backgroundImage = computedStyle.backgroundImage;
|
||||
if (backgroundImage && backgroundImage !== 'none') {
|
||||
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?/);
|
||||
const urlMatch = backgroundImage.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||
if (urlMatch) {
|
||||
const originalBgSrc = extractOriginalUrl(urlMatch[1]);
|
||||
if (tagName !== 'img') {
|
||||
@@ -508,15 +505,12 @@ export default function RootLayout({
|
||||
}, '*');
|
||||
|
||||
const handleBeforeInput = (e) => {
|
||||
// Prevent deletion if it would leave the element empty
|
||||
const currentText = element.textContent || '';
|
||||
const inputType = e.inputType;
|
||||
|
||||
// Check if this is a delete operation that would leave the element empty
|
||||
if ((inputType === 'deleteContentBackward' || inputType === 'deleteContentForward' || inputType === 'deleteByCut') && currentText.length <= 1) {
|
||||
e.preventDefault();
|
||||
element.textContent = ' ';
|
||||
// Move cursor to the beginning
|
||||
const range = document.createRange();
|
||||
const sel = window.getSelection();
|
||||
range.setStart(element.firstChild || element, 0);
|
||||
@@ -530,11 +524,9 @@ export default function RootLayout({
|
||||
const elementInfo = getElementInfo(element);
|
||||
let currentText = element.textContent;
|
||||
|
||||
// Ensure there's always at least a space to keep the element editable
|
||||
if (currentText === '' || currentText === null || currentText.length === 0) {
|
||||
element.textContent = ' ';
|
||||
currentText = ' ';
|
||||
// Move cursor to the beginning
|
||||
try {
|
||||
const range = document.createRange();
|
||||
const sel = window.getSelection();
|
||||
@@ -543,7 +535,6 @@ export default function RootLayout({
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
} catch (e) {
|
||||
// Ignore cursor positioning errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,10 +635,8 @@ export default function RootLayout({
|
||||
const elementInfo = getElementInfo(element);
|
||||
let finalText = element.textContent;
|
||||
|
||||
// Trim the final text and convert space-only to empty string for saving
|
||||
if (finalText === ' ' || finalText.trim() === '') {
|
||||
finalText = '';
|
||||
// Update the actual element text to empty for display
|
||||
element.textContent = '';
|
||||
}
|
||||
|
||||
@@ -1290,7 +1279,7 @@ export default function RootLayout({
|
||||
|
||||
let cleanOldValue = oldValue;
|
||||
if (oldValue.includes('url(')) {
|
||||
const urlMatch = oldValue.match(/url(['"]?([^'")]+)['"]?/);
|
||||
const urlMatch = oldValue.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||
if (urlMatch) {
|
||||
cleanOldValue = urlMatch[1];
|
||||
}
|
||||
@@ -1405,10 +1394,10 @@ export default function RootLayout({
|
||||
|
||||
window.parent.postMessage({ type: 'webild-editor-ready' }, '*');
|
||||
})();
|
||||
`
|
||||
}}
|
||||
/>
|
||||
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
|
||||
@@ -10,25 +10,12 @@ import FaqDouble from '@/components/sections/faq/FaqDouble';
|
||||
import ContactFaq from '@/components/sections/contact/ContactFaq';
|
||||
import { Handshake, HeartHandshake, MessageSquareText, Sparkles } from "lucide-react";
|
||||
|
||||
// Define common navigation items for sub-pages to maintain consistency
|
||||
const ALL_NAV_ITEMS_SUB_PAGES = [
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Products", id: "/products" },
|
||||
{ name: "Shop", id: "/shop" },
|
||||
{ name: "Blog", id: "/blog" },
|
||||
{ name: "About", id: "/#about" },
|
||||
{ name: "Testimonials", id: "/#testimonials" },
|
||||
{ name: "FAQs", id: "/#faqs" }
|
||||
];
|
||||
|
||||
// Define navigation items specifically for the homepage (no 'Home' link here)
|
||||
const navItemsForHomePage = [
|
||||
{ name: "Products", id: "/products" },
|
||||
{ name: "About", id: "about" },
|
||||
{ name: "Testimonials", id: "testimonials" },
|
||||
{ name: "FAQs", id: "faqs" },
|
||||
{ name: "Shop", id: "/shop" },
|
||||
{ name: "Blog", id: "/blog" }
|
||||
{ name: "Contact", id: "contact" },
|
||||
];
|
||||
|
||||
export default function SitePage() {
|
||||
@@ -49,7 +36,7 @@ export default function SitePage() {
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForHomePage}
|
||||
button={{ text: "Shop Now", href: "/products" }}
|
||||
button={{ text: "Shop Now", href: "/shop" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
@@ -68,7 +55,7 @@ export default function SitePage() {
|
||||
enableKpiAnimation={true}
|
||||
buttons={[
|
||||
{ text: "Explore Collection", href: "/products" },
|
||||
{ text: "Our Story", href: "/#about" },
|
||||
{ text: "Our Story", href: "#about" },
|
||||
]}
|
||||
videoSrc="https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_34my1kGeblbsCcwUUCcjBY9WFkg/uploaded-1770649506170-pxkn8ubj.mp4"
|
||||
imageAlt="Assortment of stylish cups and mugs from Nano Mango"
|
||||
@@ -81,8 +68,6 @@ export default function SitePage() {
|
||||
titleClassName="font-light text-foreground"
|
||||
descriptionClassName="text-foreground/70"
|
||||
kpiClassName="bg-card/70 backdrop-blur-md border border-accent/20"
|
||||
buttonClassName="shadow-md"
|
||||
buttonContainerClassName="flex-col sm:flex-row"
|
||||
/>
|
||||
</div>
|
||||
<div id="about" data-section="about">
|
||||
@@ -187,7 +172,6 @@ export default function SitePage() {
|
||||
ctaPanelClassName="bg-card shadow-lg"
|
||||
ctaTitleClassName="font-light"
|
||||
ctaDescriptionClassName="text-foreground/80"
|
||||
ctaButtonClassName="shadow-md"
|
||||
faqsPanelClassName="bg-card shadow-lg"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,66 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense } from "react";
|
||||
import ReactLenis from "lenis/react";
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
|
||||
import ProductCatalog from "@/components/ecommerce/productCatalog/ProductCatalog";
|
||||
import ProductCardFour from '@/components/sections/product/ProductCardFour';
|
||||
import { useProductCatalog } from "@/hooks/useProductCatalog";
|
||||
|
||||
// Define common navigation items for sub-pages to maintain consistency
|
||||
const ALL_NAV_ITEMS_SUB_PAGES = [
|
||||
const navItemsForSubPages = [
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Products", id: "/products" },
|
||||
{ name: "Shop", id: "/shop" },
|
||||
{ name: "Blog", id: "/blog" },
|
||||
{ name: "About", id: "/#about" },
|
||||
{ name: "Testimonials", id: "/#testimonials" },
|
||||
{ name: "FAQs", id: "/#faqs" }
|
||||
{ name: "FAQs", id: "/#faqs" },
|
||||
{ name: "Contact", id: "/#contact" },
|
||||
];
|
||||
|
||||
function ProductsPageContent() {
|
||||
const {
|
||||
products,
|
||||
isLoading,
|
||||
search,
|
||||
setSearch,
|
||||
filters,
|
||||
} = useProductCatalog({ basePath: "/products" });
|
||||
const { products, isLoading } = useProductCatalog({ basePath: "/products" });
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="hover-bubble"
|
||||
defaultTextAnimation="background-highlight"
|
||||
borderRadius="pill"
|
||||
contentWidth="mediumSmall"
|
||||
sizing="largeSmallSizeMediumTitles"
|
||||
background="circleGradient"
|
||||
cardStyle="solid"
|
||||
primaryButtonStyle="diagonal-gradient"
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Shop Now", href: "/products" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<div id="loading-section" data-section="loading-section">
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<p className="text-foreground">Loading products...</p>
|
||||
</main>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
const mappedProducts = products.map(p => ({
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
price: p.price,
|
||||
imageSrc: p.imageSrc,
|
||||
imageAlt: p.imageAlt || p.name,
|
||||
variant: p.category || 'Standard',
|
||||
}));
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
@@ -75,29 +40,33 @@ function ProductsPageContent() {
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Shop Now", href: "/products" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForSubPages}
|
||||
button={{ text: "Go to Shop", href: "/shop" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
{isLoading ? (
|
||||
<div className="w-full mx-auto py-40 text-center">
|
||||
<p className="text-foreground">Loading products...</p>
|
||||
</div>
|
||||
) : (
|
||||
<div id="product-catalog" data-section="product-catalog">
|
||||
<ProductCatalog
|
||||
layout="page"
|
||||
products={products}
|
||||
searchValue={search}
|
||||
onSearchChange={setSearch}
|
||||
searchPlaceholder="Search products..."
|
||||
filters={filters}
|
||||
emptyMessage="No products found"
|
||||
<ProductCardFour
|
||||
title="Our Products"
|
||||
description="Browse our hand-picked selection of high-quality cups."
|
||||
products={mappedProducts}
|
||||
gridVariant="four-items-2x2-equal-grid"
|
||||
animationType="slide-up"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground={false}
|
||||
/>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,88 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense, use, useCallback } from "react";
|
||||
import { Suspense, use } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ReactLenis from "lenis/react";
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
|
||||
import ProductDetailCard from "@/components/ecommerce/productDetail/ProductDetailCard";
|
||||
import ProductCart from "@/components/ecommerce/cart/ProductCart";
|
||||
import SplitAbout from '@/components/sections/about/SplitAbout';
|
||||
import { useProductDetail } from "@/hooks/useProductDetail";
|
||||
import { useCart } from "@/hooks/useCart";
|
||||
import { useCheckout } from "@/hooks/useCheckout";
|
||||
import { DollarSign, Package, CheckCircle } from 'lucide-react';
|
||||
|
||||
// Define common navigation items for sub-pages to maintain consistency
|
||||
const ALL_NAV_ITEMS_SUB_PAGES = [
|
||||
const navItemsForSubPages = [
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Products", id: "/products" },
|
||||
{ name: "Shop", id: "/shop" },
|
||||
{ name: "Blog", id: "/blog" },
|
||||
{ name: "About", id: "/#about" },
|
||||
{ name: "Testimonials", id: "/#testimonials" },
|
||||
{ name: "FAQs", id: "/#faqs" }
|
||||
{ name: "FAQs", id: "/#faqs" },
|
||||
{ name: "Contact", id: "/#contact" },
|
||||
];
|
||||
|
||||
interface ProductPageProps {
|
||||
params: Promise<{ id: string }>;
|
||||
}
|
||||
|
||||
export default function ProductPage({ params }: ProductPageProps) {
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<ProductPageContent params={params} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
function ProductPageContent({ params }: ProductPageProps) {
|
||||
const { id } = use(params);
|
||||
const router = useRouter();
|
||||
|
||||
const {
|
||||
product,
|
||||
isLoading,
|
||||
images,
|
||||
meta,
|
||||
variants,
|
||||
quantityVariant,
|
||||
selectedQuantity,
|
||||
createCartItem,
|
||||
} = useProductDetail(id);
|
||||
|
||||
const {
|
||||
items: cartItems,
|
||||
isOpen: cartOpen,
|
||||
setIsOpen: setCartOpen,
|
||||
addItem,
|
||||
updateQuantity,
|
||||
removeItem,
|
||||
total: cartTotal,
|
||||
getCheckoutItems,
|
||||
} = useCart();
|
||||
|
||||
const { buyNow, checkout, isLoading: isCheckoutLoading } = useCheckout();
|
||||
|
||||
const handleAddToCart = useCallback(() => {
|
||||
const item = createCartItem();
|
||||
if (item) {
|
||||
addItem(item);
|
||||
}
|
||||
}, [createCartItem, addItem]);
|
||||
|
||||
const handleBuyNow = useCallback(() => {
|
||||
if (product) {
|
||||
buyNow(product, selectedQuantity);
|
||||
}
|
||||
}, [product, selectedQuantity, buyNow]);
|
||||
|
||||
const handleCheckout = useCallback(async () => {
|
||||
if (cartItems.length === 0) return;
|
||||
|
||||
const currentUrl = new URL(window.location.href);
|
||||
currentUrl.searchParams.set("success", "true");
|
||||
|
||||
await checkout(getCheckoutItems(), { successUrl: currentUrl.toString() });
|
||||
}, [cartItems, checkout, getCheckoutItems]);
|
||||
const { product, isLoading, images, meta } = useProductDetail(id);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -98,23 +41,19 @@ function ProductPageContent({ params }: ProductPageProps) {
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<div id="loading-section" data-section="loading-section">
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<p className="text-foreground">Loading product...</p>
|
||||
</main>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForSubPages}
|
||||
button={{ text: "Back to Shop", href: "/shop" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<p className="text-foreground">Loading product...</p>
|
||||
</main>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
@@ -133,31 +72,27 @@ function ProductPageContent({ params }: ProductPageProps) {
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForSubPages}
|
||||
button={{ text: "Back to Shop", href: "/shop" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<div className="text-center">
|
||||
<p className="text-foreground mb-4">Product not found</p>
|
||||
<button
|
||||
onClick={() => router.push("/shop")}
|
||||
className="px-6 py-2 rounded-lg bg-primary text-primary-foreground"
|
||||
>
|
||||
Back to Shop
|
||||
</button>
|
||||
</div>
|
||||
<div id="not-found-section" data-section="not-found-section">
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<div className="text-center">
|
||||
<p className="text-foreground mb-4">Product not found</p>
|
||||
<button
|
||||
onClick={() => router.push("/shop")}
|
||||
className="primary-button px-6 py-2 rounded-theme text-primary-cta-text"
|
||||
>
|
||||
Back to Shop
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
</main>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
@@ -173,56 +108,47 @@ function ProductPageContent({ params }: ProductPageProps) {
|
||||
cardStyle="solid"
|
||||
primaryButtonStyle="diagonal-gradient"
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Cart", onClick: () => setCartOpen(true) }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<div id="product-detail-card" data-section="product-detail-card">
|
||||
<ProductDetailCard
|
||||
layout="page"
|
||||
name={product.name}
|
||||
price={product.price}
|
||||
salePrice={meta.salePrice}
|
||||
rating={product.rating || 0}
|
||||
description={product.description}
|
||||
images={images}
|
||||
variants={variants.length > 0 ? variants : undefined}
|
||||
quantity={quantityVariant}
|
||||
ribbon={meta.ribbon}
|
||||
inventoryStatus={meta.inventoryStatus}
|
||||
inventoryQuantity={meta.inventoryQuantity}
|
||||
sku={meta.sku}
|
||||
buttons={[
|
||||
{ text: "Add To Cart", onClick: handleAddToCart },
|
||||
{ text: "Buy Now", onClick: handleBuyNow },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div id="product-cart" data-section="product-cart">
|
||||
<ProductCart
|
||||
isOpen={cartOpen}
|
||||
onClose={() => setCartOpen(false)}
|
||||
items={cartItems}
|
||||
onQuantityChange={updateQuantity}
|
||||
onRemove={removeItem}
|
||||
total={`$${cartTotal}`}
|
||||
buttons={[
|
||||
{
|
||||
text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForSubPages}
|
||||
button={{ text: "Back to Shop", href: "/shop" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<div id="product-detail" data-section="product-detail">
|
||||
<SplitAbout
|
||||
title={product.name}
|
||||
description={product.description || 'No description available.'}
|
||||
imageSrc={images[0]?.src || '/placeholder.webp'}
|
||||
imageAlt={images[0]?.alt || product.name}
|
||||
textboxLayout="default"
|
||||
useInvertedBackground={false}
|
||||
mediaAnimation="opacity"
|
||||
bulletPoints={[
|
||||
{ title: "Price", description: product.price, icon: DollarSign },
|
||||
{ title: "SKU", description: meta.sku || 'N/A', icon: Package },
|
||||
{ title: "Status", description: meta.inventoryStatus || 'Available', icon: CheckCircle },
|
||||
]}
|
||||
buttons={[{ text: "Explore More Products", href: "/shop" }]}
|
||||
/>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ProductPage({ params }: ProductPageProps) {
|
||||
return (
|
||||
<Suspense fallback={
|
||||
<div className="w-full h-screen flex items-center justify-center bg-background text-foreground">
|
||||
Loading product details...
|
||||
</div>
|
||||
}>
|
||||
<ProductPageContent params={params} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,66 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense } from "react";
|
||||
import ReactLenis from "lenis/react";
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
|
||||
import ProductCatalog from "@/components/ecommerce/productCatalog/ProductCatalog";
|
||||
import ProductCardFour from '@/components/sections/product/ProductCardFour';
|
||||
import { useProductCatalog } from "@/hooks/useProductCatalog";
|
||||
|
||||
// Define common navigation items for sub-pages to maintain consistency
|
||||
const ALL_NAV_ITEMS_SUB_PAGES = [
|
||||
const navItemsForSubPages = [
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Products", id: "/products" },
|
||||
{ name: "Shop", id: "/shop" },
|
||||
{ name: "Blog", id: "/blog" },
|
||||
{ name: "About", id: "/#about" },
|
||||
{ name: "Testimonials", id: "/#testimonials" },
|
||||
{ name: "FAQs", id: "/#faqs" }
|
||||
{ name: "FAQs", id: "/#faqs" },
|
||||
{ name: "Contact", id: "/#contact" },
|
||||
];
|
||||
|
||||
function ShopPageContent() {
|
||||
const {
|
||||
products,
|
||||
isLoading,
|
||||
search,
|
||||
setSearch,
|
||||
filters,
|
||||
} = useProductCatalog({ basePath: "/shop" });
|
||||
const { products, isLoading } = useProductCatalog({ basePath: "/shop" });
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="hover-bubble"
|
||||
defaultTextAnimation="background-highlight"
|
||||
borderRadius="pill"
|
||||
contentWidth="mediumSmall"
|
||||
sizing="largeSmallSizeMediumTitles"
|
||||
background="circleGradient"
|
||||
cardStyle="solid"
|
||||
primaryButtonStyle="diagonal-gradient"
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Shop Now", href: "/products" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
<div id="loading-section" data-section="loading-section">
|
||||
<main className="min-h-screen flex items-center justify-center pt-20">
|
||||
<p className="text-foreground">Loading products...</p>
|
||||
</main>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
const mappedProducts = products.map(p => ({
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
price: p.price,
|
||||
imageSrc: p.imageSrc,
|
||||
imageAlt: p.imageAlt || p.name,
|
||||
variant: p.category || 'Standard',
|
||||
}));
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
@@ -75,29 +40,33 @@ function ShopPageContent() {
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={ALL_NAV_ITEMS_SUB_PAGES}
|
||||
button={{ text: "Shop Now", href: "/products" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarLayoutFloatingInline
|
||||
brandName="Nano Mango"
|
||||
navItems={navItemsForSubPages}
|
||||
button={{ text: "View Products", href: "/products" }}
|
||||
buttonClassName="shadow-lg"
|
||||
navItemClassName="text-foreground/80 hover:text-foreground"
|
||||
className="backdrop-blur-sm bg-card/70"
|
||||
/>
|
||||
</div>
|
||||
{isLoading ? (
|
||||
<div className="w-full mx-auto py-40 text-center">
|
||||
<p className="text-foreground">Loading products...</p>
|
||||
</div>
|
||||
) : (
|
||||
<div id="product-catalog" data-section="product-catalog">
|
||||
<ProductCatalog
|
||||
layout="page"
|
||||
products={products}
|
||||
searchValue={search}
|
||||
onSearchChange={setSearch}
|
||||
searchPlaceholder="Search products..."
|
||||
filters={filters}
|
||||
emptyMessage="No products found"
|
||||
<ProductCardFour
|
||||
title="Shop Our Collection"
|
||||
description="Find your perfect companion for coffee, tea, or any beverage."
|
||||
products={mappedProducts}
|
||||
gridVariant="four-items-2x2-equal-grid"
|
||||
animationType="slide-up"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground={false}
|
||||
/>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user