Browse Source

fix: remove unnecessary pagination

develop
Ezerous 4 years ago
parent
commit
ee23e461c1
  1. 19
      packages/concordia-app/src/components/PostList/index.jsx
  2. 11
      packages/concordia-app/src/components/TopicList/index.jsx

19
packages/concordia-app/src/components/PostList/index.jsx

@ -52,23 +52,34 @@ const PostList = (props) => {
});
}, [focusOnPost, getPostCallHashes, loading, pageNumber, postIds]);
const footer = useMemo(() => {
const handlePageChange = (event, data) => {
setPageNumber(data.activePage);
onPageChange(event, data);
};
if (numberOfItems <= ITEMS_PER_PAGE) {
return null;
}
return (
<>
<Dimmer.Dimmable as={Feed} blurring dimmed={loading} id="post-list" size="large">
<Loader active={loading} />
{posts}
</Dimmer.Dimmable>
<Divider />
<div id="post-list-pagination">
<PaginationComponent onPageChange={handlePageChange} numberOfItems={numberOfItems} />
</div>
</>
);
}, [numberOfItems, onPageChange]);
return (
<>
<Dimmer.Dimmable as={Feed} blurring dimmed={loading} id="post-list" size="large">
<Loader active={loading} />
{posts}
</Dimmer.Dimmable>
{footer}
</>
);
};
PostList.propTypes = {

11
packages/concordia-app/src/components/TopicList/index.jsx

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { List } from 'semantic-ui-react';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import TopicListRow from './TopicListRow';
import PaginationComponent from '../PaginationComponent';
import PaginationComponent, { ITEMS_PER_PAGE } from '../PaginationComponent';
import { drizzle } from '../../redux/store';
import './styles.css';
@ -39,12 +39,19 @@ const TopicList = (props) => {
);
}), [getTopicCallHashes, topicIds]);
const pagination = useMemo(() => {
if (numberOfItems <= ITEMS_PER_PAGE) {
return null;
}
return (<PaginationComponent onPageChange={onPageChange} numberOfItems={numberOfItems} />);
}, [numberOfItems, onPageChange]);
return (
<div>
<List id="topic-list" size="big">
{topics}
</List>
<PaginationComponent onPageChange={onPageChange} numberOfItems={numberOfItems} />
{pagination}
</div>
);
};

Loading…
Cancel
Save