import React from 'react'; import { View, Text, Pressable } from 'react-native'; import { Image } from 'expo-image'; import Svg, { Path } from 'react-native-svg'; import type { RaffleListing as RaffleListingType, ComponentSize } from '../types/algorand'; import { formatCurrency, formatRelativeTime } from '../utils/format'; import { SizeContainer } from '../ui/SizeContainer'; import { StatusBadge } from '../ui/StatusBadge'; import { ProgressBar } from '../ui/ProgressBar'; function TicketIcon({ size = 16, color = '#a1a1aa' }: { size?: number; color?: string }) { return ( ); } function TrophyIcon({ size = 16, color = '#eab308' }: { size?: number; color?: string }) { return ( ); } function CalendarIcon({ size = 16, color = '#71717a' }: { size?: number; color?: string }) { return ( ); } function TimerIcon({ size = 16, color = '#a1a1aa' }: { size?: number; color?: string }) { return ( ); } interface RaffleListingProps { data: RaffleListingType; showEntryButton?: boolean; size?: ComponentSize; className?: string; imageUrl?: string; onEnter?: (raffle: RaffleListingType) => void; } export function RaffleListingComponent({ data: raffle, showEntryButton = true, size = 'full', className, imageUrl, onEnter, }: RaffleListingProps) { const isActive = raffle.status === 'active'; const isUpcoming = raffle.status === 'upcoming'; const ticketsRemaining = raffle.ticketCount - raffle.entryCount; const progressPercentage = (raffle.entryCount / raffle.ticketCount) * 100; const statusVariant = isActive ? 'success' : isUpcoming ? 'info' : 'neutral'; const isFullscreen = size === 'fullscreen'; return ( {/* Header */} {imageUrl && ( )} Raffle Event {raffle.entryCount}/{raffle.ticketCount} entries {raffle.title} {raffle.description} {/* Prize Pool */} Prize Pool {raffle.prizes.map((prize, index) => ( {prize.name} #{prize.id} ))} {/* Entry Stats */} {formatCurrency(raffle.pricePerEntry, raffle.entryAsset.unitName)} Per Entry {raffle.entryCount}/{raffle.ticketCount} Entries {ticketsRemaining} Remaining {/* Progress */} {progressPercentage.toFixed(1)}% sold {ticketsRemaining} left {/* Timing */} {isUpcoming ? 'Starts' : isActive ? 'Ends' : 'Ended'}{' '} {formatRelativeTime(isUpcoming ? raffle.startTime : raffle.endTime)} {/* Entry Button */} {showEntryButton && (isActive || isUpcoming) && ( isActive && ticketsRemaining > 0 && onEnter?.(raffle)} disabled={!isActive || ticketsRemaining === 0} className={`flex-row items-center justify-center gap-2 py-3 px-4 rounded-xl ${ !isActive || ticketsRemaining === 0 ? 'bg-zinc-800/50' : 'bg-purple-600' }`} > {!isActive ? ( <> {isUpcoming ? 'Not Started' : 'Raffle Ended'} ) : ticketsRemaining === 0 ? ( Sold Out ) : ( <> Enter Raffle )} )} ); }