diff --git a/web/core/components/cycles/gantt-chart/blocks.tsx b/web/core/components/cycles/gantt-chart/blocks.tsx index 20c5cd4c6..3d312d3fe 100644 --- a/web/core/components/cycles/gantt-chart/blocks.tsx +++ b/web/core/components/cycles/gantt-chart/blocks.tsx @@ -78,6 +78,7 @@ export const CycleGanttSidebarBlock: React.FC = observer((props) => { = observer((props) => { cycleStatus === "current" ? "#09a953" : cycleStatus === "upcoming" - ? "#f7ae59" - : cycleStatus === "completed" - ? "#3f76ff" - : cycleStatus === "draft" - ? "rgb(var(--color-text-200))" - : "" + ? "#f7ae59" + : cycleStatus === "completed" + ? "#3f76ff" + : cycleStatus === "draft" + ? "rgb(var(--color-text-200))" + : "" }`} />
{cycleDetails?.name}
diff --git a/web/core/components/gantt-chart/sidebar/cycles/block.tsx b/web/core/components/gantt-chart/sidebar/cycles/block.tsx index 7922e86a6..8247dcacf 100644 --- a/web/core/components/gantt-chart/sidebar/cycles/block.tsx +++ b/web/core/components/gantt-chart/sidebar/cycles/block.tsx @@ -15,13 +15,11 @@ import { findTotalDaysInRange } from "@/helpers/date-time.helper"; type Props = { block: IGanttBlock; - enableReorder: boolean; isDragging: boolean; - dragHandleRef: MutableRefObject; }; export const CyclesSidebarBlock: React.FC = observer((props) => { - const { block, enableReorder, isDragging, dragHandleRef } = props; + const { block, isDragging } = props; // store hooks const { updateActiveBlockId, isBlockActive } = useGanttChart(); @@ -44,16 +42,6 @@ export const CyclesSidebarBlock: React.FC = observer((props) => { height: `${BLOCK_HEIGHT}px`, }} > - {enableReorder && ( - - )}
diff --git a/web/core/components/gantt-chart/sidebar/cycles/sidebar.tsx b/web/core/components/gantt-chart/sidebar/cycles/sidebar.tsx index 1f1497dd4..4df76eb46 100644 --- a/web/core/components/gantt-chart/sidebar/cycles/sidebar.tsx +++ b/web/core/components/gantt-chart/sidebar/cycles/sidebar.tsx @@ -43,12 +43,10 @@ export const CycleGanttSidebar: React.FC = (props) => { isDragEnabled={enableReorder} onDrop={handleOnDrop} > - {(isDragging: boolean, dragHandleRef: MutableRefObject) => ( + {(isDragging: boolean) => ( )} diff --git a/web/core/components/gantt-chart/sidebar/gantt-dnd-HOC.tsx b/web/core/components/gantt-chart/sidebar/gantt-dnd-HOC.tsx index d4f89eafe..eff7dcc56 100644 --- a/web/core/components/gantt-chart/sidebar/gantt-dnd-HOC.tsx +++ b/web/core/components/gantt-chart/sidebar/gantt-dnd-HOC.tsx @@ -5,7 +5,7 @@ import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine"; import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter"; import { attachInstruction, extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item"; import { observer } from "mobx-react"; -import { DropIndicator } from "@plane/ui"; +import { DropIndicator, TOAST_TYPE, setToast } from "@plane/ui"; import { HIGHLIGHT_WITH_LINE, highlightIssueOnDrop } from "@/components/issues/issue-layouts/utils"; import useOutsideClickDetector from "@/hooks/use-outside-click-detector"; @@ -13,7 +13,7 @@ type Props = { id: string; isLastChild: boolean; isDragEnabled: boolean; - children: (isDragging: boolean, dragHandleRef: MutableRefObject) => JSX.Element; + children: (isDragging: boolean) => JSX.Element; onDrop: (draggingBlockId: string | undefined, droppedBlockId: string | undefined, dropAtEndOfList: boolean) => void; }; @@ -24,11 +24,9 @@ export const GanttDnDHOC = observer((props: Props) => { const [instruction, setInstruction] = useState<"DRAG_OVER" | "DRAG_BELOW" | undefined>(undefined); // refs const blockRef = useRef(null); - const dragHandleRef = useRef(null); useEffect(() => { const element = blockRef.current; - const dragHandleElement = dragHandleRef.current; if (!element) return; @@ -36,7 +34,6 @@ export const GanttDnDHOC = observer((props: Props) => { draggable({ element, canDrag: () => isDragEnabled, - dragHandle: dragHandleElement ?? undefined, getInitialData: () => ({ id }), onDragStart: () => { setIsDragging(true); @@ -92,14 +89,27 @@ export const GanttDnDHOC = observer((props: Props) => { }, }) ); - }, [blockRef?.current, dragHandleRef?.current, isLastChild, onDrop]); + }, [blockRef?.current, isLastChild, onDrop]); useOutsideClickDetector(blockRef, () => blockRef?.current?.classList?.remove(HIGHLIGHT_WITH_LINE)); return ( -
+
{ + if (!isDragEnabled) { + setToast({ + title: "Warning!", + type: TOAST_TYPE.WARNING, + message: "Drag and drop is only enabled when sorted by manual", + }); + } + }} + > - {children(isDragging, dragHandleRef)} + {children(isDragging)} {isLastChild && }
); diff --git a/web/core/components/gantt-chart/sidebar/issues/block.tsx b/web/core/components/gantt-chart/sidebar/issues/block.tsx index 8509df010..598a550e7 100644 --- a/web/core/components/gantt-chart/sidebar/issues/block.tsx +++ b/web/core/components/gantt-chart/sidebar/issues/block.tsx @@ -18,15 +18,13 @@ import { IGanttBlock } from "../../types"; type Props = { block: IGanttBlock; - enableReorder: boolean; enableSelection: boolean; isDragging: boolean; - dragHandleRef: MutableRefObject; selectionHelpers?: TSelectionHelper; }; export const IssuesSidebarBlock = observer((props: Props) => { - const { block, enableReorder, enableSelection, isDragging, dragHandleRef, selectionHelpers } = props; + const { block, enableSelection, isDragging, selectionHelpers } = props; // store hooks const { updateActiveBlockId, isBlockActive } = useGanttChart(); const { getIsIssuePeeked } = useIssueDetail(); @@ -60,16 +58,6 @@ export const IssuesSidebarBlock = observer((props: Props) => { }} >
- {enableReorder && ( - - )} {enableSelection && selectionHelpers && ( = observer((props) => { isDragEnabled={enableReorder} onDrop={handleOnDrop} > - {(isDragging: boolean, dragHandleRef: MutableRefObject) => ( + {(isDragging: boolean) => ( )} diff --git a/web/core/components/gantt-chart/sidebar/modules/block.tsx b/web/core/components/gantt-chart/sidebar/modules/block.tsx index e6b28d54a..7ee9e53a4 100644 --- a/web/core/components/gantt-chart/sidebar/modules/block.tsx +++ b/web/core/components/gantt-chart/sidebar/modules/block.tsx @@ -15,13 +15,11 @@ import { findTotalDaysInRange } from "@/helpers/date-time.helper"; type Props = { block: IGanttBlock; - enableReorder: boolean; isDragging: boolean; - dragHandleRef: MutableRefObject; }; export const ModulesSidebarBlock: React.FC = observer((props) => { - const { block, enableReorder, isDragging, dragHandleRef } = props; + const { block, isDragging } = props; // store hooks const { updateActiveBlockId, isBlockActive } = useGanttChart(); @@ -44,16 +42,6 @@ export const ModulesSidebarBlock: React.FC = observer((props) => { height: `${BLOCK_HEIGHT}px`, }} > - {enableReorder && ( - - )}
diff --git a/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx b/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx index 3fb3b188a..c7e70d073 100644 --- a/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx +++ b/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx @@ -42,14 +42,7 @@ export const ModuleGanttSidebar: React.FC = (props) => { isDragEnabled={enableReorder} onDrop={handleOnDrop} > - {(isDragging: boolean, dragHandleRef: MutableRefObject) => ( - - )} + {(isDragging: boolean) => } ); }) diff --git a/web/core/components/labels/label-block/label-item-block.tsx b/web/core/components/labels/label-block/label-item-block.tsx index 225b011bd..cfc9ae7c3 100644 --- a/web/core/components/labels/label-block/label-item-block.tsx +++ b/web/core/components/labels/label-block/label-item-block.tsx @@ -27,11 +27,10 @@ interface ILabelItemBlock { customMenuItems: ICustomMenuItem[]; handleLabelDelete: (label: IIssueLabel) => void; isLabelGroup?: boolean; - dragHandleRef: MutableRefObject; } export const LabelItemBlock = (props: ILabelItemBlock) => { - const { label, isDragging, customMenuItems, handleLabelDelete, isLabelGroup, dragHandleRef } = props; + const { label, customMenuItems, handleLabelDelete, isLabelGroup } = props; // states const [isMenuActive, setIsMenuActive] = useState(false); // refs @@ -42,12 +41,6 @@ export const LabelItemBlock = (props: ILabelItemBlock) => { return (
-
diff --git a/web/core/components/labels/label-block/label-name.tsx b/web/core/components/labels/label-block/label-name.tsx index 9c84959cc..ae5ffbf2e 100644 --- a/web/core/components/labels/label-block/label-name.tsx +++ b/web/core/components/labels/label-block/label-name.tsx @@ -10,7 +10,7 @@ export const LabelName = (props: ILabelName) => { const { name, color, isGroup } = props; return ( -
+
{isGroup ? ( ) : ( diff --git a/web/core/components/labels/project-setting-label-group.tsx b/web/core/components/labels/project-setting-label-group.tsx index 3302cb6bf..264c93e47 100644 --- a/web/core/components/labels/project-setting-label-group.tsx +++ b/web/core/components/labels/project-setting-label-group.tsx @@ -55,13 +55,13 @@ export const ProjectSettingLabelGroup: React.FC = observer((props) => { return ( - {(isDragging, isDroppingInLabel, dragHandleRef) => ( + {(isDragging, isDroppingInLabel) => (
= observer((props) => { customMenuItems={customMenuItems} handleLabelDelete={handleLabelDelete} isLabelGroup - dragHandleRef={dragHandleRef} /> )} diff --git a/web/core/components/labels/project-setting-label-item.tsx b/web/core/components/labels/project-setting-label-item.tsx index fbc812e12..f64e2cd7a 100644 --- a/web/core/components/labels/project-setting-label-item.tsx +++ b/web/core/components/labels/project-setting-label-item.tsx @@ -64,9 +64,9 @@ export const ProjectSettingLabelItem: React.FC = (props) => { return ( - {(isDragging, isDroppingInLabel, dragHandleRef) => ( + {(isDragging, isDroppingInLabel) => (
= (props) => { isDragging={isDragging} customMenuItems={customMenuItems} handleLabelDelete={handleLabelDelete} - dragHandleRef={dragHandleRef} /> )}
diff --git a/web/core/components/modules/gantt-chart/blocks.tsx b/web/core/components/modules/gantt-chart/blocks.tsx index a99aa0132..788b360db 100644 --- a/web/core/components/modules/gantt-chart/blocks.tsx +++ b/web/core/components/modules/gantt-chart/blocks.tsx @@ -69,6 +69,7 @@ export const ModuleGanttSidebarBlock: React.FC = observer((props) => {
{moduleDetails?.name}
diff --git a/web/core/components/project/sidebar-list-item.tsx b/web/core/components/project/sidebar-list-item.tsx index a51239c8e..ceaa78dac 100644 --- a/web/core/components/project/sidebar-list-item.tsx +++ b/web/core/components/project/sidebar-list-item.tsx @@ -12,7 +12,6 @@ import { useParams, usePathname } from "next/navigation"; import { createRoot } from "react-dom/client"; // icons import { - MoreVertical, PenSquare, LinkIcon, Star, @@ -111,7 +110,7 @@ export const ProjectSidebarListItem: React.FC = observer((props) => { const { projectId, handleCopyText, disableDrag, disableDrop, isLastChild, handleOnProjectDrop, projectListType } = props; // store hooks - const { sidebarCollapsed: isCollapsed, toggleSidebar } = useAppTheme(); + const { sidebarCollapsed: isSideBarCollapsed, toggleSidebar } = useAppTheme(); const { setTrackElement } = useEventTracker(); const { addProjectToFavorites, removeProjectFromFavorites, getProjectById } = useProject(); const { isMobile } = usePlatformOS(); @@ -124,7 +123,6 @@ export const ProjectSidebarListItem: React.FC = observer((props) => { // refs const actionSectionRef = useRef(null); const projectRef = useRef(null); - const dragHandleRef = useRef(null); // router params const { workspaceSlug, projectId: URLProjectId } = useParams(); // pathname @@ -187,15 +185,13 @@ export const ProjectSidebarListItem: React.FC = observer((props) => { useEffect(() => { const element = projectRef.current; - const dragHandleElement = dragHandleRef.current; if (!element) return; return combine( draggable({ element, - canDrag: () => !disableDrag && !isCollapsed, - dragHandle: dragHandleElement ?? undefined, + canDrag: () => !disableDrag && !isSideBarCollapsed, getInitialData: () => ({ id: projectId, dragInstanceId: "PROJECTS" }), onDragStart: () => { setIsDragging(true); @@ -211,7 +207,7 @@ export const ProjectSidebarListItem: React.FC = observer((props) => { const root = createRoot(container); root.render(
-
+
{project && }

{project?.name}

@@ -272,7 +268,7 @@ export const ProjectSidebarListItem: React.FC = observer((props) => { }, }) ); - }, [projectRef?.current, dragHandleRef?.current, projectId, isLastChild, projectListType, handleOnProjectDrop]); + }, [projectRef?.current, projectId, isLastChild, projectListType, handleOnProjectDrop]); useOutsideClickDetector(actionSectionRef, () => setIsMenuActive(false)); useOutsideClickDetector(projectRef, () => projectRef?.current?.classList?.remove(HIGHLIGHT_CLASS)); @@ -295,56 +291,35 @@ export const ProjectSidebarListItem: React.FC = observer((props) => { "group relative flex w-full items-center rounded-md py-1 text-custom-sidebar-text-100 hover:bg-custom-sidebar-background-80", { "bg-custom-sidebar-background-80": isMenuActive, - "pl-7": disableDrag && !isCollapsed, } )} > - {!disableDrag && ( - - - - )} - +
-
+
- {!isCollapsed &&

{project.name}

} + {!isSideBarCollapsed &&

{project.name}

}
- {!isCollapsed && ( + {!isSideBarCollapsed && (