fix: first add in daily, weekly or monthly

This commit is contained in:
Maxime RICHARD 2024-04-05 14:46:50 +02:00
parent 17c1c1041e
commit a5455f3948

View File

@ -1,6 +1,6 @@
import { useRouter } from "expo-router" import { useRouter } from "expo-router"
import { useMemo, useState } from "react" import { useState } from "react"
import { View, ScrollView, Dimensions } from "react-native" import { Dimensions, ScrollView, View } from "react-native"
import { Button, List, Text } from "react-native-paper" import { Button, List, Text } from "react-native-paper"
import type { GoalFrequency } from "@/domain/entities/Goal" import type { GoalFrequency } from "@/domain/entities/Goal"
@ -18,11 +18,9 @@ export const HabitsMainPage: React.FC<HabitsMainPageProps> = (props) => {
const router = useRouter() const router = useRouter()
const habitsByFrequency = useMemo(() => { const habitsByFrequency = GOAL_FREQUENCIES.filter((frequency) => {
return GOAL_FREQUENCIES.filter((frequency) => { return habitsTracker.habitsHistory[frequency].length > 0
return habitsTracker.habitsHistory[frequency].length > 0 })
})
}, [habitsTracker])
const [accordionExpanded, setAccordionExpanded] = useState<{ const [accordionExpanded, setAccordionExpanded] = useState<{
[key in GoalFrequency]: boolean [key in GoalFrequency]: boolean