const { useState, useEffect, useMemo } = React;
const PRODUCTS = [
{ id: 1, name: "Royal Gold Reserve", desc: "100% Arabica, honey & dark chocolate notes", price: 495, image: "https://images.unsplash.com/photo-1559056199-641a0ac8b55e?w=500", category: "Arabica", roast: "Medium Roast", notes: "Chocolate, Caramel, Citrus", inStock: true },
{ id: 2, name: "Shimogga Select", desc: "Robusta blend, bold & intense filter roast", price: 380, image: "https://images.unsplash.com/photo-1587735243612-9de9e2a5ef2e?w=500", category: "Robusta", roast: "Dark Roast", notes: "Earthy, Woody, Spicy", inStock: true },
{ id: 3, name: "Monsoon Malabar", desc: "Aged monsooned beans, smooth & earthy", price: 590, image: "https://images.unsplash.com/photo-1514432324607-a09d9b4aefdd?w=500", category: "Robusta", roast: "Medium Dark", notes: "Mellow, Low Acid, Nutty", inStock: true },
{ id: 4, name: "Filter Kaapi Classic", desc: "Authentic blend with chicory, steel filter special", price: 330, image: "https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?w=500", category: "Filter", roast: "Dark Roast", notes: "Strong, Aromatic, Traditional", inStock: true },
{ id: 5, name: "Espresso Noir", desc: "Dark roast, crema-rich velvety finish", price: 620, image: "https://images.unsplash.com/photo-1541167760496-1628856ab772?w=500", category: "Arabica", roast: "Extra Dark", notes: "Intense, Bitter-sweet, Cocoa", inStock: true },
{ id: 6, name: "Organic Plantation", desc: "Certified organic shade-grown, floral & bright", price: 540, image: "https://images.unsplash.com/photo-1461023058943-07fcbe16d735?w=500", category: "Arabica", roast: "Light Roast", notes: "Floral, Fruity, Bright Acidity", inStock: true }
];
const QUOTES = ["Coffee is the closest thing to magic in a cup.","Every cup tells a story worth savoring.","Great coffee isn't made. It's crafted.","Some mornings deserve extraordinary coffee.","Elegance begins with the first sip.","Behind every remarkable day is a remarkable coffee.","Coffee is a ritual, not a routine.","Luxury is measured one sip at a time.","Where passion meets perfection in every cup.","A timeless tradition, brewed to perfection. \u2615"];
const SLIDES = [
{ title: "Six Decades of Trust", subtitle: "Estate grown Arabica & Rich Filter Blends from Malnad", image: "https://images.unsplash.com/photo-1461023058943-07fcbe16d735?w=1400&auto=format" },
{ title: "Royal Coffee Experience", subtitle: "Your daily ritual, perfected since 1989", image: "https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?w=1400&auto=format" },
{ title: "From Malnad with Love", subtitle: "Pure coffee, no additives \u2014 just emotion in every sip", image: "https://images.unsplash.com/photo-1514432324607-a09d9b4aefdd?w=1400&auto=format" }
];
const BLOG_POSTS = [
{ title: "The Malnad Morning Ritual", date: "A Royal Story", excerpt: "Misty mornings, charcoal fire, and the first filter kaapi. How Malnad taught us that coffee is not a drink, it is a beginning.", tag: "Heritage" },
{ title: "Why Charcoal Roasting Still Matters", date: "A Royal Story", excerpt: "No modern machine can replace patience. Slow roasting over charcoal is how Royal Coffee kept its aroma unchanged since 1961.", tag: "Craft" },
{ title: "Filter Kaapi, The Right Way", date: "A Royal Story", excerpt: "Steel filter, right grind, hot milk and patience. A simple guide to making Filter Kaapi Classic taste like home.", tag: "Brewing" }
];
function showAlert(title, text, icon){ if(window.Swal){ window.Swal.fire({icon: icon||"success", title:title, text:text, background:"#1e1610", color:"#eedbc8", timer:1800, showConfirmButton:false}); } else { alert(title+" - "+text); } }
function Header(props){
const [menuOpen, setMenuOpen] = useState(false);
const closeMenu = ()=> setMenuOpen(false);
const go = (e,id)=>{ e.preventDefault(); closeMenu(); if(props.onNavClick) props.onNavClick(id); else { const el=document.getElementById(id); if(el) el.scrollIntoView({behavior:"smooth"}); } };
return ({e.target.style.display="none"}} />
ROYAL COFFEE MANUFACTURERS · EST. 1961 setMenuOpen(!menuOpen)}> Cart {props.cartCount} );
}
function Hero(){
const [idx, setIdx] = useState(0); const [paused, setPaused] = useState(false);
useEffect(()=>{ if(paused) return; const t=setInterval(()=> setIdx(p=>(p+1)%SLIDES.length),4800); return ()=>clearInterval(t); }, [paused]);
const slide = SLIDES[idx];
const onKey = (e)=>{ if(e.key==="ArrowRight") setIdx((idx+1)%SLIDES.length); if(e.key==="ArrowLeft") setIdx((idx-1+SLIDES.length)%SLIDES.length); };
return (
☕ ☕ onMouseEnter={()=>setPaused(true)} onMouseLeave={()=>setPaused(false)} onKeyDown={onKey}>{slide.title}
{slide.subtitle}
setIdx((idx-1+SLIDES.length)%SLIDES.length)}> setIdx((idx+1)%SLIDES.length)}> {SLIDES.map((s,i)=>(setIdx(i)}> ))}
);
}
function QuotesSlider(){
const [currentIndex, setCurrentIndex] = useState(0); const [isVisible, setIsVisible] = useState(true);
useEffect(()=>{ const interval=setInterval(()=>{ setIsVisible(false); setTimeout(()=>{ setCurrentIndex(p=>(p+1)%QUOTES.length); setIsVisible(true); },500); },8000); return ()=>clearInterval(interval); }, []);
return (
);
}
function AboutSection(){
return (Since 1961 Royal Coffee ManufacturersOne Cup of Coffee... Six Decades of Trust!
Coffee is not just a beverage; it is morning freshness, daily enthusiasm, and a beautiful part of life. Formed in 1961 from the visionary dream of Mr. Y.S. Subrahmanya Jois , Royal Coffee Manufacturers has grown to be more than just a name — it has become an icon of uncompromising quality.
The Malnad Connection The warmth and invigoration provided by a hot cup of Royal Coffee on the misty mornings of Malnad were unparalleled. That early purity and dedication laid the foundation for today's proud legacy. Generations have passed, but the commitment to quality remains absolutely unshaken.
The Aroma of Charcoal Roasting Behind every grand enterprise lies a humble beginning rooted in dedication. The journey of Royal Coffee began by meticulously roasting coffee beans over a charcoal fire. In an era without modern machinery, the manual process of roasting and perfecting the beans was an art form in itself. The rich aroma born from that fire directly reached the renowned hotels of the Malnad region.
From Pounds to Kilograms In its early days, our coffee supply was measured merely in pounds, but today it has expanded to thousands of kilograms. This growth represents far more than business expansion — it is a profound testament to the immense trust our customers have placed in the brand.
For a brand to thrive in the market for more than 60 years and consistently retain customer admiration is no ordinary feat. Technologies have evolved, and production methods have been modernized, yet the original taste and core values of 1961 have remained completely unchanged. With every single sip, our customers are guaranteed to experience that pure, authentic taste and the comforting warmth of a rich heritage.
Delivering Trust, Not Just Coffee Royal Coffee, Real Coffee Royal Coffee Manufacturers does not merely supply coffee powder. We take immense pride in delivering faith, satisfaction, and trust to every home, thoughtfully packed into every single pouch.
Royal Coffee Manufacturers
Since 1961 – A Fragrant Journey of Trust.
From 1961 to Today – A Legacy of Aroma, Quality, and Trust.
);
}
function ProductModal({ product, onClose, onAdd }){
const [qty, setQty] = useState(1);
useEffect(()=>{ setQty(1); }, [product && product.id]);
if(!product) return null;
return (e.stopPropagation()}>
✕ {product.name} {product.desc}
Roast: {product.roast} · Notes: {product.notes}
₹{product.price} / 500g pack
setQty(q=>Math.max(1,q-1))}>− Qty: {qty} setQty(q=>Math.min(10,q+1))}>+
{ onAdd(product, qty); onClose(); }}>Add {qty} to Cart · ₹{product.price*qty} Close
);
}
function ProductList({ products, addToCart, cart, updateQuantity }){
const [filter, setFilter] = useState("All"); const [search, setSearch] = useState(""); const [selected, setSelected] = useState(null); const [loading, setLoading] = useState(true);
useEffect(()=>{ const t=setTimeout(()=>setLoading(false),350); return ()=>clearTimeout(t); }, []);
const cats = ["All","Arabica","Robusta","Filter"];
const filtered = useMemo(()=>{ return products.filter(p => (filter==="All" || p.category===filter) && (p.name.toLowerCase().includes(search.toLowerCase()) || p.desc.toLowerCase().includes(search.toLowerCase()))); }, [filter, search, products]);
return (Our Coffees Pure coffee, no additives — estate grown, charcoal roasted, packed with trust.
{cats.map(c=>(setFilter(c)}>{c} ))} setSearch(e.target.value)} />
{loading ? (
) : filtered.length===0 ? (
No coffee found Try another search or filter. All 6 Royal coffees are listed under All.
{setSearch(""); setFilter("All");}}>Show all coffees ) : (
{filtered.map(p=>(
{p.trending && (Bestseller )} setSelected(p)} style={{cursor:"pointer"}} />{p.category} · {p.roast}
{p.name} {p.desc}
Notes: {p.notes}
{p.originalPrice && p.originalPrice > p.price ? (<>₹{p.originalPrice} ₹{p.price}>) : ("₹"+p.price)} {p.inStock ? "In Stock" : "Out of Stock"}
Shivamogga Same-Day • Courier Extra
{(()=>{ const inCart = cart && cart.find(i=>i.id===p.id); if(!p.inStock) return (
Out of Stock ); return inCart ? (
updateQuantity(p.id,-1)} style={{background:"transparent",border:"none",fontWeight:"800",fontSize:"16px",cursor:"pointer"}}>- {inCart.quantity} updateQuantity(p.id,1)} style={{background:"transparent",border:"none",fontWeight:"800",fontSize:"16px",cursor:"pointer"}}>+
) : (
addToCart(p)}>Add to Cart ); })()}
setSelected(p)}>Details ))}
)}
setSelected(null)} onAdd={addToCart} /> );
}
function BlogSection(){ return (Stories From Malnad with love — stories behind every sip.
{BLOG_POSTS.map((b,i)=>(
{b.tag} · {b.date} {b.title} {b.excerpt}
))}
); }
function ContactSection(){
const [form, setForm] = useState({ name:"", phone:"", message:"" }); const [sent, setSent] = useState(false);
const submit = (e)=>{ e.preventDefault(); if(!form.name || !form.phone || !form.message){ showAlert("Missing details","Please fill name, phone and message.","warning"); return; } const orders=JSON.parse(localStorage.getItem("royal_enquiries")||"[]"); orders.push({...form, at:new Date().toISOString()}); localStorage.setItem("royal_enquiries", JSON.stringify(orders)); if(window.postToSheet){ window.postToSheet({type:"enquiry", name:form.name, phone:form.phone, message:form.message, source:"website"}); } setSent(true); const waMsg = encodeURIComponent("Hello Royal Coffee, New Enquiry:\nName: " + form.name + "\nPhone: " + form.phone + "\nMessage: " + form.message); window.open("https://wa.me/919449508060?text=" + waMsg, "_blank"); setForm({name:"",phone:"",message:""}); showAlert("Message received","Thank you, "+form.name+". WhatsApp opened, enquiry also saved."); };
return ();
}
function Footer(){ return (); }
function CartSidebar({ isOpen, onClose, cart, updateQuantity, removeItem, customer, onCheckout }){
if(!isOpen) return null;
const total = cart.reduce((s,i)=> s + i.price*i.quantity, 0);
return (e.stopPropagation()}>
Your Cart ✕ {cart.length===0 ? (☕
Your cart is empty Add Royal Gold Reserve or Filter Kaapi Classic to get started.
{onClose(); const el=document.getElementById("products"); if(el) el.scrollIntoView({behavior:"smooth"});}}>Browse Coffees ) : (<>{cart.map(item=>(
{item.name} ₹{item.price} each
updateQuantity(item.id,-1)}>− {item.quantity} updateQuantity(item.id,1)}>+ removeItem(item.id)}>Remove
))}
Total ₹{total}
{customer.name ? ("Deliver to: "+customer.name+" · "+customer.phone) : "Please sign in with name, phone and address before checkout."}
Checkout · ₹{total} >)} );
}
function LoginModal({ isOpen, onClose, onSave, customer }){
const [form, setForm] = useState(customer);
useEffect(()=>{ setForm(customer); }, [customer, isOpen]);
if(!isOpen) return null;
const save = (e)=>{ e.preventDefault(); if(!form.name || !form.phone){ showAlert("Missing details","Please enter name and phone.","warning"); return; } onSave(form); onClose(); showAlert("Welcome, "+form.name,"Your details are saved for faster checkout."); };
return (e.stopPropagation()}>
Sign In ✕ Save your name, phone and address for faster checkout.
Full Name setForm({...form,name:e.target.value})} placeholder="e.g. Nagaraj Vaidya" />
Phone setForm({...form,phone:e.target.value})} placeholder="10-digit mobile" inputMode="tel" />
Delivery Address setForm({...form,address:e.target.value})} placeholder="House, street, Shivamogga">
Save & Continue );
}
function AdminLogin({ isOpen, onClose, onLoginSuccess }){
const [email, setEmail] = useState(""); const [pass, setPass] = useState(""); const [error, setError] = useState("");
if(!isOpen) return null;
const login = (e)=>{ e.preventDefault(); if(email.trim() && pass.trim()){ localStorage.setItem("royal_admin","1"); localStorage.setItem("royal_admin_email", email); onLoginSuccess(); showAlert("Admin logged in","Welcome to Royal Coffee Admin."); } else { setError("Please enter admin email and password."); } };
return (e.stopPropagation()}>
Admin Login ✕ Royal Coffee Admin Dashboard
{error &&
{error}
}
Admin Email setEmail(e.target.value)} placeholder="admin@royalcoffee.in" />
Password setPass(e.target.value)} placeholder="Password" />
Login to Dashboard v2 note: replace this check with original adminAuth.js credentials when you paste that file.
);
}
function AnalyticsDashboard({ onLogout, onBack }){
const orders = JSON.parse(localStorage.getItem("royal_orders") || "[]"); const enquiries = JSON.parse(localStorage.getItem("royal_enquiries") || "[]"); const revenue = orders.reduce((s,o)=> s + (o.total||0), 0);
return (Admin Dashboard Back to Site Logout
Total Orders (this browser)
{orders.length} Revenue (this browser)
₹{revenue} Enquiries
{enquiries.length} Products {PRODUCTS.map(p=>(
{p.name} ₹{p.price} · {p.category} · {p.roast}
))}
Recent Orders {orders.length===0 ? (No orders yet in this browser. Orders are saved in localStorage. Connect Google Sheets / Firebase in next step to see live orders.
) : (Date Customer Items Total {orders.map((o,i)=>({new Date(o.at).toLocaleString()} {o.customer?.name} · {o.customer?.phone} {o.items.map(x=> x.name + " x" + x.quantity).join(", ")} ₹{o.total} ))}
)}Note: v2 dashboard shows local orders. Firebase / Google Sheets wiring is next step - paste firebase.js + googleSheetsService.js + adminAuth.js and we will wire same CDN method.
);
}
function App(){
const [cart, setCart] = useState([]); const [customer, setCustomer] = useState({ name:"", phone:"", address:"" }); const [isCartOpen, setIsCartOpen] = useState(false); const [isLoginOpen, setIsLoginOpen] = useState(false); const [showAdminLogin, setShowAdminLogin] = useState(false); const [showDashboard, setShowDashboard] = useState(false); const [isAdmin, setIsAdmin] = useState(false); const [sheetProducts, setSheetProducts] = useState(null);
useEffect(()=>{ try{ const sc=localStorage.getItem("royalCoffeeCart"); if(sc){ const parsed=JSON.parse(sc); const fixed=parsed.map(i=>({...i, quantity: Math.min(20, Math.max(1, i.quantity||1))})); setCart(fixed); localStorage.setItem("royalCoffeeCart", JSON.stringify(fixed)); } }catch(e){} try{ const cu=localStorage.getItem("royal_customer"); if(cu) setCustomer(JSON.parse(cu)); }catch(e){} setIsAdmin(localStorage.getItem("royal_admin")==="1"); setShowDashboard(false); }, []);
useEffect(()=>{ if(window.fetchSheetProducts){ window.fetchSheetProducts().then(list=>{ if(list && list.length) setSheetProducts(list); }); } }, []);
const saveCart = (nc)=>{ setCart(nc); localStorage.setItem("royalCoffeeCart", JSON.stringify(nc)); };
const saveCustomer = (c)=>{ setCustomer(c); localStorage.setItem("royal_customer", JSON.stringify(c)); if(window.postToSheet){ window.postToSheet({type:"customer", name:c.name||"", phone:c.phone||"", address:c.address||""}); } };
const addToCart = (product, qtyToAdd)=>{ const q = Math.min(Math.max(1, qtyToAdd||1), 10); const ex=cart.find(i=>i.id===product.id); if(ex){ const newQty = Math.min(ex.quantity+q, 20); saveCart(cart.map(i=> i.id===product.id ? {...i, quantity:newQty} : i)); } else saveCart([...cart, {...product, quantity:q}]); setIsCartOpen(true); };
const updateQuantity = (id, delta)=>{ const u=cart.map(i=>{ if(i.id===id){ const n=Math.min(20, i.quantity+delta); return n>0 ? {...i, quantity:n} : null; } return i; }).filter(Boolean); saveCart(u); };
const removeItem = (id)=> saveCart(cart.filter(i=>i.id!==id));
useEffect(()=>{ const h=(e)=> addToCart(e.detail); window.addEventListener("addToCartFromModal", h); return ()=> window.removeEventListener("addToCartFromModal", h); }, [cart]);
const cartCount = cart.reduce((a,i)=>a+i.quantity,0);
const handleAdminClick = ()=>{ if(isAdmin) setShowDashboard(true); else setShowAdminLogin(true); };
const handleAdminLoginSuccess = ()=>{ setIsAdmin(true); setShowAdminLogin(false); setShowDashboard(true); };
const handleAdminLogout = ()=>{ localStorage.removeItem("royal_admin"); setIsAdmin(false); setShowDashboard(false); setShowAdminLogin(false); showAlert("Admin Logged Out","You have been logged out from admin panel."); };
const handleCustomerLogout = ()=>{ localStorage.removeItem("royal_customer"); setCustomer({name:"",phone:"",address:""}); showAlert("Logged Out","You have been successfully logged out."); };
const handleNavClick = (id)=>{ setShowDashboard(false); setTimeout(()=>{ const el=document.getElementById(id); if(el) el.scrollIntoView({behavior:"smooth"}); },100); };
const checkout = ()=>{
if(cart.length===0){ showAlert("Cart is empty","Add a coffee first.","info"); return; }
if(!customer.name || !customer.phone){ setIsCartOpen(false); setIsLoginOpen(true); showAlert("Sign in needed","Please add name, phone and address, then checkout.","info"); return; }
const total = cart.reduce((s,i)=>s+i.price*i.quantity,0);
const order = { at:new Date().toISOString(), customer:customer, items:cart, total:total };
const all = JSON.parse(localStorage.getItem("royal_orders")||"[]"); all.unshift(order); localStorage.setItem("royal_orders", JSON.stringify(all));
if(window.postToSheet){ window.postToSheet({type:"order", name:customer.name||"", phone:customer.phone||"", address:customer.address||"", items: order.items.map(x=> x.name + " x" + x.quantity).join(", "), total: total}); }
saveCart([]); setIsCartOpen(false);
const waText = encodeURIComponent("Hello Royal Coffee, I want to order:\n" + order.items.map(x=> x.name + " x" + x.quantity + " = Rs." + (x.price*x.quantity)).join("\n") + "\nTotal: Rs." + total + "\nName: " + customer.name + "\nPhone: " + customer.phone + "\nAddress: " + customer.address);
if(window.Swal){ window.Swal.fire({ icon:"success", title:"Order placed!", text:"Total Rs."+total+". We will call you to confirm.", background:"#1e1610", color:"#eedbc8", showCancelButton:true, confirmButtonText:"Confirm on WhatsApp", cancelButtonText:"Done", confirmButtonColor:"#c9a86a" }).then(r=>{ if(r.isConfirmed) window.open("https://wa.me/919449508060?text="+waText, "_blank"); }); } else showAlert("Order placed","Total Rs."+total);
};
if(showDashboard){ return (setIsCartOpen(true)} onLoginClick={()=>setIsLoginOpen(true)} onLogoutClick={handleCustomerLogout} customerName={customer.name} onAdminClick={handleAdminClick} isAdmin={isAdmin} onNavClick={handleNavClick} />setShowDashboard(false)} />setIsCartOpen(false)} cart={cart} updateQuantity={updateQuantity} removeItem={removeItem} customer={customer} onCheckout={checkout} />setIsLoginOpen(false)} onSave={saveCustomer} customer={customer} /> ); }
return (setIsCartOpen(true)} onLoginClick={()=>setIsLoginOpen(true)} onLogoutClick={handleCustomerLogout} customerName={customer.name} onAdminClick={handleAdminClick} isAdmin={isAdmin} onNavClick={null} />Coffee Powder - Frequently Asked Questions Where to buy best coffee powder in Shivamogga?
Royal Coffee, #55, Sameeradham, Ranganatha Layout, Gopala, Shivamogga - 577205. Shivamogga same-day delivery.
Best filter coffee for Chikkamagaluru and Davanagere?
Royal Gold Reserve Rs.495 and Shimogga Select Rs.380 - Pure coffee, no additives.
Do you deliver to Chitradurga, Uttara Kannada, Mangaluru, Bengaluru?
Yes, we deliver across Karnataka, across India and across Globe. Courier / Postal charges extra.
Why Shivamogga Loves Royal Coffee Pure coffee, no additives.
★★★★★
Shivamogga oldest coffee shop. Here you get good quality coffee powder that you will not get anywhere else. Our home coffee has been from here for years.
- Nagaraj Vaidya, Bengaluru
★★★★★
Super taste and super aroma. Once you make filter kaapi with this powder, you will not go to any other powder. Quality and taste both are excellent.
- Harsha, Bengaluru
★★★★★
Best coffee powder for daily filter kaapi. Pure, fresh and perfectly roasted. We order from Shivamogga and get delivery across Karnataka and across Globe.
- Ganapathi Naik, Chikkamagaluru
setIsCartOpen(false)} cart={cart} updateQuantity={updateQuantity} removeItem={removeItem} customer={customer} onCheckout={checkout} />setIsLoginOpen(false)} onSave={saveCustomer} customer={customer} />setShowAdminLogin(false)} onLoginSuccess={handleAdminLoginSuccess} /> );
}
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render( );