Remove downvotes from the UI

This commit is contained in:
Paul Frazee 2022-11-20 11:32:13 -06:00
parent 8e3dc52536
commit 3a10139064
5 changed files with 5 additions and 94 deletions

View file

@ -31,8 +31,7 @@ export const PostThreadItem = observer(function PostThreadItem({
const store = useStores()
const [deleted, setDeleted] = useState(false)
const record = item.record as unknown as PostType.Record
const hasEngagement =
item.upvoteCount || item.downvoteCount || item.repostCount
const hasEngagement = item.upvoteCount || item.repostCount
const itemHref = useMemo(() => {
const urip = new AtUri(item.uri)
@ -46,11 +45,6 @@ export const PostThreadItem = observer(function PostThreadItem({
return `/profile/${item.author.handle}/post/${urip.rkey}/upvoted-by`
}, [item.uri, item.author.handle])
const upvotesTitle = 'Upvotes on this post'
const downvotesHref = useMemo(() => {
const urip = new AtUri(item.uri)
return `/profile/${item.author.handle}/post/${urip.rkey}/downvoted-by`
}, [item.uri, item.author.handle])
const downvotesTitle = 'Downvotes on this post'
const repostsHref = useMemo(() => {
const urip = new AtUri(item.uri)
return `/profile/${item.author.handle}/post/${urip.rkey}/reposted-by`
@ -73,11 +67,6 @@ export const PostThreadItem = observer(function PostThreadItem({
.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 onDeletePost = () => {
item.delete().then(
() => {
@ -188,21 +177,6 @@ export const PostThreadItem = observer(function PostThreadItem({
) : (
<></>
)}
{item.downvoteCount ? (
<Link
style={styles.expandedInfoItem}
href={downvotesHref}
title={downvotesTitle}>
<Text style={[s.gray5, s.semiBold, s.f18]}>
<Text style={[s.bold, s.black, s.f18]}>
{item.downvoteCount}
</Text>{' '}
{pluralize(item.downvoteCount, 'downvote')}
</Text>
</Link>
) : (
<></>
)}
</View>
) : (
<></>
@ -212,14 +186,11 @@ export const PostThreadItem = observer(function PostThreadItem({
replyCount={item.replyCount}
repostCount={item.repostCount}
upvoteCount={item.upvoteCount}
downvoteCount={item.downvoteCount}
isReposted={!!item.myState.repost}
isUpvoted={!!item.myState.upvote}
isDownvoted={!!item.myState.downvote}
onPressReply={onPressReply}
onPressToggleRepost={onPressToggleRepost}
onPressToggleUpvote={onPressToggleUpvote}
onPressToggleDownvote={onPressToggleDownvote}
/>
</View>
</View>
@ -301,14 +272,11 @@ export const PostThreadItem = observer(function PostThreadItem({
replyCount={item.replyCount}
repostCount={item.repostCount}
upvoteCount={item.upvoteCount}
downvoteCount={item.downvoteCount}
isReposted={!!item.myState.repost}
isUpvoted={!!item.myState.upvote}
isDownvoted={!!item.myState.downvote}
onPressReply={onPressReply}
onPressToggleRepost={onPressToggleRepost}
onPressToggleUpvote={onPressToggleUpvote}
onPressToggleDownvote={onPressToggleDownvote}
/>
</View>
</View>