From daa9d129830b0392aa2571a90a2e07aa86405abc Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Fri, 17 Oct 2025 12:02:07 +0400 Subject: [PATCH] fix: fixed swiping slider during holding group --- src/app/deals/hooks/useDealsAndStatusesDnd.ts | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/app/deals/hooks/useDealsAndStatusesDnd.ts b/src/app/deals/hooks/useDealsAndStatusesDnd.ts index 65d1ea9..118713b 100644 --- a/src/app/deals/hooks/useDealsAndStatusesDnd.ts +++ b/src/app/deals/hooks/useDealsAndStatusesDnd.ts @@ -72,8 +72,13 @@ const useDealsAndStatusesDnd = (): ReturnType => { ), ]); - const swipeSliderDuringDrag = (activeId: number, over: Over) => { - const activeStatus = getStatusByDealId(activeId); + const swipeSliderDuringDrag = (activeId: number | string, over: Over) => { + let activeStatus: StatusSchema | undefined; + if (typeof activeId === "string") { + activeStatus = getStatusByGroupId(getGroupId(activeId)); + } else { + activeStatus = getStatusByDealId(Number(activeId)); + } const swiperActiveStatus = statuses[swiperRef.current?.swiper.activeIndex ?? 0]; if (swiperActiveStatus.id !== activeStatus?.id) return; @@ -81,11 +86,16 @@ const useDealsAndStatusesDnd = (): ReturnType => { const activeStatusLexorank = activeStatus?.lexorank; let overStatusLexorank: string | undefined; - if (typeof over.id === "string" && isContainerId(over.id)) { - const overStatusId = getContainerId(over.id); - overStatusLexorank = statuses.find( - s => s.id === overStatusId - )?.lexorank; + if (typeof over.id === "string") { + if (isContainerId(over.id)) { + const overStatusId = getContainerId(over.id); + overStatusLexorank = statuses.find( + s => s.id === overStatusId + )?.lexorank; + } else { + const overGroupId = getGroupId(over.id); + overStatusLexorank = getStatusByGroupId(overGroupId)?.lexorank; + } } else { overStatusLexorank = getStatusByDealId(Number(over.id))?.lexorank; } @@ -117,7 +127,7 @@ const useDealsAndStatusesDnd = (): ReturnType => { if (!over) return; const activeId = active.id as string | number; - if (isMobile && typeof activeId !== "string") { + if (isMobile && (typeof activeId !== "string" || isGroupId(activeId))) { swipeSliderDuringDrag(activeId, over); }