Merge branch 'fix/FirstAdd' into 'develop'

fix: first add in daily, weekly or monthly

See merge request rrll/p61-project!3
This commit is contained in:
RICHARD MAXIME 2024-04-05 12:48:57 +00:00
commit a5de568bf4

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