feat(task-management): integrate real-time updates and enhance task row components

- Added useTaskSocketHandlers to TaskListV2 for real-time task updates.
- Updated TaskRow to accept projectId prop for better context handling.
- Replaced static status and priority displays with TaskStatusDropdown and TaskPriorityDropdown for improved interactivity.
- Enhanced dropdown positioning logic in TaskStatusDropdown and TaskPriorityDropdown to handle scrollable containers effectively.
This commit is contained in:
chamikaJ
2025-07-03 20:02:00 +05:30
parent 6bf98b787e
commit 551924c384
4 changed files with 39 additions and 19 deletions

View File

@@ -66,11 +66,18 @@ const TaskPriorityDropdown: React.FC<TaskPriorityDropdownProps> = ({
};
if (isOpen && buttonRef.current) {
// Calculate position
// Calculate position with better handling of scrollable containers
const rect = buttonRef.current.getBoundingClientRect();
const viewportHeight = window.innerHeight;
const dropdownHeight = 200; // Estimated dropdown height
// Check if dropdown would go below viewport
const spaceBelow = viewportHeight - rect.bottom;
const shouldShowAbove = spaceBelow < dropdownHeight && rect.top > dropdownHeight;
setDropdownPosition({
top: rect.bottom + window.scrollY + 4,
left: rect.left + window.scrollX,
top: shouldShowAbove ? rect.top - dropdownHeight - 4 : rect.bottom + 4,
left: rect.left,
});
document.addEventListener('mousedown', handleClickOutside);

View File

@@ -73,11 +73,18 @@ const TaskStatusDropdown: React.FC<TaskStatusDropdownProps> = ({
};
if (isOpen && buttonRef.current) {
// Calculate position
// Calculate position with better handling of scrollable containers
const rect = buttonRef.current.getBoundingClientRect();
const viewportHeight = window.innerHeight;
const dropdownHeight = 200; // Estimated dropdown height
// Check if dropdown would go below viewport
const spaceBelow = viewportHeight - rect.bottom;
const shouldShowAbove = spaceBelow < dropdownHeight && rect.top > dropdownHeight;
setDropdownPosition({
top: rect.bottom + window.scrollY + 4,
left: rect.left + window.scrollX,
top: shouldShowAbove ? rect.top - dropdownHeight - 4 : rect.bottom + 4,
left: rect.left,
});
document.addEventListener('mousedown', handleClickOutside);