"use client"; import { useState } from "react"; import { useUser } from "@/lib/context"; import { Footprints, ShoppingBag, MapPin, Share2, ClipboardCheck, Sparkles, Check, RefreshCw } from "lucide-react"; export default function EarningFeatures() { const { profile, addLyts, incrementSteps } = useUser(); // Walk simulator state const [simSteps, setSimSteps] = useState(1200); const [walkClaimed, setWalkClaimed] = useState(false); const walkReward = Math.floor(simSteps / 400); // 1 LYT per 400 steps for the simulator // Shop state const [selectedItems, setSelectedItems] = useState(["coffee"]); const [shopClaimed, setShopClaimed] = useState(false); const shopItems = [ { id: "coffee", name: "Starbucks Iced Latte", cost: "$5.80", reward: 8 }, { id: "sneakers", name: "Nike Air Max Essentials", cost: "$120.00", reward: 150 }, { id: "gym", name: "Gymshark Fitness Tee", cost: "$35.00", reward: 40 }, ]; const totalShopReward = shopItems .filter((item) => selectedItems.includes(item.id)) .reduce((sum, item) => sum + item.reward, 0); // Map state const [visitedStores, setVisitedStores] = useState([]); const [mapClaimed, setMapClaimed] = useState(null); const checkinLocations = [ { id: "cafe", name: "Brew & Co Cafe", reward: 5, checked: false }, { id: "apparel", name: "H&M flagship", reward: 12, checked: false }, { id: "arena", name: "Downtown Arena", reward: 25, checked: false }, ]; // Referral state const [referralCopied, setReferralCopied] = useState(false); const referralCode = `lytsup.com/invite/${profile.name.toLowerCase().replace(/\s+/g, "")}-77`; const handleSimulateWalk = () => { incrementSteps(simSteps); addLyts(walkReward); setWalkClaimed(true); setTimeout(() => { setWalkClaimed(false); setSimSteps(1200); }, 4000); }; const handleShopClaim = () => { if (totalShopReward > 0) { addLyts(totalShopReward); setShopClaimed(true); setTimeout(() => { setShopClaimed(false); setSelectedItems([]); }, 4000); } }; const handleCheckin = (id: string, name: string, reward: number) => { if (visitedStores.includes(id)) return; setVisitedStores((prev) => [...prev, id]); addLyts(reward); setMapClaimed(name); setTimeout(() => setMapClaimed(null), 3000); }; const handleCopyReferral = () => { navigator.clipboard.writeText(referralCode); setReferralCopied(true); addLyts(50); // Referral bonus! setTimeout(() => setReferralCopied(false), 4000); }; return (
{/* Background glow lines */}
{/* Section Header */}
How it works

Earn LYTs for Living Your Life

Interact with our live simulations below to see how easy it is to rack up social currency.

{/* Feature Grid */}
{/* Card 1: Walk to Earn (Simulator) */}
1 LYT / 400 Steps

Walk-to-Earn

Keep your phone in your pocket, walk to class, run errands, or jog. Watch your step count convert to LYTs automatically.

{/* Step Simulator Widget */}
Steps to Simulate +{simSteps.toLocaleString()} Steps
Estimated Earn +{walkReward} LYTs
{/* Range Slider */} setSimSteps(parseInt(e.target.value))} disabled={walkClaimed} className="w-full h-1.5 bg-white/10 rounded-lg appearance-none cursor-pointer accent-primary" />
400 Steps 6,000 Steps 12,000 Steps
{/* Card 2: Shop & Earn (Receipt Simulator) */}
10% LYT Cashback

Shop-to-Earn

Shop from partner merchants (food, clothing, fitness centers) and scan your digital receipt to claim instant LYT cashback.

{/* Receipt Widget */}
Pending Receipt

Select items purchased:

{shopItems.map((item) => (
{ if (shopClaimed) return; setSelectedItems((prev) => prev.includes(item.id) ? prev.filter((id) => id !== item.id) : [...prev, item.id] ); }} className={`flex items-center justify-between p-3 rounded-xl border cursor-pointer transition-all ${ selectedItems.includes(item.id) ? "bg-accent-pink/5 border-accent-pink/30 text-white" : "bg-white/3 border-white/5 text-white/60 hover:border-white/10" }`} >
{selectedItems.includes(item.id) && }
{item.name}
{item.cost}
+{item.reward} LYTs
))}
{/* Card 3: Visit to Earn (Geofence Checkins) */}
Location Check-Ins

Visit-to-Earn

Explore your city! Check in at partner gyms, parks, retail shops, or cafes. Each location visit awards you instant points.

{/* Map Simulator Widget */}
{mapClaimed && (

Checked in at {mapClaimed}!

LYTs Added directly to wallet

)}

Active nodes near you:

{checkinLocations.map((loc) => { const visited = visitedStores.includes(loc.id); return (
{loc.name}
); })}
Glow tips: Allow location permissions in-app to auto check-in.
{/* Card 4: Refer to Earn (Social Loop) */}
50 LYTs / Referral

Refer-to-Earn

Everything is better with friends. Send your personal link to your friends. Get 50 LYTs the second they verify their profile!

{/* Referral Widget */}
🔥 Bonus: Your friends also start with 50 LYTs in their wallet when they sign up!
); }