From 6b4400a6e7eeab03d6b080701de0a7ef7aa69475 Mon Sep 17 00:00:00 2001 From: Harum Helmy Date: Wed, 29 Jul 2020 15:38:28 -0400 Subject: [PATCH] added pagination buttons, removed unused imports --- src/components/dashboard.js | 51 ++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/src/components/dashboard.js b/src/components/dashboard.js index 08a2abc..2093117 100644 --- a/src/components/dashboard.js +++ b/src/components/dashboard.js @@ -2,18 +2,21 @@ import React, { useEffect, useState, useCallback, useMemo } from 'react'; import { Helmet } from 'react-helmet-async'; import omit from 'lodash/omit'; -import { ORG } from '../constants'; +import { subDays } from 'date-fns' +import { MdChevronRight, MdFirstPage } from 'react-icons/md'; import { useHistory, useLocation } from 'react-router-dom'; + +import { ORG } from '../constants'; import Org from './org'; // hooks -import { useActionsSearchResults, usePreprintActions, usePreprintSearchResults } from '../hooks/api-hooks'; +import { usePreprintSearchResults } from '../hooks/api-hooks'; // utils import { checkIfIsModerated } from '../utils/actions'; -import { getTags, getUsersRank, isYes } from '../utils/stats'; -import { createActivityQs, createPreprintQs, apifyPreprintQs } from '../utils/search'; -import { getId, arrayify } from '../utils/jsonld' +import { getUsersRank, isYes } from '../utils/stats'; +import { createPreprintQs, apifyPreprintQs } from '../utils/search'; +import { getId } from '../utils/jsonld' // contexts @@ -22,6 +25,8 @@ import { useUser } from '../contexts/user-context'; // modules import AddButton from './add-button'; import Banner from "./banner.js"; +import Button from './button'; + import Checkbox from './checkbox'; import SortOptions from './sort-options'; import HeaderBar from './header-bar'; @@ -31,7 +36,6 @@ import XLink from './xlink'; import RecentActivity from './recent-activity' import ActiveUser from './active-user' -import { subDays } from 'date-fns' export default function Dashboard() { const history = useHistory(); @@ -370,6 +374,41 @@ export default function Dashboard() { )} + +
+ {!!(location.state && location.state.bookmark) && ( + + )} + {/* Cloudant returns the same bookmark when it hits the end of the list */} + {!!( + preprints.rows.length < preprints.total_rows && + preprints.bookmark !== (location.state && location.state.bookmark) + ) && ( + + )} +
+ +