import { Pressable, StyleSheet, Text, View } from 'react-native'; import { colors } from '../../utils/constants'; import ProductImage from './ProductImage'; import ProductScoreBadge from './ProductScoreBadge'; export default function ProductCard({ product, rating, onPress, searchMetadata }) { return ( {product.name} {product.brand || 'Ohne Marke'} {product.category || 'Produkt'} · Barcode {product.barcode} {sourceLabel(product.dataSource)} {rating ? : null} Details ansehen › {searchMetadata ? ( {searchMetadata.matchLabel} {searchMetadata.dataCoverage}% Produktdaten · {searchMetadata.freshnessLabel} ) : null} {rating?.allergenReviewRequired ? {rating.allergenReviewMessage} : null} {rating?.staleDataReviewRequired ? Gespeicherte Produktdaten sind veraltet. : null} ); } function sourceLabel(source) { const labels = { cache: 'Lokaler Cache', local: 'Lokal erfasst', 'open-food-facts': 'Open Food Facts' }; return labels[source] || 'Quelle unbekannt'; } const styles = StyleSheet.create({ card: { backgroundColor: colors.surface, borderColor: colors.border, borderRadius: 18, borderWidth: 1, gap: 10, padding: 16 }, topRow: { alignItems: 'flex-start', flexDirection: 'row', gap: 12 }, footer: { alignItems: 'center', borderTopColor: colors.border, borderTopWidth: 1, flexDirection: 'row', justifyContent: 'space-between', paddingTop: 11 }, openLabel: { color: colors.primary, fontSize: 13, fontWeight: '800' }, copy: { flex: 1 }, name: { color: colors.text, fontSize: 16, fontWeight: '800' }, meta: { color: colors.muted, fontSize: 14, marginTop: 4 }, note: { color: colors.muted, fontSize: 13, lineHeight: 18, marginTop: 5 }, source: { alignSelf: 'flex-start', backgroundColor: colors.surfaceTint, borderRadius: 8, color: colors.primaryDark, fontSize: 12, fontWeight: '800', marginTop: 8, paddingHorizontal: 8, paddingVertical: 4 }, allergenWarning: { color: colors.danger, fontSize: 14, fontWeight: '800' }, searchMeta: { backgroundColor: colors.background, borderRadius: 10, gap: 3, padding: 10 }, matchLabel: { color: colors.primaryDark, fontSize: 12, fontWeight: '800' }, coverageLabel: { color: colors.muted, fontSize: 12, lineHeight: 17 } });