diff --git a/src/views/Chores/ChoreCard.jsx b/src/views/Chores/ChoreCard.jsx
index 64a5da2..4a9dc56 100644
--- a/src/views/Chores/ChoreCard.jsx
+++ b/src/views/Chores/ChoreCard.jsx
@@ -532,15 +532,17 @@ const ChoreCard = ({
{getName(chore.name)}
{userProfile && chore.assignedTo !== userProfile.id && (
-
- Assigned to{' '}
+
+
+ Assigned to
+
{
performers.find(p => p.id === chore.assignedTo)
?.displayName
}
-
+
)}
{chore.priority > 0 && (
diff --git a/src/views/Chores/CompactChoreCard.jsx b/src/views/Chores/CompactChoreCard.jsx
index ed4a4ec..78063bd 100644
--- a/src/views/Chores/CompactChoreCard.jsx
+++ b/src/views/Chores/CompactChoreCard.jsx
@@ -464,7 +464,7 @@ const CompactChoreCard = ({
...sx,
display: 'flex',
alignItems: 'center',
- px: 1,
+ // px: 1,
// py: 0.75,
minHeight: 56, // More compact height
cursor: 'pointer',
@@ -594,11 +594,11 @@ const CompactChoreCard = ({
}
}}
style={{
- display: 'inline-block',
cursor: 'pointer',
- // remove any padding or margin:
padding: 0,
margin: 0,
+ display: 'flex',
+ alignItems: 'center',
}}
key={`compact-chorecard-${chore.id}-label-${l.id}`}
>
diff --git a/src/views/Chores/MyChores.jsx b/src/views/Chores/MyChores.jsx
index d095e8f..e9dc758 100644
--- a/src/views/Chores/MyChores.jsx
+++ b/src/views/Chores/MyChores.jsx
@@ -34,12 +34,7 @@ import { useContext, useEffect, useRef, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { UserContext } from '../../contexts/UserContext'
import { useChores } from '../../queries/ChoreQueries'
-import {
- GetAllUsers,
- GetArchivedChores,
- GetChores,
- GetUserProfile,
-} from '../../utils/Fetcher'
+import { GetArchivedChores } from '../../utils/Fetcher'
import Priorities from '../../utils/Priorities'
import LoadingComponent from '../components/Loading'
import { useLabels } from '../Labels/LabelQueries'
@@ -47,6 +42,7 @@ import ChoreCard from './ChoreCard'
import CompactChoreCard from './CompactChoreCard'
import IconButtonWithMenu from './IconButtonWithMenu'
+import { useCircleMembers } from '../../queries/UserQueries'
import { ChoreFilters, ChoresGrouper, ChoreSorter } from '../../utils/Chores'
import TaskInput from '../components/AddTaskModal'
import {
@@ -95,58 +91,11 @@ const MyChores = () => {
isLoading: choresLoading,
refetch: refetchChores,
} = useChores()
+ const { data: membersData, isLoading: membersLoading } = useCircleMembers()
useEffect(() => {
- Promise.all([GetChores(), GetAllUsers(), GetUserProfile()]).then(
- responses => {
- const [choresResponse, usersResponse, userProfileResponse] = responses
- if (!choresResponse.ok) {
- throw new Error(choresResponse.statusText)
- }
- if (!usersResponse.ok) {
- throw new Error(usersResponse.statusText)
- }
- if (!userProfileResponse.ok) {
- throw new Error(userProfileResponse.statusText)
- }
- Promise.all([
- userProfileResponse.json(),
- choresResponse.json(),
- usersResponse.json(),
- ]).then(data => {
- const [userProfileData, choresData, usersData] = data
- setUserProfile(userProfileData.res)
- setChores(choresData.res)
- setFilteredChores(choresData.res)
- setPerformers(usersData.res)
- if (canScheduleNotification()) {
- scheduleChoreNotification(
- choresData.res,
- userProfileData.res,
- usersData.res,
- )
- }
- })
- },
- )
-
- // GetAllUsers()
- // .then(response => response.json())
- // .then(data => {
- // setPerformers(data.res)
- // })
- // GetUserProfile().then(response => response.json()).then(data => {
- // setUserProfile(data.res)
- // })
-
- // const currentUser = JSON.parse(localStorage.getItem('user'))
- // if (currentUser !== null) {
- // setActiveUserId(currentUser.id)
- // }
- }, [])
-
- useEffect(() => {
- if (choresData) {
+ if (!choresLoading && !membersLoading && userProfile) {
+ setPerformers(membersData.res)
const sortedChores = choresData.res.sort(ChoreSorter)
setChores(sortedChores)
setFilteredChores(sortedChores)
@@ -165,8 +114,12 @@ const MyChores = () => {
}, {}),
)
}
+
+ if (canScheduleNotification()) {
+ scheduleChoreNotification(choresData.res, userProfile, membersData.res)
+ }
}
- }, [choresData, choresLoading])
+ }, [membersLoading, choresLoading, userProfile])
useEffect(() => {
document.addEventListener('mousedown', handleMenuOutsideClick)
@@ -768,7 +721,11 @@ const MyChores = () => {
*']: {
+ // px: 0.5,
+ px: 0.5,
+ // pr: 0,
+ },
}}
>
{section.content?.map(chore => renderChoreCard(chore))}
diff --git a/src/views/Chores/WelcomeCard.jsx b/src/views/Chores/WelcomeCard.jsx
index d527f81..ceff6d5 100644
--- a/src/views/Chores/WelcomeCard.jsx
+++ b/src/views/Chores/WelcomeCard.jsx
@@ -23,11 +23,6 @@ const WelcomeCard = () => {
member.userId === userProfile?.id &&
(member.role === 'admin' || member.role === 'manager'),
)
- members.forEach(m =>
- console.log('Member:', userProfile?.id, m.id, m.role),
- )
- console.log('Circle Members:', members)
- console.log(isUserAdmin)
setIsAdmin(isUserAdmin)
}
diff --git a/src/views/components/AddTaskModal.jsx b/src/views/components/AddTaskModal.jsx
index 7c4afdf..55d6f38 100644
--- a/src/views/components/AddTaskModal.jsx
+++ b/src/views/components/AddTaskModal.jsx
@@ -20,12 +20,7 @@ import { useCreateChore } from '../../queries/ChoreQueries'
import { useCircleMembers } from '../../queries/UserQueries'
import { isPlusAccount } from '../../utils/Helpers'
import { useLabels } from '../Labels/LabelQueries'
-import {
- parseAssignees,
- parseLabels,
- parsePriority,
- parseRepeatV2,
-} from './CustomParsers'
+import { parseLabels, parsePriority, parseRepeatV2 } from './CustomParsers'
import SmartTaskTitleInput from './SmartTaskTitleInput'
import LearnMoreButton from './LearnMore'
@@ -212,33 +207,32 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
cleanedSentence = repeat.cleanedSentence
}
// Parse assignees using circle members
- const circleMembersList = circleMembers?.res || []
- const assigneesForParsing = circleMembersList.map(member => ({
- userId: member.userId,
- username:
- member.username ||
- member.displayName?.toLowerCase().replace(/\s+/g, ''),
- displayName: member.displayName,
- name: member.displayName,
- id: member.userId,
- }))
+ // const circleMembersList = circleMembers?.res || []
+ // const assigneesForParsing = circleMembersList.map(member => ({
+ // userId: member.userId,
+ // username:
+ // member.username ||
+ // member.displayName?.toLowerCase().replace(/\s+/g, ''),
+ // displayName: member.displayName,
+ // name: member.displayName,
+ // id: member.userId,
+ // }))
- const assigneesResult = parseAssignees(sentence, assigneesForParsing)
- if (assigneesResult.result) {
- cleanedSentence = assigneesResult.cleanedSentence
- setAssignees(assigneesResult.result)
- } else {
- // Default to current user if no assignees parsed
- setAssignees([
- {
- userId: userProfile.id,
- username: userProfile.username,
- displayName: userProfile.displayName,
- name: userProfile.displayName,
- id: userProfile.id,
- },
- ])
- }
+ // const assigneesResult = parseAssignees(sentence, assigneesForParsing)
+ // if (assigneesResult.result) {
+ // cleanedSentence = assigneesResult.cleanedSentence
+ // setAssignees(
+ // assigneesResult.result.map(assignee => ({
+ // userId: assignee.userId,
+ // })),
+ // )
+ // } else {
+ // setAssignees([
+ // {
+ // userId: userProfile.id,
+ // },
+ // ])
+ // }
const parsedDueDate = chrono.parse(sentence, new Date(), {
forwardDate: true,
})
@@ -327,7 +321,8 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
const createChore = () => {
const chore = {
name: taskTitle,
- assignees: assignees.map(assignee => ({ userId: assignee.userId })),
+ assignees:
+ assignees.length > 0 ? assignees : [{ userId: userProfile.id }],
dueDate: dueDate ? new Date(dueDate).toISOString() : null,
assignedTo: assignees.length > 0 ? assignees[0].userId : userProfile.id,
assignStrategy: 'random',
@@ -590,7 +585,7 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
gap: 2,
}}
>
-
+ {/*
Assignees
{assignees.length > 0 ? (
@@ -598,7 +593,7 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
{assignee.displayName || assignee.username}
@@ -610,7 +605,7 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
)}
-
+ */}
Frequency