Skip to content

Commit

Permalink
style: remove post count title in post page because of redundant data
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Dec 19, 2023
1 parent a17a8f8 commit 0cdf174
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/components/spaces/helpers/PostPreviewsOnSpace.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useCallback } from 'react'
import { useCallback } from 'react'
import { useDispatch } from 'react-redux'
import { InnerLoadMoreFn } from 'src/components/lists'
import { InfinitePageList } from 'src/components/lists/InfiniteList'
import { PublicPostPreviewById } from 'src/components/posts/PublicPostPreview'
import { useSubsocialApi } from 'src/components/substrate/SubstrateContext'
import { getPageOfIds } from 'src/components/utils/getIds'
import { Pluralize } from 'src/components/utils/Plularize'
import { fetchPosts } from 'src/rtk/features/posts/postsSlice'
import { DataSourceTypes, PostId, PostWithSomeDetails, SpaceData } from 'src/types'
import { FollowerCanPostAlert } from '../permissions/FollowerCanPostAlert'
Expand All @@ -17,21 +16,6 @@ type Props = {
posts: PostWithSomeDetails[]
}

const PostsSectionTitle = React.memo((props: Props) => {
const { spaceData } = props
const { struct: space } = spaceData
const { postsCount } = space

return (
<div className='w-100 d-flex justify-content-between align-items-baseline'>
<span style={{ marginRight: '1rem' }}>
<Pluralize count={postsCount || 0} singularText='Post' />
</span>
{!!postsCount && <CreatePostButton space={space} title={'Write Post'} className='mb-2' />}
</div>
)
})

const InfiniteListOfPublicPosts = (props: Props) => {
const { spaceData, posts, postIds } = props
const { struct: space } = spaceData
Expand All @@ -54,7 +38,6 @@ const InfiniteListOfPublicPosts = (props: Props) => {
() => (
<InfinitePageList
loadingLabel='Loading more posts...'
title={<PostsSectionTitle {...props} />}
dataSource={initialPostIds}
loadMore={loadMore}
totalCount={postsCount || 0}
Expand Down

0 comments on commit 0cdf174

Please sign in to comment.