diff --git a/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx b/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx
index 7d2490149..c2f3c1b3b 100644
--- a/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx
+++ b/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx
@@ -42,9 +42,8 @@ function LiveSessionList(props: Props) {
text: capitalize(i), value: i
})).toJS();
- const displayedCount = Math.min(currentPage * PER_PAGE, sessions.size);
-
- const addPage = () => props.updateCurrentPage(props.currentPage + 1)
+ // const displayedCount = Math.min(currentPage * PER_PAGE, sessions.size);
+ // const addPage = () => props.updateCurrentPage(props.currentPage + 1)
useEffect(() => {
if (filters.size === 0) {
@@ -108,6 +107,12 @@ function LiveSessionList(props: Props) {
}, AUTOREFRESH_INTERVAL);
}
+ const sliceListPerPage = (list, page) => {
+ const start = page * PER_PAGE;
+ const end = start + PER_PAGE;
+ return list.slice(start, end);
+ }
+
return (
@@ -138,8 +143,8 @@ function LiveSessionList(props: Props) {
null}
+ totalPages={Math.ceil(sessions.size / PER_PAGE)}
+ onPageChange={(page) => props.updateCurrentPage(page)}
/>
- {sessions && sessions.sortBy(i => i.metadata[sort.field]).update(list => {
+ {sessions && sliceListPerPage(sessions.sortBy(i => i.metadata[sort.field]).update(list => {
return sort.order === 'desc' ? list.reverse() : list;
- }).take(displayedCount).map(session => (
+ }), currentPage - 1).map(session => (
*/}
- null}
- />
+ /> */}
diff --git a/frontend/app/components/ui/Pagination/Pagination.tsx b/frontend/app/components/ui/Pagination/Pagination.tsx
index f61457bc5..11ae24c53 100644
--- a/frontend/app/components/ui/Pagination/Pagination.tsx
+++ b/frontend/app/components/ui/Pagination/Pagination.tsx
@@ -10,25 +10,41 @@ interface Props {
}
export default function Pagination(props: Props) {
const { page, totalPages, onPageChange, limit = 5 } = props;
+ const [currentPage, setCurrentPage] = React.useState(page);
+ // const []
+
+ const changePage = (page: number) => {
+ if (page > 0 && page <= totalPages) {
+ onPageChange(page);
+ setCurrentPage(page);
+ }
+ }
return (
Page
-
+ changePage(parseInt(e.target.value))}
+ />
of
{totalPages}
)
diff --git a/frontend/app/svg/icons/chevron-double-left.svg b/frontend/app/svg/icons/chevron-double-left.svg
index 7181fd111..8f30320c6 100644
--- a/frontend/app/svg/icons/chevron-double-left.svg
+++ b/frontend/app/svg/icons/chevron-double-left.svg
@@ -1,4 +1,4 @@
-