import React from 'react'; import { View, Text, Pressable } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; import { useTheme } from '~/contexts/ThemeContext'; interface ImageCountSelectorProps { value: number; onChange: (count: number) => void; max?: number; min?: number; disabled?: boolean; style?: 'pills' | 'counter' | 'compact'; label?: string; } export function ImageCountSelector({ value, onChange, max = 5, min = 1, disabled = false, style = 'pills', label = 'Varianten' }: ImageCountSelectorProps) { const { theme } = useTheme(); const counts = Array.from({ length: max - min + 1 }, (_, i) => min + i); if (style === 'pills') { return ( {label && ( {label} {value > 1 && ( {value} Bilder )} )} {counts.map((count) => ( !disabled && onChange(count)} disabled={disabled} style={{ width: 48, height: 48, borderRadius: 8, borderWidth: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: value === count ? theme.colors.primary.default : theme.colors.surface, borderColor: value === count ? theme.colors.primary.default : theme.colors.border, opacity: disabled ? 0.5 : 1 }} > {count} ))} {value > 1 && ( Jedes Bild wird mit einem anderen Seed generiert )} ); } if (style === 'counter') { return ( {label && ( {label} )} !disabled && value > min && onChange(value - 1)} disabled={disabled || value <= min} style={{ padding: 8, opacity: disabled || value <= min ? 0.3 : 1 }} > {value} {value === 1 ? 'Bild' : 'Bilder'} !disabled && value < max && onChange(value + 1)} disabled={disabled || value >= max} style={{ padding: 8, opacity: disabled || value >= max ? 0.3 : 1 }} > ); } // Compact style for QuickGenerateBar - full width with 3 equal parts return ( !disabled && value > min && onChange(value - 1)} disabled={disabled || value <= min} style={{ flex: 1, alignItems: 'center', justifyContent: 'center', paddingVertical: 12, opacity: disabled || value <= min ? 0.3 : 1, backgroundColor: theme.colors.input }} > {value} !disabled && value < max && onChange(value + 1)} disabled={disabled || value >= max} style={{ flex: 1, alignItems: 'center', justifyContent: 'center', paddingVertical: 12, opacity: disabled || value >= max ? 0.3 : 1, backgroundColor: theme.colors.input }} > ); }