Fix left swipe on preview (#12104)

* Fix left swipe

* Simplify
This commit is contained in:
Nicolas Mowen 2024-06-21 15:06:40 -06:00 committed by GitHub
parent c867d90f50
commit 9bbb88cdcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,12 +70,6 @@ export default function PreviewThumbnailPlayer({
[ignoreClick, review, onClick], [ignoreClick, review, onClick],
); );
const swipeHandlers = useSwipeable({
onSwipedLeft: () => (setReviewed ? setReviewed(review) : null),
onSwipedRight: () => setPlayback(true),
preventScrollOnSwipe: true,
});
const handleSetReviewed = useCallback(() => { const handleSetReviewed = useCallback(() => {
if (review.end_time && !review.has_been_reviewed) { if (review.end_time && !review.has_been_reviewed) {
review.has_been_reviewed = true; review.has_been_reviewed = true;
@ -83,6 +77,15 @@ export default function PreviewThumbnailPlayer({
} }
}, [review, setReviewed]); }, [review, setReviewed]);
const swipeHandlers = useSwipeable({
onSwipedLeft: () => {
setPlayback(false);
handleSetReviewed();
},
onSwipedRight: () => setPlayback(true),
preventScrollOnSwipe: true,
});
useContextMenu(imgRef, () => { useContextMenu(imgRef, () => {
onClick(review, true); onClick(review, true);
}); });