import { FlatList } from "react-native" import { List } from "react-native-paper" import { useState } from "react" import type { GoalFrequency } from "@/domain/entities/Goal" import { GOAL_FREQUENCIES } from "@/domain/entities/Goal" import type { HabitsTracker } from "@/domain/entities/HabitsTracker" import { capitalize } from "@/presentation/presenters/utils/strings" import { HabitHistory } from "./HabitHistory" export interface HabitsHistoryProps { habitsTracker: HabitsTracker } export const HabitsHistory: React.FC = (props) => { const { habitsTracker } = props const [accordionExpanded, setAccordionExpanded] = useState<{ [key in GoalFrequency]: boolean }>({ daily: true, weekly: true, monthly: true, }) return ( {GOAL_FREQUENCIES.map((frequency) => { return ( { setAccordionExpanded((old) => { return { ...old, [frequency]: !old[frequency], } }) }} key={frequency} title={capitalize(frequency)} titleStyle={[ { fontSize: 26, }, ]} > { return }} /> ) })} ) }