From c5808ca6099cc1fa3fc516dfe95972b285569c9a Mon Sep 17 00:00:00 2001 From: viet nguyen <3805254+vnugent@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:35:22 -0700 Subject: [PATCH] refactor: remove left/right swipe in climb page --- 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 ( -
+
diff --git a/yarn.lock b/yarn.lock index 8f8f97ad5..016716b87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7998,11 +7998,6 @@ react-style-singleton@^2.2.1: invariant "^2.2.4" tslib "^2.0.0" -react-swipeable@^7.0.0: - version "7.0.1" - resolved "https://registry.npmjs.org/react-swipeable/-/react-swipeable-7.0.1.tgz" - integrity sha512-RKB17JdQzvECfnVj9yDZsiYn3vH0eyva/ZbrCZXZR0qp66PBRhtg4F9yJcJTWYT5Adadi+x4NoG53BxKHwIYLQ== - react-test-renderer@^18.0.0: version "18.2.0" resolved "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz"