diff --git a/frontend/components/Project/ProjectDetails.tsx b/frontend/components/Project/ProjectDetails.tsx index aab3c8c..944dc0b 100644 --- a/frontend/components/Project/ProjectDetails.tsx +++ b/frontend/components/Project/ProjectDetails.tsx @@ -45,7 +45,9 @@ const ProjectDetails: React.FC = () => { // Using local state to avoid infinite loops const areas = useStore((state) => state.areasStore.areas); - const { projects: allProjects, setProjects } = useStore((state) => state.projectsStore); + const { projects: allProjects, setProjects } = useStore( + (state) => state.projectsStore + ); const [project, setProject] = useState(null); const [tasks, setTasks] = useState([]); const [notes, setNotes] = useState([]); @@ -258,7 +260,7 @@ const ProjectDetails: React.FC = () => { } const savedTask = await response.json(); - + // If the task's project was changed/cleared and no longer belongs to this project, remove it if (savedTask.project_id !== project?.id) { setTasks(tasks.filter((task) => task.id !== updatedTask.id)); diff --git a/frontend/components/Shared/PriorityDropdown.tsx b/frontend/components/Shared/PriorityDropdown.tsx index 47e6c7a..33487f3 100644 --- a/frontend/components/Shared/PriorityDropdown.tsx +++ b/frontend/components/Shared/PriorityDropdown.tsx @@ -101,7 +101,12 @@ const PriorityDropdown: React.FC = ({ }; }, [isOpen]); - const selectedPriority = priorities.find((p) => p.value === value); + // Convert numeric priority to string if needed + const normalizedValue = typeof value === 'number' + ? ['low', 'medium', 'high'][value] || 'medium' + : value; + + const selectedPriority = priorities.find((p) => p.value === normalizedValue); return (
= ({ const [expandedSections, setExpandedSections] = useState({ tags: false, project: false, - metadata: false, + priority: false, + dueDate: false, recurrence: false, subtasks: false, }); @@ -321,11 +325,12 @@ const TaskModal: React.FC = ({ // If project name is empty, clear the project_id const finalFormData = { ...formData, - project_id: newProjectName.trim() === '' ? null : formData.project_id, + project_id: + newProjectName.trim() === '' ? null : formData.project_id, tags: tags.map((tag) => ({ name: tag })), subtasks: subtasks, }; - + onSave(finalFormData as any); const taskLink = ( @@ -576,58 +581,46 @@ const TaskModal: React.FC = ({
)} - {expandedSections.metadata && ( -
+ {expandedSections.priority && ( +

- {t( - 'forms.task.statusAndOptions', - 'Status & Options' - )} + {t('forms.task.labels.priority', 'Priority')}

- { - // Universal rule: when setting status to in_progress, also add to today - const updatedData = - { - ...formData, - status: value, - }; - if ( - value === - 'in_progress' - ) { - updatedData.today = true; - } - setFormData( - updatedData - ); - }} - onPriorityChange={( - value: PriorityType - ) => + setFormData({ ...formData, - priority: - value, + priority: value, }) } - onDueDateChange={ - handleChange - } />
)} + {expandedSections.dueDate && ( +
+

+ {t('forms.task.labels.dueDate', 'Due Date')} +

+
+ { + const event = { + target: { name: 'due_date', value }, + } as React.ChangeEvent; + handleChange(event); + }} + placeholder={t( + 'forms.task.dueDatePlaceholder', + 'Select due date' + )} + /> +
+
+ )} + {expandedSections.recurrence && (

@@ -769,28 +762,44 @@ const TaskModal: React.FC = ({ )} - {/* Status & Options Toggle */} + {/* Priority Toggle */} + + {/* Due Date Toggle */} +