Skip to content

Commit

Permalink
only show true/false on top-level posts otherwise up/down votes (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesNakayama authored Aug 29, 2024
1 parent 9af628e commit 5cae317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/components/ui/post-action-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export function PostActionBar({

const isTargetPost = post.id == treeContext.targetPostId

const isTopLevelPost = post.parentId === null

const submitVote = async function (direction: Direction) {
const payLoad = {
postId: post.id,
Expand Down Expand Up @@ -161,7 +163,7 @@ export function PostActionBar({
<Icon name="chevron-down" className="ml-[-0.2em]" />
</button>
))}
{loggedIn && !isTargetPost && (
{loggedIn && (!isTargetPost || !isTopLevelPost) && (
<>
<button
title={'Upvote'}
Expand Down
5 changes: 4 additions & 1 deletion app/components/ui/post-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export function PostDetails({

const isTargetPost = treeContext.targetPostId === post.id

const isTopLevelPost = post.parentId === null

const userHasVoted = postState.voteState.vote != Direction.Neutral

const pCurrent: number = treeContext.commentTreeState.posts[post.id]?.p || NaN
Expand Down Expand Up @@ -99,6 +101,7 @@ export function PostDetails({
</div>
)}
{isTargetPost &&
isTopLevelPost &&
(loggedIn ? (
<div className="my-2 space-x-4">
<button
Expand Down Expand Up @@ -141,7 +144,7 @@ export function PostDetails({
/>
</div>

{isTargetPost && (
{isTargetPost && isTopLevelPost && (
<div className="mx-2 opacity-50">
<div className="text-xs">True:</div>
<div className="text-5xl">
Expand Down

0 comments on commit 5cae317

Please sign in to comment.