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 } from '@bettoredge/types'; import type { CalcuttaLifecycleState } from '../../helpers/lifecycleState'; interface SealedBidHeaderProps { competition: CalcuttaCompetitionProps; isAdmin: boolean; onClose?: () => void; onManage?: () => void; lifecycleState: CalcuttaLifecycleState; auctionExpired?: boolean; } function getStateBadge(state: CalcuttaLifecycleState): { label: string; color: string; bg: string } { switch (state) { case 'pending': return { label: 'Coming Soon', color: '#F59E0B', bg: '#F59E0B15' }; case 'scheduled': return { label: 'Open to Join', color: '#3B82F6', bg: '#3B82F615' }; case 'auctioning': return { label: 'Live', color: '#10B981', bg: '#10B98115' }; case 'tournament': return { label: 'In Progress', color: '#8B5CF6', bg: '#8B5CF615' }; case 'completed': return { label: 'Completed', color: '#6B7280', bg: '#6B728015' }; } } export const SealedBidHeader: React.FC = ({ competition, isAdmin, onManage, lifecycleState, auctionExpired, }) => { const { theme } = useTheme(); const badge = (auctionExpired && lifecycleState === 'auctioning') ? { label: 'Closing...', color: '#F59E0B', bg: '#F59E0B15' } : getStateBadge(lifecycleState); return ( {competition.image?.url ? ( ) : ( )} {competition.competition_name} Sealed Bid {badge.label} {isAdmin && onManage && ( )} ); }; const styles = StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 14, paddingVertical: 10, borderBottomWidth: 1, }, thumb: { width: 44, height: 44, borderRadius: 10, alignItems: 'center', justifyContent: 'center', overflow: 'hidden', marginRight: 10, }, titleWrap: { flex: 1, }, badgeRow: { flexDirection: 'row', marginTop: 2, }, badge: { paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, }, gearBtn: { width: 32, height: 32, borderRadius: 16, alignItems: 'center', justifyContent: 'center', marginLeft: 8, }, });