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 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)) {
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);
}