// Screens 5-8: Cart, Checkout, Order Tracking, Profile
// ═════════════════════════════════════════════════════════════
// 5) CART
// ═════════════════════════════════════════════════════════════
function ScreenCart() {
const items = [
{ name: 'Metformin SR 500mg', sub: 'Strip of 30 · Rx', qty: 2, price: 78, mrp: 95, hue: 'blue', rx: true },
{ name: 'Vitamin D3 60K IU', sub: '4 capsules', qty: 1, price: 149, mrp: 189, hue: 'amber', rx: false },
{ name: 'Cetirizine 10mg', sub: 'Strip of 10 · Rx', qty: 1, price: 24, mrp: 32, hue: 'mint', rx: true },
];
const subtotal = items.reduce((s, i) => s + i.price * i.qty, 0);
const mrp = items.reduce((s, i) => s + i.mrp * i.qty, 0);
return (
Your cart
{items.length} items · delivers by 6:40 PM
{/* Rx required banner */}
Rx attached · Dr_Mehta_Rx.jpg
Change
{/* Items */}
{items.map((p, i) => (
{p.sub}
₹{p.price * p.qty}
₹{p.mrp * p.qty}
))}
{/* Coupon */}
You unlocked
JAN20 — Flat 20% off applied
Edit
{/* Bill summary */}
Bill summary
{[
['MRP total', `₹${mrp}`, false],
['Discount', `−₹${mrp - subtotal}`, false, C.mint500],
['Coupon (JAN20)', `−₹${Math.round(subtotal * 0.2)}`, false, C.mint500],
['Delivery', 'FREE', false, C.mint500],
].map(([k, v, bold, color], i) => (
{k}
{v}
))}
Total to pay
₹{Math.round(subtotal * 0.8)}
You save ₹{mrp - Math.round(subtotal * 0.8)} on this order 🎉
{/* Sticky CTA */}
₹{Math.round(subtotal * 0.8)}
You save ₹{mrp - Math.round(subtotal * 0.8)}
);
}
// ═════════════════════════════════════════════════════════════
// 6) CHECKOUT
// ═════════════════════════════════════════════════════════════
function ScreenCheckout() {
return (
{/* Delivery address */}
Home
Default
Apt 4B, Maple Residency, 100ft Road, Indiranagar, Bengaluru 560038
Arrives in 28 min · Aarav · +91 98••• 12•••
{/* Delivery slot */}
{[
{ label: 'Express', sub: '28 min', price: 'FREE', active: true },
{ label: 'Today', sub: 'by 8 PM', price: 'FREE', active: false },
{ label: 'Tomorrow', sub: '8–10 AM', price: '₹19', active: false },
].map((s) => (
{s.label}
{s.sub}
{s.price}
))}
{/* Payment methods */}
{[
{ label: 'UPI · GPay', sub: 'aarav@oksbi · Recommended', Icon: IconCard, active: true, hue: 'blue' },
{ label: 'HDFC Credit Card', sub: '•••• 4821 · Earn 12 pts', Icon: IconCard, active: false, hue: 'navy' },
{ label: 'Cash on delivery', sub: 'Pay when you receive', Icon: IconCash, active: false, hue: 'mint' },
{ label: 'Health wallet', sub: 'Balance: ₹420', Icon: IconShield, active: false, hue: 'amber' },
].map((m, i) => (
))}
{/* Bill */}
{[
['Items (3)', '₹329'],
['Discount + coupon', '−₹81', C.mint500],
['Delivery', 'FREE', C.mint500],
].map(([k, v, col], i) => (
{k}
{v}
))}
Total
₹248
{/* Sticky CTA */}
);
}
// ═════════════════════════════════════════════════════════════
// 7) ORDER TRACKING
// ═════════════════════════════════════════════════════════════
function ScreenTracking() {
const steps = [
{ label: 'Order confirmed', time: '5:42 PM', done: true },
{ label: 'Pharmacist verified Rx', time: '5:48 PM', done: true },
{ label: 'Packed at Indiranagar store', time: '5:55 PM', done: true, active: true },
{ label: 'Out for delivery', time: 'Est 6:10 PM', done: false },
{ label: 'Delivered', time: 'Est 6:40 PM', done: false },
];
return (
{/* Map area */}
{/* Header buttons */}
{/* Roads (decorative) */}
{/* Origin pin */}
{/* Moving rider */}
{/* Destination pin */}
{/* Tracking sheet */}
{/* Rider card */}
RK
Rohit will deliver
4.9 ★ · 320 deliveries
{/* Timeline */}
{steps.map((s, i) => (
{s.done && }
{i < steps.length - 1 && (
)}
{s.active && (
● In progress
)}
))}
{/* Help row */}
);
}
// ═════════════════════════════════════════════════════════════
// 8) PROFILE
// ═════════════════════════════════════════════════════════════
function ScreenProfile() {
const refills = [
{ name: 'Metformin SR 500mg', sub: 'Refill due in 3 days', progress: 88, hue: 'blue' },
{ name: 'Atorvastatin 10mg', sub: 'Refill due in 9 days', progress: 65, hue: 'mint' },
{ name: 'Vitamin D3 60K IU', sub: 'Refill due in 21 days', progress: 32, hue: 'amber' },
];
return (
{/* Hero header */}
AK
Aarav Kumar
+91 98••• 12••• · 4 family members
{/* Loyalty card */}
JANA+ Gold member
1,284 pts · ₹128 cashback
{/* Quick stats */}
{[
{ k: 'Orders', v: '24', Icon: IconBox },
{ k: 'Rx', v: '6', Icon: IconRx },
{ k: 'Saved', v: '₹2,140', Icon: IconHeart },
].map((s, i) => (
))}
{/* Refill tracker */}
{refills.map((r, i) => (
75 ? C.rose500 : C.ink700 }}>{100 - r.progress}%
75 ? `linear-gradient(90deg, ${C.amber500}, ${C.rose500})` : `linear-gradient(90deg, ${C.blue400}, ${C.blue600})`,
}}/>
))}
{/* Menu list */}
{[
{ label: 'My addresses', Icon: IconLoc, sub: '3 saved' },
{ label: 'Payment methods', Icon: IconCard, sub: '2 cards · UPI' },
{ label: 'Family health records', Icon: IconShield, sub: '4 members' },
{ label: 'Help & support', Icon: IconBell, sub: '24×7 chat' },
].map((m, i, a) => (
))}
);
}
Object.assign(window, { ScreenCart, ScreenCheckout, ScreenTracking, ScreenProfile });