Skip to content

Commit

Permalink
Merge branch 'preview'
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelfan committed Feb 9, 2024
2 parents b7b3f4f + 3432ac3 commit 4c0a612
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
60 changes: 33 additions & 27 deletions src/components/dataDisplay/postActions/PostActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,36 @@ export default function PostActions(props: Props) {
if (mode === "thread") {
return (
<div>
<div className="mt-3 flex flex-wrap items-center gap-3 border-y p-2">
<Link
href={`/dashboard/user/${post.author.handle}/post/${getPostId(
post.uri,
)}/reposted-by`}
className="flex gap-1 font-semibold text-neutral-700 hover:brightness-110"
>
{abbreviateNumber(repostCount)}
<span className="font-medium text-neutral-400">
Repost{repostCount > 1 && "s"}
</span>
</Link>
<Link
href={`/dashboard/user/${post.author.handle}/post/${getPostId(
post.uri,
)}/liked-by`}
className="flex gap-1 font-semibold text-neutral-700 hover:brightness-110"
>
{abbreviateNumber(likeCount)}
<span className="font-medium text-neutral-400">
Like{likeCount > 1 && "s"}
</span>
</Link>
</div>
{(likeCount > 0 || repostCount > 0) && (
<div className="mt-3 flex flex-wrap items-center gap-3 border-y p-2">
{repostCount > 0 && (
<Link
href={`/dashboard/user/${post.author.handle}/post/${getPostId(
post.uri,
)}/reposted-by`}
className="flex gap-1 font-semibold text-neutral-700 hover:brightness-110"
>
{abbreviateNumber(repostCount)}
<span className="font-medium text-neutral-400">
Repost{repostCount > 1 && "s"}
</span>
</Link>
)}
{likeCount > 0 && (
<Link
href={`/dashboard/user/${post.author.handle}/post/${getPostId(
post.uri,
)}/liked-by`}
className="flex gap-1 font-semibold text-neutral-700 hover:brightness-110"
>
{abbreviateNumber(likeCount)}
<span className="font-medium text-neutral-400">
Like{likeCount > 1 && "s"}
</span>
</Link>
)}
</div>
)}
<div className="mt-3 flex gap-x-8">
<Button
disabled={post.viewer?.replyDisabled}
Expand Down Expand Up @@ -253,7 +259,7 @@ export default function PostActions(props: Props) {
className="hover:text-primary text-sm font-medium text-neutral-500"
>
<BiMessageRounded className="text-lg" />
{post.replyCount}
{post.replyCount ? abbreviateNumber(post.replyCount) : null}
</Button>

<Dropdown>
Expand All @@ -271,7 +277,7 @@ export default function PostActions(props: Props) {
`}
>
<BiRepost className="text-xl" />
{repostCount}
{repostCount > 0 && abbreviateNumber(repostCount)}
</Button>
</Dropdown.Trigger>
<Dropdown.Menu>
Expand Down Expand Up @@ -323,7 +329,7 @@ export default function PostActions(props: Props) {
) : (
<BiHeart className="text-lg" />
)}
{likeCount}
{likeCount > 0 && abbreviateNumber(likeCount)}
</Button>

<Dropdown>
Expand Down
3 changes: 2 additions & 1 deletion src/containers/posts/FeedContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export default function FeedContainer(props: Props) {
scrollThreshold={0.95}
className="no-scrollbar"
>
{isFetchingFeed && !isFetchingFeedNextPage && <FeedPostSkeleton />}

{feedData &&
contentFilter &&
feedFilter &&
Expand All @@ -85,7 +87,6 @@ export default function FeedContainer(props: Props) {
))}
</InfiniteScroll>

{isFetchingFeed && !isFetchingFeedNextPage && <FeedPostSkeleton />}
{feedError && (
<FeedAlert variant="badResponse" message="Something went wrong" />
)}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export function abbreviateNumber(num: number): string {
} while (num >= 1000 && unitIndex < units.length - 1);

return num.toFixed(1) + units[unitIndex];
}
}

0 comments on commit 4c0a612

Please sign in to comment.