From b5682f01c0bb2162b87f47dcf6ae4b6a0d51d833 Mon Sep 17 00:00:00 2001 From: Viet Nguyen <3805254+vnugent@users.noreply.github.com> Date: Mon, 2 Sep 2024 20:18:05 -0700 Subject: [PATCH] refactor: remove left/right swipe in climb page (#1169) --- package.json | 1 - src/pages/climbs/[id].tsx | 27 +-------------------------- yarn.lock | 5 ----- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/package.json b/package.json index e6caf0fd5..751709256 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "react-map-gl": "^7.1.7", "react-markdown": "^9.0.1", "react-responsive": "^9.0.0-beta.6", - "react-swipeable": "^7.0.0", "react-toastify": "^9.1.1", "react-use": "^17.4.0", "recharts": "^2.7.2", diff --git a/src/pages/climbs/[id].tsx b/src/pages/climbs/[id].tsx index 54b2ffb93..9fc8ea8b1 100644 --- a/src/pages/climbs/[id].tsx +++ b/src/pages/climbs/[id].tsx @@ -5,8 +5,6 @@ import { useForm, FormProvider } from 'react-hook-form' import { useSession } from 'next-auth/react' import dynamic from 'next/dynamic' import * as Portal from '@radix-ui/react-portal' -import { useHotkeys } from 'react-hotkeys-hook' -import { useSwipeable } from 'react-swipeable' import { toast } from 'react-toastify' import { Summary } from '@/app/(default)/components/ui/Summary' import ArrowVertical from '../../assets/icons/arrow-vertical.svg' @@ -136,29 +134,6 @@ const Body = ({ climb, leftClimb, rightClimb, parentArea }: ClimbPageProps): JSX useState([leftClimb, rightClimb]) - const navLeft = (): void => { - if (leftClimb != null) { - void router.push(`/climbs/${leftClimb.id}`) - } - } - - const navRight = (): void => { - if (rightClimb != null) { - void router.push(`/climbs/${rightClimb.id}`) - } - } - - const swipeHandlers = useSwipeable({ - onSwipedLeft: navLeft, - onSwipedRight: navRight, - swipeDuration: 250, - // touchEventOptions: { passive: true }, - preventScrollOnSwipe: false - } - ) - useHotkeys('left', navLeft, [leftClimb]) - useHotkeys('right', navRight, [rightClimb]) - const parentId = ancestors[ancestors.length - 1] const { updateClimbCmd } = useUpdateClimbsCmd({ @@ -224,7 +199,7 @@ const Body = ({ climb, leftClimb, rightClimb, parentArea }: ClimbPageProps): JSX ) return ( -