3 Commits

Author SHA1 Message Date
71ff05fda4 Update src/app/cartContext.tsx 2026-06-13 02:44:08 +00:00
f3cece7019 Update src/app/page.tsx 2026-06-13 02:40:44 +00:00
f783590844 Add src/app/cartContext.tsx 2026-06-13 02:40:43 +00:00
2 changed files with 150 additions and 208 deletions

86
src/app/cartContext.tsx Normal file
View File

@@ -0,0 +1,86 @@
"use client";
import React, { createContext, useContext, useState, useEffect } from "react";
interface CartItem {
id: string;
name: string;
price: number;
imageSrc: string;
quantity: number;
}
interface CartContextType {
cartItems: CartItem[];
addToCart: (product: { id: string; name: string; price: string; imageSrc: string; imageAlt?: string }) => void;
removeFromCart: (id: string) => void;
updateQuantity: (id: string, quantity: number) => void;
clearCart: () => void;
totalPrice: number;
}
const CartContext = createContext<CartContextType | undefined>(undefined);
export const CartProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const [cartItems, setCartItems] = useState<CartItem[]>(() => {
// Load cart from localStorage on initial render
if (typeof window !== "undefined") {
const storedCart = localStorage.getItem("shopwel_cart");
if (storedCart) {
return JSON.parse(storedCart);
}
}
return [];
});
useEffect(() => {
// Save cart to localStorage whenever it changes
if (typeof window !== "undefined") {
localStorage.setItem("shopwel_cart", JSON.stringify(cartItems));
}
}, [cartItems]);
const addToCart = (product: { id: string; name: string; price: string; imageSrc: string; imageAlt?: string }) => {
setCartItems((prevItems) => {
const itemExists = prevItems.find((item) => item.id === product.id);
if (itemExists) {
return prevItems.map((item) =>
item.id === product.id ? { ...item, quantity: item.quantity + 1 } : item
);
} else {
const priceValue = parseFloat(product.price.replace("₹", "").replace("/kg", "").replace("/L", ""));
return [...prevItems, { ...product, price: priceValue, quantity: 1 }];
}
});
};
const removeFromCart = (id: string) => {
setCartItems((prevItems) => prevItems.filter((item) => item.id !== id));
};
const updateQuantity = (id: string, quantity: number) => {
setCartItems((prevItems) =>
prevItems.map((item) => (item.id === id ? { ...item, quantity: Math.max(1, quantity) } : item))
);
};
const clearCart = () => {
setCartItems([]);
};
const totalPrice = cartItems.reduce((total, item) => total + item.price * item.quantity, 0);
return (
<CartContext.Provider value={{ cartItems, addToCart, removeFromCart, updateQuantity, clearCart, totalPrice }}>
{children}
</CartContext.Provider>
);
};
export const useCart = () => {
const context = useContext(CartContext);
if (context === undefined) {
throw new Error("useCart must be used within a CartProvider");
}
return context;
};

View File

