import React, { useEffect, useRef } from 'react'; import { StyleSheet, Modal, TouchableOpacity, Image, Animated } from 'react-native'; import { View, Text, useTheme } from '@bettoredge/styles'; import { Ionicons } from '@expo/vector-icons'; import type { CalcuttaAuctionItemProps } from '@bettoredge/types'; import { resolveItemImageUrl } from '../helpers/formatting'; export interface SweepstakesRevealProps { visible: boolean; item?: CalcuttaAuctionItemProps; /** Resolved image URL from sr_svc (getBulkTeams/getBulkAthletes) */ itemImageUrl?: string; competitionName?: string; onClose: () => void; } export const SweepstakesReveal: React.FC = ({ visible, item, itemImageUrl, competitionName, onClose, }) => { const { theme } = useTheme(); const scaleAnim = useRef(new Animated.Value(0.3)).current; const opacityAnim = useRef(new Animated.Value(0)).current; useEffect(() => { if (visible && item) { scaleAnim.setValue(0.3); opacityAnim.setValue(0); Animated.parallel([ Animated.spring(scaleAnim, { toValue: 1, tension: 50, friction: 7, useNativeDriver: true, }), Animated.timing(opacityAnim, { toValue: 1, duration: 300, useNativeDriver: true, }), ]).start(); } }, [visible, item]); if (!item) return null; return ( {/* Confetti-style header */} 🎉 You Got a Team! {competitionName && ( {competitionName} )} {/* Item display */} {(itemImageUrl || resolveItemImageUrl(item.item_image)) ? ( ) : ( )} {item.item_name} {item.seed != null && ( Seed #{item.seed} )} Cheer them on as they compete through each round! {/* Close button */} Let's Go! ); }; const styles = StyleSheet.create({ backdrop: { flex: 1, backgroundColor: 'rgba(0,0,0,0.6)', justifyContent: 'center', alignItems: 'center', padding: 24, }, card: { width: '100%', maxWidth: 360, borderRadius: 16, borderWidth: 1, }, celebrationHeader: { paddingTop: 32, paddingBottom: 24, paddingHorizontal: 20, alignItems: 'center', borderTopLeftRadius: 15, borderTopRightRadius: 15, }, emoji: { fontSize: 48, lineHeight: 63, marginBottom: 8, }, itemSection: { padding: 24, alignItems: 'center', }, itemImage: { width: 120, height: 120, borderRadius: 16, }, itemImageFallback: { alignItems: 'center', justifyContent: 'center', }, seedBadge: { paddingHorizontal: 16, paddingVertical: 6, borderRadius: 20, marginTop: 10, }, closeButton: { marginHorizontal: 24, marginBottom: 24, paddingVertical: 14, borderRadius: 10, alignItems: 'center', }, });