diff --git a/components/pages/todos/AddChoreDialog.tsx b/components/pages/todos/AddChoreDialog.tsx index 30bfaa7..0a05bd9 100644 --- a/components/pages/todos/AddChoreDialog.tsx +++ b/components/pages/todos/AddChoreDialog.tsx @@ -123,7 +123,8 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => { updateToDo({ ...todo, points: points, - assignees: selectedAssignees + assignees: selectedAssignees, + repeatDays: selectedDays, }); } else { addToDo({ @@ -213,7 +214,7 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => { ))} - {todo.repeatType == "Every week" && } + {todo.repeatType == "Every week" && } diff --git a/components/pages/todos/RepeatFreq.tsx b/components/pages/todos/RepeatFreq.tsx index a7b9354..068c303 100644 --- a/components/pages/todos/RepeatFreq.tsx +++ b/components/pages/todos/RepeatFreq.tsx @@ -2,7 +2,7 @@ import { View, Text, TouchableOpacity, Picker } from "react-native-ui-lib"; import React, { useEffect, useState } from "react"; import {DAYS_OF_WEEK_ENUM} from "@/hooks/firebase/types/todoData"; -const RepeatFreq = ({ handleRepeatDaysChange }: { handleRepeatDaysChange: Function }) => { +const RepeatFreq = ({ repeatDays, handleRepeatDaysChange }: { repeatDays: string[], handleRepeatDaysChange: Function }) => { const [weeks, setWeeks] = useState(1); const weekOptions: number[] = Array.from({ length: 52 }, (_, i) => i + 1); @@ -10,21 +10,21 @@ const RepeatFreq = ({ handleRepeatDaysChange }: { handleRepeatDaysChange: Functi return ( - - - - - - - + + + + + + + ); }; export default RepeatFreq; -const RepeatOption = ({ value, handleRepeatDaysChange }: { value: string, handleRepeatDaysChange: Function }) => { - const [isSet, setisSet] = useState(false); +const RepeatOption = ({ value, handleRepeatDaysChange, repeatDays }: { value: string, handleRepeatDaysChange: Function, repeatDays: string[] }) => { + const [isSet, setisSet] = useState(repeatDays.includes(value)); useEffect(() => { handleRepeatDaysChange(value, isSet);