import React from 'react'; import { View, Text, ScrollView, Pressable, StyleSheet, } from 'react-native'; import { router } from 'expo-router'; import { Ionicons } from '@expo/vector-icons'; import { ScaleSlider } from '@/components/ui/ScaleSlider'; import { Row, Grid } from '@/components/ui/LayoutHelpers'; import { Section, SectionHeader } from '@/components/ui/Sections'; import { Button } from '@/components/ui/Button'; import { Card } from '@/components/ui/Cards'; import { Theme } from '@/constants/theme'; import { MOOD_COMPONENTS, getMoodComponent, intensityLabel, } from '@/constants/mood-components'; import { useMoodEntryStore, } from '@/stores/moodEntry'; export default function MoodComponentsScreen() { const { selectedMood, components, addComponent, removeComponent, setComponentIntensity, } = useMoodEntryStore(); const activeIds = components.map((c) => c.id); const available = MOOD_COMPONENTS.filter((d) => !activeIds.includes(d.id)); const handleDone = () => { router.back(); }; return ( {/* Header */} router.back()} hitSlop={8}> Editar Componentes Pronto {/* Subtitle */} {selectedMood && ( Baseado no seu humor selecionado {selectedMood.label} )} {/* Active components */} {components.length > 0 && (
{components.map((comp) => { const def = getMoodComponent(comp.id); if (!def) return null; return ( {/* Card header */} {def.label} removeComponent(comp.id)} hitSlop={8} > {/* Slider */} setComponentIntensity(comp.id, v)} min={1} max={3} step={1} minLabel="Suave" maxLabel="Intensa" style={styles.slider} /> ); })}
)} {/* Available to add */} {available.length > 0 && (
{available.map((def) => ( addComponent(def.id)} style={styles.availableItemInternalWrapper} > {def.label} ))}
)}
); } const styles = StyleSheet.create({ container: { flex: 1, }, header: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingHorizontal: Theme.spacing.containerPadding, paddingVertical: 16, borderBottomWidth: 1, borderBottomColor: Theme.colors.light.divider, }, headerTitle: { fontSize: Theme.typography.bodyLg.fontSize, fontWeight: '700', color: Theme.colors.light.text, }, headerAction: { fontSize: Theme.typography.bodyMd.fontSize, fontWeight: '600', color: Theme.colors.light.tint, }, content: { padding: Theme.spacing.containerPadding, gap: Theme.spacing.sectionGap, paddingBottom: 120, }, subtitleBlock: { alignItems: 'center', gap: 4, }, subtitleSmall: { fontSize: Theme.typography.bodyMd.fontSize, color: Theme.colors.light.textSecondary, }, subtitleLarge: { fontSize: 28, fontWeight: '700', color: Theme.colors.light.text, }, section: { gap: Theme.spacing.cardGap, }, sectionHeader: { justifyContent: 'space-between', alignItems: 'center', }, activeCard: { padding: Theme.spacing.cardGap, }, activeCardHeader: { alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }, activeCardLabel: { flex: 1, ... { ...Theme.typography.bodyLg, lineHeight: 24 }, color: Theme.colors.light.text, marginLeft: 4, }, dot: { width: 12, height: 12, borderRadius: 6, flexShrink: 0, }, slider: { marginTop: 4, }, availableItem: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingHorizontal: 12, paddingVertical: 10, }, availableItemInternalWrapper: { flexDirection: 'row', width: '100%', justifyContent: 'space-between', alignItems: 'center', }, availableInner: { alignItems: 'center', flexShrink: 1, }, availableLabel: { fontSize: Theme.typography.bodyMd.fontSize, fontWeight: '500', color: Theme.colors.light.text, } });