Skip to content

Commit

Permalink
Remove swiping functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mybearworld committed Jun 14, 2024
1 parent 5fbc0db commit fce5dda
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 @@ -20,7 +20,6 @@
"marked-react": "^2.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-swipeable": "^7.0.1",
"shiki": "^1.6.4",
"tailwind-merge": "^2.3.0",
"zod": "^3.23.8",
Expand Down
12 changes: 0 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 1 addition & 19 deletions src/components/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { File, PencilLine, Reply, Trash2, X } from "lucide-react";

Check failure on line 1 in src/components/Post.tsx

View workflow job for this annotation

GitHub Actions / build-deploy

'CSSProperties' is declared but its value is never read.
import * as Dialog from "@radix-ui/react-dialog";
import { useSwipeable } from "react-swipeable";
import { CSSProperties, ReactNode, useRef, useState, memo } from "react";
import { useShallow } from "zustand/react/shallow";
import { useAPI } from "../lib/api";
Expand Down Expand Up @@ -88,7 +87,6 @@ type PostBaseProps = {
onReply?: (id: string, content: string, username: string) => void;
};
const PostBase = memo((props: PostBaseProps) => {
const [deltaX, setDeltaX] = useState(0);
const [deleteError, setDeleteError] = useState<string>();
const [editing, setEditing] = useState(false);
const [credentials, editPost, deletePost] = useAPI(
Expand All @@ -98,18 +96,6 @@ const PostBase = memo((props: PostBaseProps) => {
state.deletePost,
]),
);
const swipeHandlers = useSwipeable({
onSwipedRight: () => {
doReply();
},
onSwiping: (evt) => {
setDeltaX(evt.deltaX);
},
onSwiped: () => {
setDeltaX(0);
},
delta: 50,
});
const reply = getReply(props.post.p);

const doReply = () => {
Expand All @@ -132,11 +118,7 @@ const PostBase = memo((props: PostBaseProps) => {
};

return (
<div
className="translate-x-[min(0,var(--delta-x),50px)]"
style={{ "--delta-x": deltaX } as CSSProperties}
{...swipeHandlers}
>
<div>
<SpeechBubble
reply={props.reply}
transparent={!!props.post.optimistic}
Expand Down

0 comments on commit fce5dda

Please sign in to comment.