fix: update CompleteSubTask parameter name and adjust body payload; enhance Sidepanel layout and restore ActivitiesCard position; modify WelcomeCard styles for improved UI consistency

This commit is contained in:
Mo Tarbin
2025-05-29 01:02:12 -04:00
parent 1f2d38730d
commit 97abf2f230
4 changed files with 19 additions and 9 deletions

View File

@@ -123,12 +123,12 @@ const MarkChoreComplete = (id, body, completedDate, performer) => {
})
}
const CompleteSubTask = (id, choreId, completedAt) => {
const CompleteSubTask = (id, choreId, performedAt) => {
var markChoreURL = `/chores/${choreId}/subtask`
return Fetch(markChoreURL, {
method: 'PUT',
headers: HEADERS(),
body: JSON.stringify({ completedAt, id, choreId }),
body: JSON.stringify({ performedAt, id, choreId }),
})
}

View File

@@ -17,7 +17,7 @@ import {
Typography,
} from '@mui/joy'
import moment from 'moment'
import { useContext, useState } from 'react'
import { useContext, useEffect, useState } from 'react'
import { UserContext } from '../../contexts/UserContext'
import { isPlusAccount } from '../../utils/Helpers'
import ThingTriggerSection from './ThingTriggerSection'
@@ -71,6 +71,16 @@ const RepeatOnSections = ({
things,
}) => {
const [intervalUnit, setIntervalUnit] = useState('days')
// if time on frequencyMetadata is not set, try to set it to the nextDueDate if available,
// otherwise set it to 18:00 of the current day
useEffect(() => {
if (!frequencyMetadata?.time) {
frequencyMetadata.time = moment(
moment(new Date()).format('YYYY-MM-DD') + 'T' + '18:00',
).format()
}
}, [])
const timePickerComponent = (
<Grid item sm={12} sx={{ display: 'flex', alignItems: 'center' }}>
<Typography level='h5'>At: </Typography>

View File

@@ -40,10 +40,10 @@ const Sidepanel = ({ chores }) => {
return (
<Box>
<WelcomeCard chores={chores} />
<ActivitiesCard chores={chores} choreHistory={choresHistory} />
<Sheet
variant='plain'
sx={{
my: 1,
p: 2,
display: 'flex',
flexDirection: 'column',
@@ -52,14 +52,14 @@ const Sidepanel = ({ chores }) => {
justifyContent: 'space-between',
boxShadow: 'sm',
borderRadius: 20,
height: '80vh',
width: '315px',
}}
>
<Box sx={{ width: '100%' }}>
<Box sx={{ width: '100%', overflowY: 'hidden' }}>
<CalendarView chores={chores} />
</Box>
</Sheet>
<ActivitiesCard chores={chores} choreHistory={choresHistory} />
</Box>
)
}

View File

@@ -62,7 +62,7 @@ const WelcomeCard = () => {
gap: 1,
}}
>
<Person color='primary' />
<Person color='' />
<Typography level='title-md'>Current User</Typography>
</Box>
</Box>
@@ -105,7 +105,7 @@ const WelcomeCard = () => {
justifyContent: 'space-between',
boxShadow: 'sm',
borderRadius: 20,
width: '290px',
width: '310px',
mb: 1,
}}
>
@@ -127,7 +127,7 @@ const WelcomeCard = () => {
gap: 1,
}}
>
<Person color='primary' />
<Person color='' />
<Typography level='title-md'>Current User</Typography>
</Box>
</Box>