import React from 'react'; import { View, Text } from 'react-native'; import { useTheme } from '~/features/theme/ThemeProvider'; import colors from '~/tailwind.config.js'; import StatRow from './StatRow'; import { useTranslation } from 'react-i18next'; interface PeriodStats { memos: number; memories: number; duration: number; words: number; } interface StreakData { current: number; longest: number; } interface PeriodStatsCardProps { title?: string; stats: PeriodStats; showStreaks?: boolean; streakData?: StreakData; marginBottom?: number; } /** * Reusable card component for displaying period-specific statistics */ const PeriodStatsCard: React.FC = ({ title, stats, showStreaks = false, streakData, marginBottom = 12, }) => { const { isDark, themeVariant } = useTheme(); const { t } = useTranslation(); const textColor = isDark ? '#FFFFFF' : '#000000'; const contentBackgroundColor = isDark ? (colors as any).theme?.extend?.colors?.dark?.[themeVariant]?.contentBackground : (colors as any).theme?.extend?.colors?.[themeVariant]?.contentBackground; const borderColor = isDark ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)'; const formatTotalDuration = (seconds: number): string => { const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); if (hours > 0) { return `${hours}h ${minutes}m`; } else if (minutes > 0) { return `${minutes}m`; } else { return `${seconds}s`; } }; return ( <> {title && ( {title} )} {showStreaks && streakData && ( <> )} ); }; export default PeriodStatsCard;