import React from 'react'; import { StyleSheet, TouchableOpacity, Image } from 'react-native'; import { View, Text, useTheme } from '@bettoredge/styles'; import { Ionicons } from '@expo/vector-icons'; import type { CalcuttaCompetitionProps, CalcuttaParticipantProps } from '@bettoredge/types'; import { formatCurrency, getStatusLabel } from '../helpers/formatting'; export interface CalcuttaCardProps { competition: CalcuttaCompetitionProps; participant?: CalcuttaParticipantProps; onSelect: (competition: CalcuttaCompetitionProps) => void; } export const CalcuttaCard: React.FC = ({ competition, participant, onSelect, }) => { const { theme } = useTheme(); const statusLabel = getStatusLabel(competition.status); const auctionLabel = competition.auction_type === 'sweepstakes' ? 'Sweepstakes' : competition.auction_type === 'live' ? 'Live Auction' : 'Sealed Bid'; const isSweepstakes = competition.auction_type === 'sweepstakes'; const participantCount = competition.participants?.length ?? 0; return ( onSelect(competition)} > {competition.image?.url ? ( ) : ( )} {competition.competition_name} {statusLabel} {'\u00B7'} {auctionLabel} {isSweepstakes ? ( {competition.rounds?.filter(r => r.prize_description).length ?? 0} Prizes ) : ( Pot: {formatCurrency(competition.total_pot, competition.market_type)} )} {'\u00B7'} {participantCount} participant{participantCount !== 1 ? 's' : ''} {participant && ( {participant.items_owned} item{participant.items_owned !== 1 ? 's' : ''} 0 ? theme.colors.status.success : theme.colors.text.secondary, marginTop: 2, }} > {formatCurrency(participant.total_winnings, competition.market_type)} )} ); }; const styles = StyleSheet.create({ row: { flexDirection: 'row', alignItems: 'center', padding: 12, borderBottomWidth: 1, }, image: { height: 36, width: 36, borderRadius: 8, }, imageFallback: { alignItems: 'center', justifyContent: 'center', }, info: { flex: 1, marginLeft: 10, }, meta: { flexDirection: 'row', alignItems: 'center', marginTop: 2, }, participantInfo: { marginHorizontal: 10, alignItems: 'flex-end', }, chevron: { marginLeft: 4, }, });