import { LinearGradient } from 'expo-linear-gradient'; import * as Haptics from 'expo-haptics'; import { Stack, useRouter } from 'expo-router'; import React, { useState } from 'react'; import { ScrollView, View, Text, TextInput, Pressable, Alert, StyleSheet } from 'react-native'; import { Icon } from '@/components/Icon'; import { useResponsive } from '@/hooks/useResponsive'; import type { AnimationType } from '@/store/store'; import { useStore } from '@/store/store'; import { getThemeColors } from '@/utils/theme'; const PRESET_COLORS = [ ['#FF6B6B', '#FFE66D'], ['#4ECDC4', '#44A08D'], ['#6B8DD6', '#8E37D7'], ['#F857A6', '#FF5858'], ['#2E3192', '#1BFFFF'], ['#FFD89B', '#19547B'], ['#00F260', '#0575E6'], ['#FA8BFF', '#2BD2FF'], ['#FEB692', '#EA5455'], ['#A8EDEA', '#FED6E3'], ]; const ANIMATION_TYPES: { label: string; value: AnimationType }[] = [ { label: 'Gradient', value: 'gradient' }, { label: 'Pulsieren', value: 'pulse' }, { label: 'Wellen', value: 'wave' }, ]; export default function CreateMood() { const router = useRouter(); const addCustomMood = useStore((state) => state.addCustomMood); const settings = useStore((state) => state.settings); const [name, setName] = useState(''); const [colors, setColors] = useState(PRESET_COLORS[0]); const [animationType, setAnimationType] = useState('gradient'); const theme = getThemeColors(); const responsive = useResponsive(); const handleHaptic = () => { if (settings.hapticFeedback) { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); } }; const handleCreate = () => { if (!name.trim()) { Alert.alert('Fehler', 'Bitte gib einen Namen ein'); return; } handleHaptic(); addCustomMood({ name: name.trim(), colors, animationType, }); Alert.alert('Erfolg', 'Mood wurde erstellt!', [ { text: 'OK', onPress: () => router.back(), }, ]); }; return ( {/* Preview */} {name || 'Vorschau'} {/* Name Input */} Name {/* Color Selection */} Farben {PRESET_COLORS.map((colorPair, index) => ( { handleHaptic(); setColors(colorPair); }} style={[styles.colorBox, colors === colorPair && styles.selectedColorBox]} > ))} {/* Animation Type */} Animation {ANIMATION_TYPES.map((type) => ( { handleHaptic(); setAnimationType(type.value); }} className={`rounded-full px-4 py-2 ${ animationType === type.value ? 'bg-blue-500' : 'bg-gray-200' }`} > {type.label} ))} {/* Create Button */} Mood erstellen ); } const styles = StyleSheet.create({ previewCard: { aspectRatio: 16 / 9, width: '100%', }, previewGradient: { width: '100%', height: '100%', }, colorBox: { width: '30%', aspectRatio: 1, borderRadius: 16, overflow: 'hidden', }, selectedColorBox: { borderWidth: 4, borderColor: '#3B82F6', }, gradient: { width: '100%', height: '100%', }, });