Skip to content

Commit

Permalink
fix(#283): hide reactions and comments for unauthenticated users
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince-Kid committed Dec 4, 2024
1 parent 1f06c7e commit 1d5c788
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/pages/Blogs/singleBlog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,36 @@ const SingleBlogView = () => {
)}
</div>
</div>
{id && <BlogReaction blogId={id} />}
{id && <BlogComment blogId={id} />}
{
userId ? (
<>
{id && <BlogReaction blogId={id} />}
{id && <BlogComment blogId={id} />}
</>
):(
<div className="text-center py-4">
<p className="text-sm dark:text-slate-300">
Please{" "}
<a
href="/"
className="text-green hover:text-green-700"
>
log in
</a>{" "}
or{" "}
<a
href="/"
className="text-green hover:text-green-700"
>
create an account
</a>{" "}
to like or comment.
</p>
</div>

)
}

{topArticles && topArticles.length > 0 ? (
<div className='mt-10'>
<h1>Related Articles</h1>
Expand Down

0 comments on commit 1d5c788

Please sign in to comment.