Skip to content

Commit 74ecd0d

Browse files
author
monster
committed
feat(drag): propagate hideProjectTitle to drag overlay items
This commit ensures that the hideProjectTitle prop is properly passed to project items displayed in the drag overlay. Previously, when dragging desktop project items, the overlay version would not respect the hideProjectTitle setting, causing inconsistent visual behavior between the static list and the drag preview. The changes add a new projectProps interface to DragOverlayItem and pass the hideProjectTitle value through from DesktopProjectList to maintain visual consistency during drag operations.
1 parent a2735fc commit 74ecd0d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/desktop/components/DesktopProjectList/DesktopProjectList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const DesktopProjectList: React.FC<DesktopProjectListProps> = ({
5757
<DesktopProjectListItem hideProjectTitle={hideProjectTitle} key={project.id} project={project} />
5858
))}
5959
</SortableContext>
60-
<DragOverlayItem projectVariant="desktop" />
60+
<DragOverlayItem projectVariant="desktop" projectProps={{ hideProjectTitle }} />
6161
</DndContext>
6262
);
6363
};

src/desktop/components/drag/DragOverlayItem.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,21 @@ interface TaskProps {
2121
hideProjectTitle: boolean;
2222
}
2323

24+
interface ProjectProps {
25+
hideProjectTitle?: boolean;
26+
}
27+
2428
export interface DragOverlayItemProps {
2529
isSubtask?: boolean;
2630
taskProps?: TaskProps;
2731
projectVariant?: 'sidebar' | 'desktop';
32+
projectProps?: ProjectProps;
2833
}
2934

3035
export const DragOverlayItem: React.FC<DragOverlayItemProps> = ({
3136
isSubtask,
3237
taskProps,
38+
projectProps,
3339
projectVariant = 'sidebar',
3440
}) => {
3541
const { active } = useDndContext();
@@ -74,15 +80,15 @@ export const DragOverlayItem: React.FC<DragOverlayItemProps> = ({
7480
case 'project': {
7581
const projectInfo = getProject(modelState, activeId as string);
7682
return projectVariant === 'desktop' ? (
77-
<DesktopProjectListItem project={projectInfo} />
83+
<DesktopProjectListItem project={projectInfo} hideProjectTitle={projectProps?.hideProjectTitle} />
7884
) : (
7985
<SidebarProjectItem projectInfo={projectInfo} />
8086
);
8187
}
8288
default:
8389
return null;
8490
}
85-
}, [activeId, modelState, isSubtask, taskProps, projectVariant]);
91+
}, [activeId, modelState, isSubtask, taskProps, projectVariant, projectProps]);
8692

8793
return (
8894
<DragOverlay>

0 commit comments

Comments
 (0)