diff --git a/src/components/Paginate.js b/src/components/Paginate.js index 92fa6088915807973835757d2d20b7c4a7bd1f52..5e04b9043e1437ccff7e4464c08d78316e32903b 100644 --- a/src/components/Paginate.js +++ b/src/components/Paginate.js @@ -3,27 +3,26 @@ import { Pagination } from "react-bootstrap"; export default function Paginate(props) { const { currentPage, getNewPage, numAdjacent, numPages } = props; - - console.log(props); - const numBelow = Math.min(numAdjacent, currentPage-1); const belowAdjacent = [...Array(numBelow).keys()].map((key) => { const itemKey = `page_below_${key}`; return (<Pagination.Item key={itemKey}>{currentPage - numBelow + key}</Pagination.Item>) }); - const prefix = belowAdjacent.length >= numAdjacent ? (<><Pagination.Item>{1}</Pagination.Item><Pagination.Ellipsis disabled/>{belowAdjacent}</>) : (<>{belowAdjacent}</>); + + const prefix = currentPage-1 > numAdjacent ? (<><Pagination.Item>{1}</Pagination.Item><Pagination.Ellipsis disabled/>{belowAdjacent}</>) : (<>{belowAdjacent}</>); const numAbove = Math.min(numAdjacent, numPages-currentPage); const aboveAdjacent = [...Array(numAbove).keys()].map((key) => { const itemKey = `page_above_${key}`; return (<Pagination.Item key={itemKey}>{currentPage + key + 1}</Pagination.Item>) }); - const suffix = aboveAdjacent.length >= numAdjacent ? (<>{aboveAdjacent}<Pagination.Ellipsis disabled/><Pagination.Item>{numPages}</Pagination.Item></>) : (<>{aboveAdjacent}</>); + + const suffix = numPages-currentPage > numAdjacent ? (<>{aboveAdjacent}<Pagination.Ellipsis disabled/><Pagination.Item>{numPages}</Pagination.Item></>) : (<>{aboveAdjacent}</>); return ( <Pagination onClick={getNewPage} size="lg"> {prefix} - <Pagination.Item active >{currentPage}</Pagination.Item> + <Pagination.Item active disabled style={{fontWeight:"bold"}}>{currentPage}</Pagination.Item> {suffix} </Pagination> ); diff --git a/src/components/query/ZooniverseResults.js b/src/components/query/ZooniverseResults.js index b13e7015ad36a03a8177bd1f98b12764674a186e..36ebf541717b12cb08d06db9e048d9c27e21053c 100644 --- a/src/components/query/ZooniverseResults.js +++ b/src/components/query/ZooniverseResults.js @@ -340,10 +340,12 @@ export default function ZooniverseResults({ catalog }) { const { queryMap, page } = useContext(QueryContext); const { api_host } = useContext(GlobalContext); useEffect(() => { + const usp = new URLSearchParams(queryMap.get(catalog).esapquery); + usp.set("page", page); queryMap.set(catalog, { catalog: catalog, page: page, - esapquery: queryMap.get(catalog).esapquery + `&page=${page}`, + esapquery: usp.toString(), }); const url = api_host + "query/query/?" + queryMap.get(catalog).esapquery; axios