Skip to content

Commit

Permalink
refactor: remove left/right swipe in climb page (#1169)
Browse files Browse the repository at this point in the history
  • Loading branch information
vnugent authored Sep 3, 2024
1 parent 502eff6 commit b5682f0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
27 changes: 1 addition & 26 deletions src/pages/climbs/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -224,7 +199,7 @@ const Body = ({ climb, leftClimb, rightClimb, parentArea }: ClimbPageProps): JSX
)

return (
<div {...swipeHandlers}>
<div>
<Portal.Root container={editTogglePlaceholderRef}>
<EditModeToggle onChange={setEditMode} />
</Portal.Root>
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b5682f0

Please sign in to comment.