Skip to content

Commit d467e78

Browse files
committed
#4020 making it worse before I can make it better
1 parent ab56018 commit d467e78

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/v2/TaskColumn.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const TaskColumn = ({
1414
tasks,
1515
project,
1616
equalizedHeight,
17+
isDragging,
1718
onEditTask,
1819
onDeleteTask,
1920
onAddTask,
@@ -23,6 +24,7 @@ export const TaskColumn = ({
2324
tasks: TaskWithIndex[];
2425
project: Project;
2526
equalizedHeight: number;
27+
isDragging: boolean;
2628
onEditTask: (task: Task) => void;
2729
onDeleteTask: (taskId: string) => void;
2830
onAddTask: (task: Task) => void;
@@ -41,7 +43,6 @@ export const TaskColumn = ({
4143
if (!droppableBoxRef.current) return;
4244

4345
const droppableBox = droppableBoxRef.current;
44-
4546
const observer = new ResizeObserver(() => {
4647
onHeightChange(status, droppableBox.scrollHeight);
4748
});
@@ -108,7 +109,7 @@ export const TaskColumn = ({
108109
flexDirection: 'column',
109110
borderRadius: 5,
110111
padding: '5px',
111-
minHeight: `${equalizedHeight}px`,
112+
minHeight: isDragging ? `${equalizedHeight}px` : undefined,
112113
'&.isDraggingOver': {
113114
bgcolor: '#dadadf'
114115
}

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/v2/TaskListContent.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DragDropContext, OnDragEndResponder } from '@hello-pangea/dnd';
1+
import { DragDropContext, OnDragEndResponder, OnDragStartResponder } from '@hello-pangea/dnd';
22
import { Box } from '@mui/material';
33
import { useCallback, useRef, useState } from 'react';
44
import { Project, Task, TaskWithIndex } from 'shared';
@@ -22,6 +22,7 @@ export const TaskListContent = ({ project }: TaskListProps) => {
2222
// ref to mapping of each column's status to its measured height, partial because heights may not exist
2323
const columnHeightsRef = useRef<Partial<Record<Task['status'], number>>>({});
2424
const [equalizedHeight, setEqualizedHeight] = useState(0);
25+
const [isDragging, setIsDragging] = useState(false);
2526

2627
const onHeightChange = useCallback((status: Task['status'], height: number) => {
2728
columnHeightsRef.current[status] = height;
@@ -64,7 +65,12 @@ export const TaskListContent = ({ project }: TaskListProps) => {
6465
}));
6566
};
6667

68+
const onDragStart: OnDragStartResponder = () => {
69+
setIsDragging(true);
70+
}
71+
6772
const onDragEnd: OnDragEndResponder = async (result) => {
73+
setIsDragging(false);
6874
const { destination, source } = result;
6975

7076
if (!destination) {
@@ -120,7 +126,7 @@ export const TaskListContent = ({ project }: TaskListProps) => {
120126
};
121127

122128
return (
123-
<DragDropContext onDragEnd={onDragEnd}>
129+
<DragDropContext onDragStart={onDragStart} onDragEnd={onDragEnd}>
124130
<Box display="flex">
125131
{statuses.map((status) => (
126132
<TaskColumn
@@ -133,6 +139,7 @@ export const TaskListContent = ({ project }: TaskListProps) => {
133139
key={status}
134140
project={project}
135141
equalizedHeight={equalizedHeight}
142+
isDragging={isDragging}
136143
/>
137144
))}
138145
</Box>

0 commit comments

Comments
 (0)