Skip to content

Commit be61fc5

Browse files
committed
fix(#283): hide reactions and comments for unauthenticated users
1 parent 1f06c7e commit be61fc5

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/pages/Blogs/singleBlog.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,36 @@ const SingleBlogView = () => {
183183
)}
184184
</div>
185185
</div>
186-
{id && <BlogReaction blogId={id} />}
187-
{id && <BlogComment blogId={id} />}
186+
{
187+
userId ? (
188+
<>
189+
{id && <BlogReaction blogId={id} />}
190+
{id && <BlogComment blogId={id} />}
191+
</>
192+
):(
193+
<div className="py-4">
194+
<p className="text-sm dark:text-slate-300">
195+
Please{" "}
196+
<a
197+
href="/"
198+
className="text-green hover:text-green-700"
199+
>
200+
log in
201+
</a>{" "}
202+
or{" "}
203+
<a
204+
href="/"
205+
className="text-green hover:text-green-700"
206+
>
207+
create an account
208+
</a>{" "}
209+
to like or comment.
210+
</p>
211+
</div>
212+
213+
)
214+
}
215+
188216
{topArticles && topArticles.length > 0 ? (
189217
<div className='mt-10'>
190218
<h1>Related Articles</h1>

0 commit comments

Comments
 (0)