fix: fixed swiping slider during holding group

This commit is contained in:
2025-10-17 12:02:07 +04:00
parent 0fe41656f8
commit daa9d12983

View File

@ -72,8 +72,13 @@ const useDealsAndStatusesDnd = (): ReturnType => {
), ),
]); ]);
const swipeSliderDuringDrag = (activeId: number, over: Over) => { const swipeSliderDuringDrag = (activeId: number | string, over: Over) => {
const activeStatus = getStatusByDealId(activeId); let activeStatus: StatusSchema | undefined;
if (typeof activeId === "string") {
activeStatus = getStatusByGroupId(getGroupId(activeId));
} else {
activeStatus = getStatusByDealId(Number(activeId));
}
const swiperActiveStatus = const swiperActiveStatus =
statuses[swiperRef.current?.swiper.activeIndex ?? 0]; statuses[swiperRef.current?.swiper.activeIndex ?? 0];
if (swiperActiveStatus.id !== activeStatus?.id) return; if (swiperActiveStatus.id !== activeStatus?.id) return;
@ -81,11 +86,16 @@ const useDealsAndStatusesDnd = (): ReturnType => {
const activeStatusLexorank = activeStatus?.lexorank; const activeStatusLexorank = activeStatus?.lexorank;
let overStatusLexorank: string | undefined; let overStatusLexorank: string | undefined;
if (typeof over.id === "string" && isContainerId(over.id)) { if (typeof over.id === "string") {
if (isContainerId(over.id)) {
const overStatusId = getContainerId(over.id); const overStatusId = getContainerId(over.id);
overStatusLexorank = statuses.find( overStatusLexorank = statuses.find(
s => s.id === overStatusId s => s.id === overStatusId
)?.lexorank; )?.lexorank;
} else {
const overGroupId = getGroupId(over.id);
overStatusLexorank = getStatusByGroupId(overGroupId)?.lexorank;
}
} else { } else {
overStatusLexorank = getStatusByDealId(Number(over.id))?.lexorank; overStatusLexorank = getStatusByDealId(Number(over.id))?.lexorank;
} }
@ -117,7 +127,7 @@ const useDealsAndStatusesDnd = (): ReturnType => {
if (!over) return; if (!over) return;
const activeId = active.id as string | number; const activeId = active.id as string | number;
if (isMobile && typeof activeId !== "string") { if (isMobile && (typeof activeId !== "string" || isGroupId(activeId))) {
swipeSliderDuringDrag(activeId, over); swipeSliderDuringDrag(activeId, over);
} }