import { LinearGradient } from 'expo-linear-gradient'; import React from 'react'; import { Text, Pressable, View, StyleSheet } from 'react-native'; import { Icon } from './Icon'; import type { Mood, MoodSequence } from '@/store/store'; interface SequenceCardProps { sequence: MoodSequence; moods: Mood[]; onPress: () => void; onLongPress?: () => void; isActive?: boolean; } export const SequenceCard = ({ sequence, moods, onPress, onLongPress, isActive, }: SequenceCardProps) => { // Hole die Farben der ersten 3 Moods in der Sequenz const getGradientColors = () => { const colors: string[] = []; sequence.items.slice(0, 3).forEach((item) => { const mood = moods.find((m) => m.id === item.moodId); if (mood && mood.colors.length > 0) { colors.push(mood.colors[0]); } }); // Falls weniger als 2 Farben, fülle mit Schwarz auf while (colors.length < 2) { colors.push('#000000'); } return colors; }; const getTotalDuration = () => { const totalSeconds = sequence.items.reduce((sum, item) => sum + item.duration, 0); const mins = Math.floor(totalSeconds / 60); const secs = totalSeconds % 60; if (mins === 0) { return `${secs} Sek`; } else if (secs === 0) { return `${mins} Min`; } else { return `${mins} Min ${secs} Sek`; } }; return ( {/* Play Icon Overlay */} {/* Sequence Info */} {sequence.name} {sequence.items.length} Moods · {getTotalDuration()} ); }; const styles = StyleSheet.create({ card: { aspectRatio: 16 / 9, }, gradient: { width: '100%', height: '100%', }, activeCard: { opacity: 0.8, transform: [{ scale: 1.05 }], }, });