initial commit

This commit is contained in:
2026-07-01 13:54:21 +02:00
parent ac7ba88422
commit 43ef81b8e8
16 changed files with 1061 additions and 228 deletions
+31
View File
@@ -9,6 +9,11 @@ import { calculateProductRating } from '../services/ratingService';
import { colors } from '../utils/constants';
export default function HomeScreen({ preferences, recentProducts, onStartScan, onOpenProduct }) {
const frequentProducts = [...recentProducts]
.filter((product) => (product.scanCount || 0) > 1)
.sort((a, b) => (b.scanCount || 0) - (a.scanCount || 0))
.slice(0, 3);
return (
<ScreenContainer>
<AppHeader
@@ -25,6 +30,22 @@ export default function HomeScreen({ preferences, recentProducts, onStartScan, o
<PrimaryButton label="Produkt scannen" onPress={onStartScan} />
</View>
{frequentProducts.length > 0 ? (
<>
<SectionTitle>Häufig gekauft</SectionTitle>
{frequentProducts.map((product) => (
<View key={`frequent-${product.id}`} style={styles.frequentWrap}>
<ProductCard
product={product}
rating={calculateProductRating(product, preferences)}
onPress={() => onOpenProduct(product)}
/>
<Text style={styles.scanCount}>{product.scanCount} Scans</Text>
</View>
))}
</>
) : null}
<SectionTitle>Letzte Scans</SectionTitle>
{recentProducts.length === 0 ? (
<View style={styles.emptyState}>
@@ -71,6 +92,16 @@ const styles = StyleSheet.create({
fontSize: 16,
lineHeight: 23
},
frequentWrap: {
gap: 6
},
scanCount: {
alignSelf: 'flex-start',
color: colors.primary,
fontSize: 12,
fontWeight: '800',
marginLeft: 12
},
emptyState: {
backgroundColor: colors.surface,
borderColor: colors.border,