import React from 'react'; import { View, Text, Modal, StyleSheet, TouchableOpacity, ViewStyle, TextStyle, Dimensions } from 'react-native'; import { GameButton } from './GameHeader'; const { width: screenWidth, height: screenHeight } = Dimensions.get('window'); interface GameModalProps { visible: boolean; onClose?: () => void; title?: string; children: React.ReactNode; animationType?: 'slide' | 'fade' | 'none'; transparent?: boolean; closable?: boolean; overlayStyle?: ViewStyle; contentStyle?: ViewStyle; titleStyle?: TextStyle; } /** * Modal component for game dialogs, menus, and overlays */ export const GameModal: React.FC = ({ visible, onClose, title, children, animationType = 'fade', transparent = true, closable = true, overlayStyle, contentStyle, titleStyle }) => { return ( {}} // Prevent closing when tapping content > {title && ( {title} {closable && onClose && ( )} )} {children} ); }; interface ConfirmDialogProps { visible: boolean; title: string; message: string; confirmText?: string; cancelText?: string; onConfirm: () => void; onCancel: () => void; dangerous?: boolean; } /** * Pre-built confirmation dialog */ export const ConfirmDialog: React.FC = ({ visible, title, message, confirmText = 'אישור', cancelText = 'ביטול', onConfirm, onCancel, dangerous = false }) => { return ( {message} ); }; interface GameMenuProps { visible: boolean; onClose: () => void; onResume?: () => void; onRestart?: () => void; onQuit?: () => void; onSettings?: () => void; showResume?: boolean; showRestart?: boolean; showQuit?: boolean; showSettings?: boolean; } /** * Pre-built game pause menu */ export const GameMenu: React.FC = ({ visible, onClose, onResume, onRestart, onQuit, onSettings, showResume = true, showRestart = true, showQuit = true, showSettings = true }) => { return ( {showResume && onResume && ( )} {showRestart && onRestart && ( )} {showSettings && onSettings && ( )} {showQuit && onQuit && ( )} ); }; const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', }, content: { backgroundColor: 'white', borderRadius: 12, width: Math.min(screenWidth * 0.9, 400), maxHeight: screenHeight * 0.8, shadowColor: '#000', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.3, shadowRadius: 8, elevation: 8, }, header: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', padding: 20, borderBottomWidth: 1, borderBottomColor: '#E0E0E0', }, title: { fontSize: 20, fontWeight: 'bold', color: '#333', }, closeButton: { width: 30, height: 30, borderRadius: 15, backgroundColor: '#F0F0F0', justifyContent: 'center', alignItems: 'center', }, closeText: { fontSize: 16, color: '#666', fontWeight: 'bold', }, body: { padding: 20, }, // Dialog specific styles dialogContent: { width: Math.min(screenWidth * 0.85, 350), }, message: { fontSize: 16, color: '#666', lineHeight: 24, marginBottom: 24, textAlign: 'center', }, buttonContainer: { flexDirection: 'row', justifyContent: 'space-between', }, dialogButton: { flex: 1, marginHorizontal: 8, }, // Menu specific styles menuContent: { width: Math.min(screenWidth * 0.8, 320), }, menuButtons: { gap: 16, }, menuButton: { width: '100%', }, });