'use client'; import { useState } from 'react'; import { useAuth } from '../context/AuthContext'; import Header from '../components/Header'; import PaymentModal from '../components/PaymentModal'; // Mock data for boxes - replace with actual data from your backend const MOCK_BOXES = [ { id: '1', tier: 'Small', price: 100, color: 'from-blue-500 to-blue-600', image: '/box-small.png', description: 'Perfect for beginners. Contains common to rare items.', }, { id: '2', tier: 'Medium', price: 1000, color: 'from-purple-500 to-purple-600', image: '/box-medium.png', description: 'For serious collectors. Contains rare to epic items.', }, { id: '3', tier: 'Big', price: 10000, color: 'from-pink-500 to-pink-600', image: '/box-big.png', description: 'Premium boxes with epic to legendary items.', }, ]; type SortOption = 'price-asc' | 'price-desc'; type FilterTier = 'all' | 'small' | 'medium' | 'big'; export default function BoxesPage() { const { user } = useAuth(); const [sortBy, setSortBy] = useState('price-asc'); const [filterTier, setFilterTier] = useState('all'); const [selectedBox, setSelectedBox] = useState(null); const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false); const filteredAndSortedBoxes = MOCK_BOXES .filter(box => filterTier === 'all' || box.tier.toLowerCase() === filterTier) .sort((a, b) => { switch (sortBy) { case 'price-asc': return a.price - b.price; case 'price-desc': return b.price - a.price; default: return 0; } }); const handleOpenBox = (box: typeof MOCK_BOXES[0]) => { if (!user) { // Redirect to login or show login modal return; } setSelectedBox(box); setIsPaymentModalOpen(true); }; const handleClosePaymentModal = () => { setIsPaymentModalOpen(false); setSelectedBox(null); }; return ( <>
{/* Page Header */}

Mystery Boxes

Choose your box and discover amazing prizes

{/* Filters and Sort */}
{/* Tier Filter */}
{/* Sort Dropdown */}
{/* Boxes Grid */}
{filteredAndSortedBoxes.map((box) => (
{/* Box Image */}
🎁
{/* Box Info */}

{box.tier} Box

{box.description}

{/* Price and Action */}
${box.price} USD
))}
{/* Empty State */} {filteredAndSortedBoxes.length === 0 && (
🔍

No boxes found

Try adjusting your filters to see more boxes

)}
{/* Payment Modal */} ); }