@@ -14,6 +14,23 @@ import SocialProofOne from '@/components/sections/socialProof/SocialProofOne';
import TestimonialCardOne from '@/components/sections/testimonial/TestimonialCardOne'; import TestimonialCardOne from '@/components/sections/testimonial/TestimonialCardOne';
export default function LandingPage() { export default function LandingPage() {
const updatedNavItems = [
{
name: "Home", id: "#home"},
{
name: "About", id: "#about"},
{
name: "Products", id: "#products"},
{
name: "Orders", id: "/order-details"},
{
name: "Testimonials", id: "#testimonials"},
{
name: "FAQs", id: "#faqs"},
{
name: "Contact", id: "#contact"},
];
return ( return (
<ThemeProvider <ThemeProvider
defaultButtonVariant="text-stagger" defaultButtonVariant="text-stagger"
@@ -30,58 +47,26 @@ export default function LandingPage() {
<ReactLenis root> <ReactLenis root>
<div id="nav" data-section="nav"> <div id="nav" data-section="nav">
<NavbarLayoutFloatingOverlay <NavbarLayoutFloatingOverlay
navItems={[ navItems={updatedNavItems}
{
name: "Home",
id: "#home",
},
{
name: "About",
id: "#about",
},
{
name: "Products",
id: "#products",
},
{
name: "Testimonials",
id: "#testimonials",
},
{
name: "FAQs",
id: "#faqs",
},
{
name: "Contact",
id: "#contact",
},
]}
logoSrc="http://img.b2bpic.net/free-vector/green-supermarket-corporate-identity-logo-template_23-2148453180.jpg" logoSrc="http://img.b2bpic.net/free-vector/green-supermarket-corporate-identity-logo-template_23-2148453180.jpg"
logoAlt="Shopwel Mart Logo" logoAlt="Shopwel Mart Logo"
brandName="Shopwel Mart" brandName="Shopwel Mart"
button={{ button={{
text: "Shop Now", text: "Shop Now", href: "#products"}}
href: "#products",
}}
/> />
</div> </div>
<div id="home" data-section="home"> <div id="home" data-section="home">
<HeroLogoBillboard <HeroLogoBillboard
background={{ background={{
variant: "radial-gradient", variant: "radial-gradient"}}
}}
logoText="Shopwel Mart" logoText="Shopwel Mart"
description="Your daily destination for fresh groceries, household essentials, and more. Quality and convenience at the heart of Bengaluru." description="Your daily destination for fresh groceries, household essentials, and more. Quality and convenience at the heart of Bengaluru."
buttons={[ buttons={[
{ {
text: "Shop Now", text: "Shop Now", href: "#products"},
href: "#products",
},
{ {
text: "Our Location", text: "Our Location", href: "#contact"},
href: "#contact",
},
]} ]}
imageSrc="http://img.b2bpic.net/free-photo/young-couple-choosing-goods-supermarket_23-2148150039.jpg" imageSrc="http://img.b2bpic.net/free-photo/young-couple-choosing-goods-supermarket_23-2148150039.jpg"
imageAlt="Interior of a bustling grocery store with fresh produce" imageAlt="Interior of a bustling grocery store with fresh produce"
@@ -106,29 +91,13 @@ export default function LandingPage() {
useInvertedBackground={true} useInvertedBackground={true}
features={[ features={[
{ {
title: "Fresh Produce Daily", title: "Fresh Produce Daily", description: "Locally sourced fruits and vegetables, delivered fresh every morning for unparalleled quality.", imageSrc: "http://img.b2bpic.net/free-photo/abundance-fresh-healthy-fruits-market-generated-by-ai_188544-24226.jpg", imageAlt: "Basket of fresh fruits and vegetables"},
description: "Locally sourced fruits and vegetables, delivered fresh every morning for unparalleled quality.",
imageSrc: "http://img.b2bpic.net/free-photo/abundance-fresh-healthy-fruits-market-generated-by-ai_188544-24226.jpg",
imageAlt: "Basket of fresh fruits and vegetables",
},
{ {
title: "Wide Selection", title: "Wide Selection", description: "Discover a diverse range of products from daily essentials to gourmet treats and international items.", imageSrc: "http://img.b2bpic.net/free-photo/abstract-blur-supermarket-department-store_74190-5230.jpg", imageAlt: "Well-stocked grocery store aisles"},
description: "Discover a diverse range of products from daily essentials to gourmet treats and international items.",
imageSrc: "http://img.b2bpic.net/free-photo/abstract-blur-supermarket-department-store_74190-5230.jpg",
imageAlt: "Well-stocked grocery store aisles",
},
{ {
title: "Convenient Location", title: "Convenient Location", description: "Easily accessible at Shanti Kunj, Vasanth Nagar, with ample parking and friendly neighborhood vibe.", imageSrc: "http://img.b2bpic.net/free-photo/smiling-young-female-window-shopping_23-2147968448.jpg", imageAlt: "Exterior of Shopwel Mart in Bengaluru"},
description: "Easily accessible at Shanti Kunj, Vasanth Nagar, with ample parking and friendly neighborhood vibe.",
imageSrc: "http://img.b2bpic.net/free-photo/smiling-young-female-window-shopping_23-2147968448.jpg",
imageAlt: "Exterior of Shopwel Mart in Bengaluru",
},
{ {
title: "Friendly Service", title: "Friendly Service", description: "Our dedicated staff is always ready to assist you with a smile, ensuring a pleasant shopping trip.", imageSrc: "http://img.b2bpic.net/free-photo/young-attractive-girls-electronics-store-use-laptop-exhibition_78826-3428.jpg", imageAlt: "Shopwel Mart staff assisting a customer"},
description: "Our dedicated staff is always ready to assist you with a smile, ensuring a pleasant shopping trip.",
imageSrc: "http://img.b2bpic.net/free-photo/young-attractive-girls-electronics-store-use-laptop-exhibition_78826-3428.jpg",
imageAlt: "Shopwel Mart staff assisting a customer",
},
]} ]}
title="Why Shop at Shopwel Mart?" title="Why Shop at Shopwel Mart?"
description="Experience the difference with our commitment to quality, variety, and customer satisfaction." description="Experience the difference with our commitment to quality, variety, and customer satisfaction."
@@ -143,53 +112,17 @@ export default function LandingPage() {
useInvertedBackground={false} useInvertedBackground={false}
products={[ products={[
{ {
id: "p1", id: "p1", name: "Organic Carrots", price: "₹60/kg", variant: "Fresh Produce", imageSrc: "http://img.b2bpic.net/free-photo/side-view-bowls-basket-vegetables-as-radish-onion-garlic-cloth-surface_141793-5664.jpg", imageAlt: "Fresh organic carrots"},
name: "Organic Carrots",
price: "₹60/kg",
variant: "Fresh Produce",
imageSrc: "http://img.b2bpic.net/free-photo/side-view-bowls-basket-vegetables-as-radish-onion-garlic-cloth-surface_141793-5664.jpg",
imageAlt: "Fresh organic carrots",
},
{ {
id: "p2", id: "p2", name: "Artisan Sourdough", price: "₹150", variant: "Baked Goods", imageSrc: "http://img.b2bpic.net/free-photo/top-view-shot-cinnamon-rolls-tray-isolated-white-background_181624-57332.jpg", imageAlt: "Artisan sourdough bread"},
name: "Artisan Sourdough",
price: "₹150",
variant: "Baked Goods",
imageSrc: "http://img.b2bpic.net/free-photo/top-view-shot-cinnamon-rolls-tray-isolated-white-background_181624-57332.jpg",
imageAlt: "Artisan sourdough bread",
},
{ {
id: "p3", id: "p3", name: "Premium Olive Oil", price: "₹499", variant: "Gourmet Selection", imageSrc: "http://img.b2bpic.net/free-photo/bread-olive-oil-with-salt-tray_23-2147853944.jpg", imageAlt: "Bottle of premium olive oil"},
name: "Premium Olive Oil",
price: "₹499",
variant: "Gourmet Selection",
imageSrc: "http://img.b2bpic.net/free-photo/bread-olive-oil-with-salt-tray_23-2147853944.jpg",
imageAlt: "Bottle of premium olive oil",
},
{ {
id: "p4", id: "p4", name: "Farm Fresh Milk", price: "₹45/L", variant: "Dairy Products", imageSrc: "http://img.b2bpic.net/free-photo/close-up-man-with-bottle-goats-milk_23-2148673055.jpg", imageAlt: "Carton of fresh milk"},
name: "Farm Fresh Milk",
price: "₹45/L",
variant: "Dairy Products",
imageSrc: "http://img.b2bpic.net/free-photo/close-up-man-with-bottle-goats-milk_23-2148673055.jpg",
imageAlt: "Carton of fresh milk",
},
{ {
id: "p5", id: "p5", name: "Seasonal Fruit Basket", price: "₹399", variant: "Fresh Produce", imageSrc: "http://img.b2bpic.net/free-photo/bunch-various-vegetables-out-wooden-basket_114579-56243.jpg", imageAlt: "Basket of assorted seasonal fruits"},
name: "Seasonal Fruit Basket",
price: "₹399",
variant: "Fresh Produce",
imageSrc: "http://img.b2bpic.net/free-photo/bunch-various-vegetables-out-wooden-basket_114579-56243.jpg",
imageAlt: "Basket of assorted seasonal fruits",
},
{ {
id: "p6", id: "p6", name: "Ethiopian Coffee Beans", price: "₹650", variant: "Beverages", imageSrc: "http://img.b2bpic.net/free-photo/sackcloth-full-coffee-beans-coffee-beans-surface_176474-495.jpg", imageAlt: "Bag of Ethiopian coffee beans"},
name: "Ethiopian Coffee Beans",
price: "₹650",
variant: "Beverages",
imageSrc: "http://img.b2bpic.net/free-photo/sackcloth-full-coffee-beans-coffee-beans-surface_176474-495.jpg",
imageAlt: "Bag of Ethiopian coffee beans",
},
]} ]}
title="Our Bestsellers & New Arrivals" title="Our Bestsellers & New Arrivals"
description="Explore popular items and exciting new additions to our shelves, carefully curated for you." description="Explore popular items and exciting new additions to our shelves, carefully curated for you."
@@ -204,50 +137,20 @@ export default function LandingPage() {
useInvertedBackground={true} useInvertedBackground={true}
testimonials={[ testimonials={[
{ {
id: "t1", id: "t1", name: "Priya Sharma", role: "Local Resident", company: "Bengaluru", rating: 5,
name: "Priya Sharma", imageSrc: "http://img.b2bpic.net/free-photo/young-woman-with-fruit-her-hands-supermarket_169016-5033.jpg", imageAlt: "Priya Sharma"},
role: "Local Resident",
company: "Bengaluru",
rating: 5,
imageSrc: "http://img.b2bpic.net/free-photo/young-woman-with-fruit-her-hands-supermarket_169016-5033.jpg",
imageAlt: "Priya Sharma",
},
{ {
id: "t2", id: "t2", name: "Rahul Singh", role: "IT Professional", company: "Vasanth Nagar", rating: 5,
name: "Rahul Singh", imageSrc: "http://img.b2bpic.net/free-photo/businessman-dress-code-makes-thumb-up_114579-15932.jpg", imageAlt: "Rahul Singh"},
role: "IT Professional",
company: "Vasanth Nagar",
rating: 5,
imageSrc: "http://img.b2bpic.net/free-photo/businessman-dress-code-makes-thumb-up_114579-15932.jpg",
imageAlt: "Rahul Singh",
},
{ {
id: "t3", id: "t3", name: "Anjali Mehta", role: "Homemaker", company: "Shanti Kunj", rating: 5,
name: "Anjali Mehta", imageSrc: "http://img.b2bpic.net/free-photo/pleasure-shopping_1098-2357.jpg", imageAlt: "Anjali Mehta"},
role: "Homemaker",
company: "Shanti Kunj",
rating: 5,
imageSrc: "http://img.b2bpic.net/free-photo/pleasure-shopping_1098-2357.jpg",
imageAlt: "Anjali Mehta",
},
{ {
id: "t4", id: "t4", name: "The Kumar Family", role: "Customers", company: "Bengaluru", rating: 5,
name: "The Kumar Family", imageSrc: "http://img.b2bpic.net/free-photo/beautiful-young-women-checking-shopping-bags_23-2148385650.jpg", imageAlt: "The Kumar Family"},
role: "Customers",
company: "Bengaluru",
rating: 5,
imageSrc: "http://img.b2bpic.net/free-photo/beautiful-young-women-checking-shopping-bags_23-2148385650.jpg",
imageAlt: "The Kumar Family",
},
{ {
id: "t5", id: "t5", name: "Dr. R. Gopal", role: "Retired Professor", company: "Vasanth Nagar", rating: 5,
name: "Dr. R. Gopal", imageSrc: "http://img.b2bpic.net/free-photo/close-up-young-man-food-market_23-2149082594.jpg", imageAlt: "Dr. R. Gopal"},
role: "Retired Professor",
company: "Vasanth Nagar",
rating: 5,
imageSrc: "http://img.b2bpic.net/free-photo/close-up-young-man-food-market_23-2149082594.jpg",
imageAlt: "Dr. R. Gopal",
},
]} ]}
title="What Our Customers Say" title="What Our Customers Say"
description="Hear directly from our happy shoppers who love the Shopwel Mart experience and keep coming back." description="Hear directly from our happy shoppers who love the Shopwel Mart experience and keep coming back."
@@ -259,14 +162,7 @@ export default function LandingPage() {
textboxLayout="default" textboxLayout="default"
useInvertedBackground={false} useInvertedBackground={false}
names={[ names={[
"Farm Fresh Organics", "Farm Fresh Organics", "Daily Bakes", "Pure Dairy Co.", "Home Essentials", "Nutri Foods", "Aroma Coffee", "Green Earth Products"]}
"Daily Bakes",
"Pure Dairy Co.",
"Home Essentials",
"Nutri Foods",
"Aroma Coffee",
"Green Earth Products",
]}
title="Our Valued Partners" title="Our Valued Partners"
description="Proudly working with leading local and national brands to bring you the best quality products for your daily needs." description="Proudly working with leading local and national brands to bring you the best quality products for your daily needs."
/> />
@@ -278,25 +174,13 @@ export default function LandingPage() {
useInvertedBackground={true} useInvertedBackground={true}
faqs={[ faqs={[
{ {
id: "faq1", id: "faq1", title: "What are your operating hours?", content: "Shopwel Mart is open from 8:00 AM to 9:00 PM, Monday through Sunday, for your convenience."},
title: "What are your operating hours?",
content: "Shopwel Mart is open from 8:00 AM to 9:00 PM, Monday through Sunday, for your convenience.",
},
{ {
id: "faq2", id: "faq2", title: "Do you offer home delivery?", content: "Currently, we do not offer home delivery, but we are working on introducing this service soon. Please visit our store for your shopping needs."},
title: "Do you offer home delivery?",
content: "Currently, we do not offer home delivery, but we are working on introducing this service soon. Please visit our store for your shopping needs.",
},
{ {
id: "faq3", id: "faq3", title: "What is your return policy?", content: "We accept returns of unused and unopened items within 7 days of purchase, with a valid receipt. Fresh produce returns must be made within 24 hours."},
title: "What is your return policy?",
content: "We accept returns of unused and unopened items within 7 days of purchase, with a valid receipt. Fresh produce returns must be made within 24 hours.",
},
{ {
id: "faq4", id: "faq4", title: "Are there any special discounts for bulk purchases?", content: "Yes, we offer special discounts for bulk purchases on select items. Please speak to our store manager for more details on available offers."},
title: "Are there any special discounts for bulk purchases?",
content: "Yes, we offer special discounts for bulk purchases on select items. Please speak to our store manager for more details on available offers.",
},
]} ]}
title="Frequently Asked Questions" title="Frequently Asked Questions"
description="Find quick answers to common questions about shopping at Shopwel Mart, from our operating hours to return policies." description="Find quick answers to common questions about shopping at Shopwel Mart, from our operating hours to return policies."
@@ -308,14 +192,11 @@ export default function LandingPage() {
<ContactText <ContactText
useInvertedBackground={false} useInvertedBackground={false}
background={{ background={{
variant: "radial-gradient", variant: "radial-gradient"}}
}}
text="Visit Us Today at Shopwel Mart! Experience quality and convenience at our prime location in Bengaluru: Shanti Kunj, 75/1, Abshot Layout, Vasanth Nagar, Bengaluru, Karnataka 560001. We look forward to serving you!" text="Visit Us Today at Shopwel Mart! Experience quality and convenience at our prime location in Bengaluru: Shanti Kunj, 75/1, Abshot Layout, Vasanth Nagar, Bengaluru, Karnataka 560001. We look forward to serving you!"
buttons={[ buttons={[
{ {
text: "Get Directions", text: "Get Directions", href: "https://maps.app.goo.gl/YourGoogleMapsLinkHere"},
href: "https://maps.app.goo.gl/YourGoogleMapsLinkHere",
},
]} ]}
/> />
</div> </div>
@@ -325,62 +206,37 @@ export default function LandingPage() {
logoText="Shopwel Mart" logoText="Shopwel Mart"
columns={[ columns={[
{ {
title: "Categories", title: "Categories", items: [
items: [
{ {
label: "Fresh Produce", label: "Fresh Produce", href: "#products"},
href: "#products",
},
{ {
label: "Groceries", label: "Groceries", href: "#products"},
href: "#products",
},
{ {
label: "Household", label: "Household", href: "#products"},
href: "#products",
},
{ {
label: "Dairy & Bakery", label: "Dairy & Bakery", href: "#products"},
href: "#products",
},
], ],
}, },
{ {
title: "About Us", title: "About Us", items: [
items: [
{ {
label: "Our Story", label: "Our Story", href: "#about"},
href: "#about",
},
{ {
label: "Why Shopwel", label: "Why Shopwel", href: "#features"},
href: "#features",
},
{ {
label: "Customer Reviews", label: "Customer Reviews", href: "#testimonials"},
href: "#testimonials",
},
], ],
}, },
{ {
title: "Connect", title: "Connect", items: [
items: [
{ {
label: "Location", label: "Location", href: "#contact"},
href: "#contact",
},
{ {
label: "FAQs", label: "FAQs", href: "#faqs"},
href: "#faqs",
},
{ {
label: "Privacy Policy", label: "Privacy Policy", href: "#"},
href: "#",
},
{ {
label: "Terms of Service", label: "Terms of Service", href: "#"},
href: "#",
},
], ],
}, },
]} ]}