refactor: Clean up unused code and improve layout in CompactChoreCard, MyChores, and AddTaskModal components
This commit is contained in:
@@ -464,7 +464,7 @@ const CompactChoreCard = ({
|
|||||||
...sx,
|
...sx,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
px: 1,
|
// px: 1,
|
||||||
// py: 0.75,
|
// py: 0.75,
|
||||||
minHeight: 56, // More compact height
|
minHeight: 56, // More compact height
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -594,11 +594,11 @@ const CompactChoreCard = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
display: 'inline-block',
|
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
// remove any padding or margin:
|
|
||||||
padding: 0,
|
padding: 0,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
}}
|
}}
|
||||||
key={`compact-chorecard-${chore.id}-label-${l.id}`}
|
key={`compact-chorecard-${chore.id}-label-${l.id}`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -721,7 +721,11 @@ const MyChores = () => {
|
|||||||
<AccordionDetails
|
<AccordionDetails
|
||||||
sx={{
|
sx={{
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
my: 0,
|
['& > *']: {
|
||||||
|
// px: 0.5,
|
||||||
|
px: 0.5,
|
||||||
|
// pr: 0,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{section.content?.map(chore => renderChoreCard(chore))}
|
{section.content?.map(chore => renderChoreCard(chore))}
|
||||||
|
|||||||
@@ -20,12 +20,7 @@ import { useCreateChore } from '../../queries/ChoreQueries'
|
|||||||
import { useCircleMembers } from '../../queries/UserQueries'
|
import { useCircleMembers } from '../../queries/UserQueries'
|
||||||
import { isPlusAccount } from '../../utils/Helpers'
|
import { isPlusAccount } from '../../utils/Helpers'
|
||||||
import { useLabels } from '../Labels/LabelQueries'
|
import { useLabels } from '../Labels/LabelQueries'
|
||||||
import {
|
import { parseLabels, parsePriority, parseRepeatV2 } from './CustomParsers'
|
||||||
parseAssignees,
|
|
||||||
parseLabels,
|
|
||||||
parsePriority,
|
|
||||||
parseRepeatV2,
|
|
||||||
} from './CustomParsers'
|
|
||||||
import SmartTaskTitleInput from './SmartTaskTitleInput'
|
import SmartTaskTitleInput from './SmartTaskTitleInput'
|
||||||
|
|
||||||
import LearnMoreButton from './LearnMore'
|
import LearnMoreButton from './LearnMore'
|
||||||
@@ -212,33 +207,32 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
|
|||||||
cleanedSentence = repeat.cleanedSentence
|
cleanedSentence = repeat.cleanedSentence
|
||||||
}
|
}
|
||||||
// Parse assignees using circle members
|
// Parse assignees using circle members
|
||||||
const circleMembersList = circleMembers?.res || []
|
// const circleMembersList = circleMembers?.res || []
|
||||||
const assigneesForParsing = circleMembersList.map(member => ({
|
// const assigneesForParsing = circleMembersList.map(member => ({
|
||||||
userId: member.userId,
|
// userId: member.userId,
|
||||||
username:
|
// username:
|
||||||
member.username ||
|
// member.username ||
|
||||||
member.displayName?.toLowerCase().replace(/\s+/g, ''),
|
// member.displayName?.toLowerCase().replace(/\s+/g, ''),
|
||||||
displayName: member.displayName,
|
// displayName: member.displayName,
|
||||||
name: member.displayName,
|
// name: member.displayName,
|
||||||
id: member.userId,
|
// id: member.userId,
|
||||||
}))
|
// }))
|
||||||
|
|
||||||
const assigneesResult = parseAssignees(sentence, assigneesForParsing)
|
// const assigneesResult = parseAssignees(sentence, assigneesForParsing)
|
||||||
if (assigneesResult.result) {
|
// if (assigneesResult.result) {
|
||||||
cleanedSentence = assigneesResult.cleanedSentence
|
// cleanedSentence = assigneesResult.cleanedSentence
|
||||||
setAssignees(assigneesResult.result)
|
// setAssignees(
|
||||||
} else {
|
// assigneesResult.result.map(assignee => ({
|
||||||
// Default to current user if no assignees parsed
|
// userId: assignee.userId,
|
||||||
setAssignees([
|
// })),
|
||||||
{
|
// )
|
||||||
userId: userProfile.id,
|
// } else {
|
||||||
username: userProfile.username,
|
// setAssignees([
|
||||||
displayName: userProfile.displayName,
|
// {
|
||||||
name: userProfile.displayName,
|
// userId: userProfile.id,
|
||||||
id: userProfile.id,
|
// },
|
||||||
},
|
// ])
|
||||||
])
|
// }
|
||||||
}
|
|
||||||
const parsedDueDate = chrono.parse(sentence, new Date(), {
|
const parsedDueDate = chrono.parse(sentence, new Date(), {
|
||||||
forwardDate: true,
|
forwardDate: true,
|
||||||
})
|
})
|
||||||
@@ -327,7 +321,8 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
|
|||||||
const createChore = () => {
|
const createChore = () => {
|
||||||
const chore = {
|
const chore = {
|
||||||
name: taskTitle,
|
name: taskTitle,
|
||||||
assignees: assignees.map(assignee => ({ userId: assignee.userId })),
|
assignees:
|
||||||
|
assignees.length > 0 ? assignees : [{ userId: userProfile.id }],
|
||||||
dueDate: dueDate ? new Date(dueDate).toISOString() : null,
|
dueDate: dueDate ? new Date(dueDate).toISOString() : null,
|
||||||
assignedTo: assignees.length > 0 ? assignees[0].userId : userProfile.id,
|
assignedTo: assignees.length > 0 ? assignees[0].userId : userProfile.id,
|
||||||
assignStrategy: 'random',
|
assignStrategy: 'random',
|
||||||
@@ -590,7 +585,7 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
|
|||||||
gap: 2,
|
gap: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormControl>
|
{/* <FormControl>
|
||||||
<Typography level='body-sm'>Assignees</Typography>
|
<Typography level='body-sm'>Assignees</Typography>
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
||||||
{assignees.length > 0 ? (
|
{assignees.length > 0 ? (
|
||||||
@@ -598,7 +593,7 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
|
|||||||
<Chip
|
<Chip
|
||||||
key={assignee.userId || index}
|
key={assignee.userId || index}
|
||||||
variant='soft'
|
variant='soft'
|
||||||
size='sm'
|
size='lg'
|
||||||
color='primary'
|
color='primary'
|
||||||
>
|
>
|
||||||
{assignee.displayName || assignee.username}
|
{assignee.displayName || assignee.username}
|
||||||
@@ -610,7 +605,7 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
|
|||||||
</Chip>
|
</Chip>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</FormControl>
|
</FormControl> */}
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Typography level='body-sm'>Frequency</Typography>
|
<Typography level='body-sm'>Frequency</Typography>
|
||||||
<Input value={frequencyHumanReadable || 'Once'} variant='plain' />
|
<Input value={frequencyHumanReadable || 'Once'} variant='plain' />
|
||||||
|
|||||||
Reference in New Issue
Block a user