import LottieView from "lottie-react-native" import { useRef, useState } from "react" import { Dimensions, ScrollView, View } from "react-native" import { Divider, List } from "react-native-paper" import type { GoalFrequency } from "@/domain/entities/Goal" import type { HabitsTracker } from "@/domain/entities/HabitsTracker" import confettiJSON from "../../../assets/confetti.json" import { capitalize } from "@/utils/strings" import { HabitCard } from "./HabitCard" export interface HabitsListProps { habitsTracker: HabitsTracker selectedDate: Date frequenciesFiltered: GoalFrequency[] } export const HabitsList: React.FC = (props) => { const { habitsTracker, selectedDate, frequenciesFiltered } = props const [accordionExpanded, setAccordionExpanded] = useState<{ [key in GoalFrequency]: boolean }>({ daily: true, weekly: true, monthly: true, }) const confettiRef = useRef(null) return ( <> {frequenciesFiltered.map((frequency) => { return ( { setAccordionExpanded((old) => { return { ...old, [frequency]: !old[frequency], } }) }} key={frequency} title={capitalize(frequency)} titleStyle={[ { fontSize: 26, }, ]} > {habitsTracker.habitsHistory[frequency].map((item) => { return ( ) })} ) })} ) }