import { useState } from 'react'; import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Alert } from 'react-native'; import { useRouter } from 'expo-router'; import { Ionicons } from '@expo/vector-icons'; import { useCreateSaisie } from '@/hooks/useTracker'; import EmotionPicker from '@/components/EmotionPicker'; import { Colors } from '@/lib/colors'; import { Spacing, Radius, FontSize, FontWeight } from '@/lib/theme'; import { Button, TextField } from '@/components/ui'; /** Dimensions locales (multiples de l'échelle 4px du DSFR). */ const STEP_CIRCLE = 36; const STEP_LINE_WIDTH = 40; const STEP_LINE_HEIGHT = 3; const STEP_CHECK_ICON = 18; const INTENSITY_LINE_HEIGHT = 60; const DOT_SIZE = 44; export default function NewEntryScreen() { const router = useRouter(); const createSaisie = useCreateSaisie(); const [step, setStep] = useState(1); const [emotionId, setEmotionId] = useState(); const [intensite, setIntensite] = useState(5); const [note, setNote] = useState(''); const handleSubmit = async () => { if (!emotionId) return; try { await createSaisie.mutateAsync({ emotion_id: emotionId, intensite, note: note.trim() || undefined, date_saisie: new Date().toISOString().split('T')[0], }); Alert.alert('Succès', 'Saisie enregistrée !', [{ text: 'OK', onPress: () => router.back() }]); } catch { Alert.alert('Erreur', "Impossible d'enregistrer la saisie"); } }; return ( {/* Stepper */} {[1, 2, 3].map((s) => ( = s && styles.stepActive]}> {step > s ? ( ) : ( = s && styles.stepNumberActive]}>{s} )} {s < 3 && s && styles.stepLineActive]} />} ))} {/* Step 1: Émotion */} {step === 1 && ( Comment vous sentez-vous ?