import React, { useState, useMemo, useEffect } from 'react'; import { Search, ShoppingCart, User, PlusCircle, MessageSquare, TrendingUp, MapPin, Filter, ChevronRight, Star, Home, Store, Users, Bell, Menu, MoreVertical, CheckCircle, ArrowLeft, Image as ImageIcon, Wifi, Battery, Signal } from 'lucide-react'; const MOCK_PRODUCTS = [ { id: 1, name: "Premium Basmati", seller: "GreenValley Farms", price: 4500, unit: "Quintal", location: "Punjab", moisture: "12%", stock: "500T", rating: 4.8, image: "https://images.unsplash.com/photo-1536633104100-349f9976378e?auto=format&fit=crop&q=80&w=400", category: "Basmati" }, { id: 2, name: "Sona Masuri", seller: "Krishna Mills", price: 3200, unit: "Quintal", location: "Andhra Pradesh", moisture: "14%", stock: "1200T", rating: 4.5, image: "https://images.unsplash.com/photo-1586201375761-83865001e31c?auto=format&fit=crop&q=80&w=400", category: "Non-Basmati" }, { id: 3, name: "Jasmine Fragrant", seller: "Thai Delta", price: 5800, unit: "Quintal", location: "Bangkok", moisture: "11%", stock: "200T", rating: 4.9, image: "https://images.unsplash.com/photo-1590080876351-941da3576dee?auto=format&fit=crop&q=80&w=400", category: "Aromatic" }, { id: 4, name: "IR64 Long Grain", seller: "Global Grains", price: 2800, unit: "Quintal", location: "West Bengal", moisture: "13.5%", stock: "5000T", rating: 4.2, image: "https://images.unsplash.com/photo-1511933048017-06c140883d6a?auto=format&fit=crop&q=80&w=400", category: "Non-Basmati" } ]; const COMMUNITY_POSTS = [ { id: 1, author: "Dr. Ramesh Kumar", role: "Agronomist", content: "Basmati prices expected to rise 5% next month due to lower monsoon yield. Sellers hold inventory.", likes: 124, comments: 18, time: "2h ago", avatar: "https://i.pravatar.cc/150?u=ramesh" }, { id: 2, author: "Kisan Network", role: "Farmer Collective", content: "Successfully harvested Sona Masuri. Yield is better than expected! Looking for bulk buyers.", likes: 245, comments: 42, time: "1d ago", avatar: "https://i.pravatar.cc/150?u=kisan" } ]; export default function App() { const [view, setView] = useState('home'); const [cart, setCart] = useState([]); const [searchQuery, setSearchQuery] = useState(""); const [activeCategory, setActiveCategory] = useState("All"); const [toast, setToast] = useState(null); const [currentTime, setCurrentTime] = useState("12:00"); useEffect(() => { const updateTime = () => { const now = new Date(); setCurrentTime(`${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`); }; updateTime(); const interval = setInterval(updateTime, 60000); return () => clearInterval(interval); }, []); const showToast = (msg) => { setToast(msg); setTimeout(() => setToast(null), 3000); }; const addToCart = (product) => { setCart(prev => [...prev, { ...product, cartId: Date.now() }]); showToast("Added to cart"); }; const totalAmount = cart.reduce((sum, item) => sum + item.price, 0); const StatusBar = () => (
{currentTime}
); const TopAppBar = ({ title, showBack = false }) => (
{showBack ? ( ) : ( )}

{title}

); const BottomNav = () => (
{[ { id: 'home', icon: Home, label: 'Home' }, { id: 'market', icon: Store, label: 'Market' }, { id: 'sell', icon: PlusCircle, label: 'Sell', isPrimary: true }, { id: 'community', icon: Users, label: 'Network' }, { id: 'cart', icon: ShoppingCart, label: 'Cart', badge: cart.length } ].map(tab => ( ))}
); const HomeView = () => (
{/* Search Bar */}
setView('market')} />
{/* Quick Stats Grid */}

Avg Price

₹3,450/q

Active Buyers

1.2k+

{/* Featured Section */}

Featured Listings

{/* Horizontal Scroll for Mobile */}
{MOCK_PRODUCTS.map(product => (
{product.name}

{product.name}

{product.rating}

{product.location}

₹{product.price}/q

))}
); const MarketView = () => { const categories = ["All", "Basmati", "Non-Basmati", "Aromatic"]; return (
setSearchQuery(e.target.value)} />
{/* Chips */}
{categories.map(cat => ( ))}
{MOCK_PRODUCTS.filter(p => activeCategory === "All" || p.category === activeCategory).map(product => (
{product.name}

{product.name}

{product.stock} available

₹{product.price}

))}
); }; const SellView = () => (

Add Photos

); const CommunityView = () => (
{COMMUNITY_POSTS.map(post => (
avatar

{post.author}

{post.role} • {post.time}

{post.content}

))}
{/* Floating Action Button */}
); const CartView = () => (
{cart.length === 0 ? (

Cart is empty

Browse the marketplace to find the best paddy deals.

) : (
{cart.map((item) => (
{item.name}

{item.name}

{item.seller}

₹{item.price}

))}
Subtotal ₹{totalAmount.toLocaleString()}
Platform Fee ₹{(totalAmount * 0.01).toLocaleString()}
Total Draft ₹{(totalAmount * 1.01).toLocaleString()}
)}
); return (
{/* Phone Frame Simulator */}
{view === 'home' && } {view === 'market' && } {view === 'sell' && } {view === 'community' && } {view === 'cart' && }
{/* Android-style Toast Notification */} {toast && (
{toast}
)}
{/* Global styles for hiding scrollbars but allowing scroll */}