about summary refs log tree commit diff
path: root/src/view/com/posts/FeedItem.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-08 12:14:51 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-11-08 12:14:51 -0600
commit1fbc4cf1f2279cf4cf6804ff02616515e82d2a38 (patch)
tree0796e390ba5a04e5c46ea9a560809803252fda78 /src/view/com/posts/FeedItem.tsx
parente650d98924051abfee40ff956f7348e2e47e7cd7 (diff)
downloadvoidsky-1fbc4cf1f2279cf4cf6804ff02616515e82d2a38.tar.zst
Finish the upvote/downvote implementation
Diffstat (limited to 'src/view/com/posts/FeedItem.tsx')
-rw-r--r--src/view/com/posts/FeedItem.tsx20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx
index feaa78550..73593166c 100644
--- a/src/view/com/posts/FeedItem.tsx
+++ b/src/view/com/posts/FeedItem.tsx
@@ -48,10 +48,15 @@ export const FeedItem = observer(function FeedItem({
       .toggleRepost()
       .catch(e => console.error('Failed to toggle repost', record, e))
   }
-  const onPressToggleLike = () => {
+  const onPressToggleUpvote = () => {
     item
-      .toggleLike()
-      .catch(e => console.error('Failed to toggle like', record, e))
+      .toggleUpvote()
+      .catch(e => console.error('Failed to toggle upvote', record, e))
+  }
+  const onPressToggleDownvote = () => {
+    item
+      .toggleDownvote()
+      .catch(e => console.error('Failed to toggle downvote', record, e))
   }
   const onPressShare = (uri: string) => {
     store.shell.openModal(new SharePostModel(uri))
@@ -129,12 +134,15 @@ export const FeedItem = observer(function FeedItem({
           <PostCtrls
             replyCount={item.replyCount}
             repostCount={item.repostCount}
-            likeCount={item.likeCount}
+            upvoteCount={item.upvoteCount}
+            downvoteCount={item.downvoteCount}
             isReposted={!!item.myState.repost}
-            isLiked={!!item.myState.like}
+            isUpvoted={!!item.myState.upvote}
+            isDownvoted={!!item.myState.downvote}
             onPressReply={onPressReply}
             onPressToggleRepost={onPressToggleRepost}
-            onPressToggleLike={onPressToggleLike}
+            onPressToggleUpvote={onPressToggleUpvote}
+            onPressToggleDownvote={onPressToggleDownvote}
           />
         </View>
       </View>