/* * File: EmptyState.tsx * Description: Empty state component for AI predictions * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */ import React from 'react'; import { View, Text, StyleSheet, TouchableOpacity, Dimensions, } from 'react-native'; import Icon from 'react-native-vector-icons/Feather'; import { theme } from '../../../theme'; // ============================================================================ // INTERFACES // ============================================================================ interface EmptyStateProps { title?: string; message?: string; iconName?: string; actionText?: string; onAction?: () => void; style?: any; showRefreshButton?: boolean; onRefresh?: () => void; } // ============================================================================ // CONSTANTS // ============================================================================ const { width, height } = Dimensions.get('window'); // ============================================================================ // EMPTY STATE COMPONENT // ============================================================================ /** * EmptyState Component * * Purpose: Display empty state for AI predictions * * Features: * - Customizable title and message * - Icon display with customizable icon * - Optional action button * - Refresh functionality * - Responsive design * - Modern empty state design * - Accessibility support */ const EmptyState: React.FC = ({ title = 'No AI Predictions Found', message = 'There are no AI prediction cases available at the moment. Try adjusting your filters or refresh to see new predictions.', iconName = 'brain', actionText = 'Refresh', onAction, style, showRefreshButton = true, onRefresh, }) => { // ============================================================================ // EVENT HANDLERS // ============================================================================ /** * Handle Action Press * * Purpose: Handle action button press */ const handleActionPress = () => { if (onAction) { onAction(); } else if (onRefresh) { onRefresh(); } }; // ============================================================================ // RENDER // ============================================================================ return ( {/* Empty State Icon */} {/* Empty State Title */} {title} {/* Empty State Message */} {message} {/* Action Buttons */} {/* Primary Action Button */} {(onAction || onRefresh) && ( {actionText} )} {/* Secondary Refresh Button */} {showRefreshButton && onRefresh && !onAction && ( Refresh Data )} {/* Suggestions */} Try: Clearing search filters Adjusting filter criteria Refreshing the data ); }; // ============================================================================ // STYLES // ============================================================================ const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: theme.spacing.xl, paddingVertical: theme.spacing.xxl, minHeight: height * 0.4, }, iconContainer: { width: 120, height: 120, borderRadius: 60, backgroundColor: theme.colors.backgroundAlt, justifyContent: 'center', alignItems: 'center', marginBottom: theme.spacing.xl, ...theme.shadows.small, }, icon: { opacity: 0.6, }, title: { fontSize: theme.typography.fontSize.displaySmall, fontWeight: theme.typography.fontWeight.bold, color: theme.colors.textPrimary, textAlign: 'center', marginBottom: theme.spacing.md, }, message: { fontSize: theme.typography.fontSize.bodyLarge, color: theme.colors.textSecondary, textAlign: 'center', lineHeight: theme.typography.lineHeight.relaxed * theme.typography.fontSize.bodyLarge, marginBottom: theme.spacing.xl, maxWidth: width * 0.8, }, buttonsContainer: { flexDirection: 'row', gap: theme.spacing.md, marginBottom: theme.spacing.xl, }, actionButton: { flexDirection: 'row', alignItems: 'center', backgroundColor: theme.colors.primary, paddingHorizontal: theme.spacing.lg, paddingVertical: theme.spacing.md, borderRadius: theme.borderRadius.medium, gap: theme.spacing.sm, ...theme.shadows.medium, }, actionButtonText: { fontSize: theme.typography.fontSize.bodyMedium, fontWeight: theme.typography.fontWeight.medium, color: theme.colors.background, }, secondaryButton: { flexDirection: 'row', alignItems: 'center', backgroundColor: 'transparent', borderWidth: 1, borderColor: theme.colors.primary, paddingHorizontal: theme.spacing.lg, paddingVertical: theme.spacing.md, borderRadius: theme.borderRadius.medium, gap: theme.spacing.sm, }, secondaryButtonText: { fontSize: theme.typography.fontSize.bodyMedium, fontWeight: theme.typography.fontWeight.medium, color: theme.colors.primary, }, buttonIcon: { // No additional styles needed }, suggestionsContainer: { alignItems: 'center', maxWidth: width * 0.8, }, suggestionsTitle: { fontSize: theme.typography.fontSize.bodyMedium, fontWeight: theme.typography.fontWeight.medium, color: theme.colors.textSecondary, marginBottom: theme.spacing.sm, }, suggestionsList: { gap: theme.spacing.sm, }, suggestionItem: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing.sm, paddingVertical: theme.spacing.xs, }, suggestionText: { fontSize: theme.typography.fontSize.bodyMedium, color: theme.colors.textMuted, }, }); export default EmptyState; /* * End of File: EmptyState.tsx * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */