mirror of
				https://github.com/lingble/twenty.git
				synced 2025-10-31 12:47:58 +00:00 
			
		
		
		
	This PR addresses issue #7333. It updates the condition for displaying the 'Add task' button. The button is now only visible for the 'TODO' section or when no 'TODO' block is present (i.e., there are no tasks in this category). Additionally, I removed the unused showAddButton, which is no longer necessary due to the updated logic.   --------- Co-authored-by: Nitin Koche <nitinkoche03@gmail.com>
This commit is contained in:
		| @@ -20,7 +20,7 @@ export const ObjectTasks = ({ | ||||
|   return ( | ||||
|     <StyledContainer> | ||||
|       <ObjectFilterDropdownScope filterScopeId="entity-tasks-filter-scope"> | ||||
|         <TaskGroups targetableObjects={[targetableObject]} showAddButton /> | ||||
|         <TaskGroups targetableObjects={[targetableObject]} /> | ||||
|       </ObjectFilterDropdownScope> | ||||
|     </StyledContainer> | ||||
|   ); | ||||
|   | ||||
| @@ -32,13 +32,9 @@ const StyledContainer = styled.div` | ||||
| type TaskGroupsProps = { | ||||
|   filterDropdownId?: string; | ||||
|   targetableObjects?: ActivityTargetableObject[]; | ||||
|   showAddButton?: boolean; | ||||
| }; | ||||
|  | ||||
| export const TaskGroups = ({ | ||||
|   targetableObjects, | ||||
|   showAddButton, | ||||
| }: TaskGroupsProps) => { | ||||
| export const TaskGroups = ({ targetableObjects }: TaskGroupsProps) => { | ||||
|   const { tasks, tasksLoading } = useTasks({ | ||||
|     targetableObjects: targetableObjects ?? [], | ||||
|   }); | ||||
| @@ -93,7 +89,11 @@ export const TaskGroups = ({ | ||||
|  | ||||
|   const sortedTasksByStatus = Object.entries( | ||||
|     groupBy(tasks, ({ status }) => status), | ||||
|   ).toSorted(([statusA], [statusB]) => statusB.localeCompare(statusA)); | ||||
|   ).sort(([statusA], [statusB]) => statusB.localeCompare(statusA)); | ||||
|  | ||||
|   const hasTodoStatus = sortedTasksByStatus.some( | ||||
|     ([status]) => status === 'TODO', | ||||
|   ); | ||||
|  | ||||
|   return ( | ||||
|     <StyledContainer> | ||||
| @@ -103,7 +103,7 @@ export const TaskGroups = ({ | ||||
|           title={status} | ||||
|           tasks={tasksByStatus} | ||||
|           button={ | ||||
|             showAddButton && ( | ||||
|             (status === 'TODO' || !hasTodoStatus) && ( | ||||
|               <AddTaskButton activityTargetableObjects={targetableObjects} /> | ||||
|             ) | ||||
|           } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yura Levchenko
					Yura Levchenko