Refactor frequency handling in ChoreEdit and RepeatSection; add points display in ChoreCard

This commit is contained in:
Mo Tarbin
2025-03-24 01:27:31 -04:00
parent 91cb2106a9
commit c3d0fbaf06
4 changed files with 22 additions and 14 deletions

View File

@@ -528,12 +528,6 @@ const ChoreEdit = () => {
onFrequencyTypeUpdate={setFrequencyType}
frequencyMetadata={frequencyMetadata}
onFrequencyMetadataUpdate={setFrequencyMetadata}
onFrequencyTimeUpdate={t => {
setFrequencyMetadata({
...frequencyMetadata,
time: t,
})
}}
frequencyError={errors?.frequency}
allUserThings={allUserThings}
onTriggerUpdate={thingUpdate => {

View File

@@ -68,7 +68,6 @@ const RepeatOnSections = ({
onFrequencyTypeUpdate,
frequencyMetadata,
onFrequencyMetadataUpdate,
onFrequencyTimeUpdate,
things,
}) => {
const [months, setMonths] = useState({})
@@ -88,12 +87,13 @@ const RepeatOnSections = ({
: '18:00'
}
onChange={e => {
// create new today date with selected time with Timezone:
onFrequencyTimeUpdate(
moment(
onFrequencyMetadataUpdate({
...frequencyMetadata,
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
time: moment(
moment(new Date()).format('YYYY-MM-DD') + 'T' + e.target.value,
).format(),
)
})
}}
/>
</Grid>
@@ -331,7 +331,6 @@ const RepeatSection = ({
onFrequencyTypeUpdate,
frequencyMetadata,
onFrequencyMetadataUpdate,
onFrequencyTimeUpdate,
frequencyError,
allUserThings,
onTriggerUpdate,
@@ -398,6 +397,7 @@ const RepeatSection = ({
'T' +
'18:00',
).format(),
timezone: moment.tz.guess(),
})
return
@@ -520,7 +520,6 @@ const RepeatSection = ({
onFrequencyTypeUpdate={onFrequencyTypeUpdate}
frequencyMetadata={frequencyMetadata || {}}
onFrequencyMetadataUpdate={onFrequencyMetadataUpdate}
onFrequencyTimeUpdate={onFrequencyTimeUpdate}
things={allUserThings}
/>
</Grid>

View File

@@ -19,6 +19,7 @@ import {
Report,
SwitchAccessShortcut,
TimesOneMobiledata,
Toll,
Unarchive,
Update,
ViewCarousel,
@@ -527,6 +528,21 @@ const ChoreCard = ({
P{chore.priority}
</Chip>
)}
{/* show points chip if there is points assigned */}
{chore.points > 0 && (
<Chip
sx={{
position: 'relative',
mr: 0.5,
top: 2,
zIndex: 1,
}}
color='success'
startDecorator={<Toll />}
>
{chore.points}
</Chip>
)}
{chore.labelsV2?.map((l, index) => {
return (
<div

View File

@@ -666,7 +666,6 @@ const MyChores = () => {
if (section.content.length === 0) return null
return (
<Accordion
title={section.name}
key={section.name + index}
sx={{
my: 0,