-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add user and group pages in Renku 2.0 (#3198)
Closes #3197. New features for Renku 2.0: add user pages, update group pages, update project info, update search page. Changes: - feat: add user pages in Renku 2.0 (#3200) - feat: update group pages (#3206) - feat: update the search page in Renku 2.0 (#3208) **BREAKING CHANGE**: requires `renku-data-services >= 0.17.0` **BREAKING CHANGE**: requires `renku-search >= 0.4.0` --------- Co-authored-by: Chandrasekhar Ramakrishnan <[email protected]>
- Loading branch information
Showing
66 changed files
with
2,741 additions
and
694 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/*! | ||
* Copyright 2024 - Swiss Data Science Center (SDSC) | ||
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and | ||
* Eidgenössische Technische Hochschule Zürich (ETHZ). | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import cx from "classnames"; | ||
import ReactPagination from "react-js-pagination"; | ||
|
||
interface PaginationProps { | ||
className?: string; | ||
currentPage: number; | ||
onPageChange: (pageNumber: number) => void; | ||
perPage: number; | ||
showDescription?: boolean; | ||
totalInPage?: number; | ||
totalItems?: number; | ||
} | ||
|
||
export default function Pagination({ | ||
className: className_, | ||
currentPage, | ||
onPageChange, | ||
perPage, | ||
showDescription, | ||
totalInPage, | ||
totalItems, | ||
}: PaginationProps) { | ||
// We do not display the pagination footer when there are no pages or only one page | ||
if (totalItems == null || totalItems < 1 || totalItems <= perPage) { | ||
return null; | ||
} | ||
|
||
const className = cx("pagination", className_); | ||
|
||
return ( | ||
<div className={cx("d-flex", "align-items-center", "flex-column")}> | ||
<ReactPagination | ||
activePage={currentPage} | ||
itemsCountPerPage={perPage} | ||
totalItemsCount={totalItems} | ||
onChange={onPageChange} | ||
innerClass={className} | ||
// Some defaults for the styling | ||
itemClass={"page-item"} | ||
linkClass={"page-link"} | ||
activeClass={"page-item active"} | ||
hideFirstLastPages={false} | ||
hideDisabled | ||
/> | ||
{showDescription && totalInPage && ( | ||
<ExtraInfoPagination | ||
currentPage={currentPage} | ||
perPage={perPage} | ||
totalInPage={totalInPage} | ||
totalItems={totalItems} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
interface ExtraInfoPaginationProps { | ||
currentPage: number; | ||
perPage: number; | ||
totalInPage: number; | ||
totalItems: number; | ||
} | ||
function ExtraInfoPagination({ | ||
currentPage, | ||
perPage, | ||
totalInPage, | ||
totalItems, | ||
}: ExtraInfoPaginationProps) { | ||
const initialValue = currentPage * perPage - (perPage - 1); | ||
const lastValue = initialValue + totalInPage - 1; | ||
return ( | ||
<div className="pagination-label"> | ||
{initialValue} - {lastValue} of {totalItems} results | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.