Skip to content

Commit 1c238bb

Browse files
author
Aleksander Brylski
committed
feat(app-board): remove the teleportation bug on card click on mobile view
1 parent 27d80f8 commit 1c238bb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/game-app/src/gameView/components/DraggableCard/DraggableCard.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ConnectedCard from '../ConnectedCard';
66
import { CardWrapper } from './DraggableCard.styled';
77
import useDoubleClick from './useDoubleClick';
88
import { Estimation } from '@pipeline/components';
9+
import { useWindowDimensions } from '../../../_shared/components/utils';
910

1011
type Props = {
1112
id: string;
@@ -106,6 +107,20 @@ const DraggableCard: React.FC<Props> = ({ id, bigger }) => {
106107
);
107108
}, [estimation, estimationOpen, isCardMoving, saveEstimation, handler, id]);
108109

110+
const { width } = useWindowDimensions();
111+
const isWindowTooSmall = width < 1100;
112+
113+
if (isWindowTooSmall) {
114+
return (
115+
<div style={style} data-cy={`card-${id}`}>
116+
{estimations}
117+
<CardWrapper {...attributes} isDragging={isCardMoving}>
118+
{card}
119+
</CardWrapper>
120+
</div>
121+
);
122+
}
123+
109124
return (
110125
<div style={style} data-cy={`card-${id}`} ref={setNodeRef}>
111126
{estimations}

0 commit comments

Comments
 (0)