Skip to content
Snippets Groups Projects
Commit 09d839be authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

fix(challenge): console errors

parent cb3932c0
No related branches found
No related tags found
2 merge requests!905MEP 2.4 : intégration Ma Bulle,!873fix(challenge): console errors
......@@ -77,13 +77,6 @@ const ChallengeView: React.FC = () => {
[cardWidth]
)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleClickOrTouchStart = (e: any) => {
if (e.nativeEvent instanceof TouchEvent)
setTouchStart(e.targetTouches[0].clientX)
if (e.nativeEvent instanceof MouseEvent) setTouchStart(e.clientX)
}
const handleClickOrTouchEnd = () => {
// if the swipe is too small and can be taken for a touch
if (touchStart && touchEnd) {
......@@ -101,13 +94,6 @@ const ChallengeView: React.FC = () => {
resetValues()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleClickOrTouchMove = (e: any) => {
if (e.nativeEvent instanceof TouchEvent)
setTouchEnd(e.targetTouches[0].clientX)
if (e.nativeEvent instanceof MouseEvent) setTouchEnd(e.clientX)
}
useEffect(() => {
userChallengeList.forEach((challenge: UserChallenge, i: number) => {
if (
......@@ -152,11 +138,11 @@ const ChallengeView: React.FC = () => {
<div
className="challengeSlider"
onClick={resetValues}
onTouchStart={handleClickOrTouchStart}
onTouchMove={handleClickOrTouchMove}
onTouchStart={event => setTouchStart(event.targetTouches[0].clientX)}
onTouchMove={event => setTouchEnd(event.targetTouches[0].clientX)}
onTouchEnd={handleClickOrTouchEnd}
onMouseDown={handleClickOrTouchStart}
onMouseMove={handleClickOrTouchMove}
onMouseDown={event => setTouchStart(event.clientX)}
onMouseMove={event => setTouchEnd(event.clientX)}
onMouseUp={handleClickOrTouchEnd}
>
<div
......
......@@ -22,6 +22,7 @@
}
.cardContent {
margin: auto;
cursor: pointer;
.title {
font-weight: 400;
text-align: center;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment