diff --git a/client/src/App.js b/client/src/App.js index 6e91c87..2738b06 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -196,7 +196,8 @@ const addTask = async (taskData) => { const newTasks = tasksToAdd.map(task => ({ ...task, id: uuidv4(), - createdAt: new Date().toISOString() + createdAt: new Date().toISOString(), + label: task.label || null })); const updatedTasks = [...tasks, ...newTasks]; diff --git a/client/src/components/Modal Management/Form.js b/client/src/components/Modal Management/Form.js index 7f2f479..8588510 100644 --- a/client/src/components/Modal Management/Form.js +++ b/client/src/components/Modal Management/Form.js @@ -10,9 +10,12 @@ const TaskForm = ({ addTask }) => { difficulty: 50, importance: 50, deadline: '', - collaborative: false + collaborative: false, + label: '' }; + const MAX_LABEL_LENGTH = 15; + const [formState, setFormState] = useState(defaultFormState); const [selectedDeadline, setSelectedDeadline] = useState(null); const [isProjectView, setIsProjectView] = useState(false); @@ -43,6 +46,7 @@ const TaskForm = ({ addTask }) => { importance: formState.importance, deadline: formState.deadline || null, collaborative: formState.collaborative, + label: formState.label || null, experience: ( (parseInt(formState.difficulty) + parseInt(formState.importance) + 20) * 5 + parseInt(parseInt(formState.difficulty) * parseInt(formState.importance) / 20) + @@ -413,6 +417,37 @@ const TaskForm = ({ addTask }) => { /> + {/* Label Input */} +
+ +
+ { + const newValue = e.target.value.slice(0, MAX_LABEL_LENGTH); + updateFormState('label', newValue); + }} + maxLength={MAX_LABEL_LENGTH} + className="w-full px-4 py-2 bg-white dark:bg-gray-700 border border-gray-300 + dark:border-gray-600 rounded-lg text-gray-900 dark:text-gray-200 + placeholder-gray-500 dark:placeholder-gray-400" + /> + {formState.label && ( +
+ + {formState.label} + +
+ )} +
+
+ {/* Description section */}
- +
+ {/* Sort Dropdown */} +
+ +
+ + {/* Calendar/List View Toggle */} + +
) : ( diff --git a/client/src/components/Modal Management/View.js b/client/src/components/Modal Management/View.js index 008a61f..e58db33 100644 --- a/client/src/components/Modal Management/View.js +++ b/client/src/components/Modal Management/View.js @@ -108,20 +108,31 @@ const Task = ({ task, removeTask, completeTask, isCompleted, updateTask }) => { /> ) : ( - - {task.name} - {task.subtasks && ( - + {task.name} +
+ {task.subtasks && ( + - Project - - )} - {!isCompleted && task.deadline && isOverdue(task.deadline) && ( - - OVERDUE ({calculateOverduePenalty(task.deadline)} XP) - - )} + border-blue-200 dark:border-blue-800 whitespace-nowrap"> + Project + + )} + {task.label && ( + + {task.label} + + )} + {!isCompleted && task.deadline && isOverdue(task.deadline) && ( + + OVERDUE ({calculateOverduePenalty(task.deadline)} XP) + + )} +
)}