diff --git a/apps/app/components/core/board-view/single-board.tsx b/apps/app/components/core/board-view/single-board.tsx index bf869489021..5fee43c889e 100644 --- a/apps/app/components/core/board-view/single-board.tsx +++ b/apps/app/components/core/board-view/single-board.tsx @@ -86,7 +86,7 @@ export const SingleBoard: React.FC = ({ {(provided, snapshot) => (
= ({ snapshot.isDraggingOver ? "block" : "hidden" } top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs whitespace-nowrap bg-white p-2 rounded pointer-events-none z-[99999999]`} > - This board is order by {orderBy} + This board is ordered by {orderBy}
)} diff --git a/apps/app/components/core/board-view/single-issue.tsx b/apps/app/components/core/board-view/single-issue.tsx index 7f6f7d025cf..b8be079c5b8 100644 --- a/apps/app/components/core/board-view/single-issue.tsx +++ b/apps/app/components/core/board-view/single-issue.tsx @@ -188,7 +188,7 @@ export const SingleBoardIssue: React.FC = ({ return (
= ({ const destinationGroupArray = groupedByIssues[destination.droppableId]; if (destinationGroupArray.length !== 0) { - if (destination.index === 0) newSortOrder = destinationGroupArray[0].sort_order - 10000; - else if ( - (source.droppableId !== destination.droppableId && - destination.index === destinationGroupArray.length) || - (source.droppableId === destination.droppableId && - destination.index === destinationGroupArray.length - 1) - ) - newSortOrder = - destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; - else - newSortOrder = - (destinationGroupArray[destination.index - 1].sort_order + - destinationGroupArray[destination.index].sort_order) / - 2; + // check if dropping in the same group + if (source.droppableId === destination.droppableId) { + // check if dropping at beginning + if (destination.index === 0) + newSortOrder = destinationGroupArray[0].sort_order - 10000; + // check if dropping at last + else if (destination.index === destinationGroupArray.length - 1) + newSortOrder = + destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; + else { + if (destination.index > source.index) + newSortOrder = + (destinationGroupArray[source.index + 1].sort_order + + destinationGroupArray[source.index + 2].sort_order) / + 2; + else if (destination.index < source.index) + newSortOrder = + (destinationGroupArray[source.index - 1].sort_order + + destinationGroupArray[source.index - 2].sort_order) / + 2; + } + } else { + // check if dropping at beginning + if (destination.index === 0) + newSortOrder = destinationGroupArray[0].sort_order - 10000; + // check if dropping at last + else if (destination.index === destinationGroupArray.length) + newSortOrder = + destinationGroupArray[destinationGroupArray.length - 1].sort_order + 10000; + else + newSortOrder = + (destinationGroupArray[destination.index - 1].sort_order + + destinationGroupArray[destination.index].sort_order) / + 2; + } } draggedItem.sort_order = newSortOrder;