improve product search and barcode scanning
Android Release Build / build-android (push) Failing after 7m42s

This commit is contained in:
2026-11-20 00:51:47 +01:00
parent 460ca60914
commit ab963d8421
8 changed files with 281 additions and 134 deletions
+14 -3
View File
@@ -4,7 +4,7 @@ import { colors } from '../../utils/constants';
import ProductImage from './ProductImage';
import ProductScoreBadge from './ProductScoreBadge';
export default function ProductCard({ product, rating, onPress }) {
export default function ProductCard({ product, rating, onPress, searchMetadata }) {
return (
<Pressable accessibilityRole="button" onPress={onPress} style={styles.card}>
<View style={styles.topRow}>
@@ -24,6 +24,14 @@ export default function ProductCard({ product, rating, onPress }) {
{rating ? <ProductScoreBadge status={rating.overallStatus} score={rating.overallScore} /> : null}
<Text style={styles.openLabel}>Details ansehen ›</Text>
</View>
{searchMetadata ? (
<View style={styles.searchMeta}>
<Text style={styles.matchLabel}>{searchMetadata.matchLabel}</Text>
<Text style={styles.coverageLabel}>
{searchMetadata.dataCoverage}% Produktdaten · {searchMetadata.freshnessLabel}
</Text>
</View>
) : null}
{rating?.allergenReviewRequired ? <Text style={styles.allergenWarning}>{rating.allergenReviewMessage}</Text> : null}
{rating?.staleDataReviewRequired ? <Text style={styles.allergenWarning}>Gespeicherte Produktdaten sind veraltet.</Text> : null}
</Pressable>
@@ -33,7 +41,7 @@ export default function ProductCard({ product, rating, onPress }) {
function sourceLabel(source) {
const labels = {
cache: 'Lokaler Cache',
local: 'Lokale Beispieldaten',
local: 'Lokal erfasst',
'open-food-facts': 'Open Food Facts'
};
@@ -97,5 +105,8 @@ const styles = StyleSheet.create({
paddingHorizontal: 8,
paddingVertical: 4
},
allergenWarning: { color: colors.danger, fontSize: 14, fontWeight: '800' }
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 }
});