Skip to content

Commit 60c483e

Browse files
author
Hassan Jamil
committed
fixed logic to correctly indicate no blog posts
1 parent a6a8408 commit 60c483e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/Blogs/Blogs.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,19 @@ const PostText = styled.div`
6464

6565
const Blogs: React.FC = () => {
6666
const posts = usePosts()
67-
const hasPosts = posts?.posts?.length > 0
67+
68+
if (posts.posts.find(function(post) {
69+
return post.visibility == 'Public'
70+
}) === undefined) {
6871

69-
if (!hasPosts) {
7072
return (
7173
<BlogPage>
7274
<div>Stay tuned for upcoming blogs!</div>
7375
</BlogPage>
7476
)
7577
}
7678

79+
7780
posts.posts.sort((a:Posts,b:Posts) => {
7881
return new Date(b.date).valueOf() - new Date(a.date).valueOf();
7982
});

0 commit comments

Comments
 (0)