diff options
author | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-18 18:06:04 -0400 |
---|---|---|
committer | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-18 18:06:04 -0400 |
commit | 7991399bef62a0c13178ccca3e7cbd0da768455f (patch) | |
tree | 4695e14563e16384d8ec0d23d83e3d23f76acbd6 | |
parent | 9146e6d192f8526b14b3919f4b25794075105d6a (diff) | |
download | donetick-frontend-7991399bef62a0c13178ccca3e7cbd0da768455f.tar.gz donetick-frontend-7991399bef62a0c13178ccca3e7cbd0da768455f.tar.bz2 donetick-frontend-7991399bef62a0c13178ccca3e7cbd0da768455f.zip |
Improve frequency metadata update
-rw-r--r-- | src/views/ChoreEdit/RepeatSection.jsx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/views/ChoreEdit/RepeatSection.jsx b/src/views/ChoreEdit/RepeatSection.jsx index bdf6738..94d16c8 100644 --- a/src/views/ChoreEdit/RepeatSection.jsx +++ b/src/views/ChoreEdit/RepeatSection.jsx @@ -116,6 +116,7 @@ const RepeatOnSections = ({ onClick={() => { setIntervalUnit(item) onFrequencyMetadataUpdate({ + ...frequencyMetadata, unit: item, }) }} @@ -167,6 +168,7 @@ const RepeatOnSections = ({ } onFrequencyMetadataUpdate({ + ...frequencyMetadata, days: newDaysOfTheWeek.sort(), }) }} @@ -247,6 +249,7 @@ const RepeatOnSections = ({ } onFrequencyMetadataUpdate({ + ...frequencyMetadata, months: newMonthsOfTheYear.sort(), }) console.log('newMonthsOfTheYear', newMonthsOfTheYear) @@ -363,7 +366,15 @@ const RepeatSection = ({ onFrequencyUpdate(1) onFrequencyMetadataUpdate({ unit: 'days', + time: frequencyMetadata?.time + ? frequencyMetadata?.time + : moment( + moment(new Date()).format('YYYY-MM-DD') + + 'T' + + '18:00', + ).format(), }) + return } onFrequencyTypeUpdate(item) @@ -419,11 +430,20 @@ const RepeatSection = ({ } onFrequencyTypeUpdate(item) if (item === 'days_of_the_week') { - onFrequencyMetadataUpdate({ days: [] }) + onFrequencyMetadataUpdate({ + ...frequencyMetadata, + days: [], + }) } else if (item === 'day_of_the_month') { - onFrequencyMetadataUpdate({ months: [] }) + onFrequencyMetadataUpdate({ + ...frequencyMetadata, + months: [], + }) } else if (item === 'interval') { - onFrequencyMetadataUpdate({ unit: 'days' }) + onFrequencyMetadataUpdate({ + ...frequencyMetadata, + unit: 'days', + }) } // setRepeatOn(item) }} |