diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 000000000..c884b2e12 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,9 @@ +## Describe your changes + +## Issue Number if applicable + +## Checklist before requesting a review + +- [ ] I have performed a self-review of my code +- [ ] I have inlcuded the issue # in the PR if applicable +- [ ] I have labelled the PR correctly diff --git a/Client/src/Components/BasicTable/index.css b/Client/src/Components/BasicTable/index.css index 14adc440c..604dc412e 100644 --- a/Client/src/Components/BasicTable/index.css +++ b/Client/src/Components/BasicTable/index.css @@ -10,7 +10,6 @@ } .MuiTable-root .host div:nth-child(2) { width: fit-content; - font-weight: 700; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; @@ -125,3 +124,68 @@ .MuiPaper-root + .MuiPagination-root div.MuiPaginationItem-root { user-select: none; } + +.MuiTablePagination-root p { + color: var(--env-var-color-2); + font-weight: 500; +} +.MuiTablePagination-root button, +.MuiTablePagination-root .MuiSelect-select { + border: solid 1px #ebebeb; + border-radius: var(--env-var-radius-1); +} +.MuiTablePagination-root .MuiTablePagination-select.MuiSelect-select { + text-align: left; + text-align-last: left; +} +.MuiTablePagination-root button { + min-width: 0; + padding: 4px; + margin-left: 5px; +} +.MuiTablePagination-root svg { + width: 22px; + height: 22px; +} +.MuiTablePagination-root svg path { + stroke: var(--env-var-color-2); + stroke-width: 1.3; +} +.MuiTablePagination-root .MuiSelect-icon { + width: 16px; + height: 16px; + top: 50%; + right: 8%; + transform: translateY(-50%); +} +.MuiTablePagination-root button.Mui-disabled { + opacity: 0.4; +} +.MuiTablePagination-root button:not(.Mui-disabled):hover { + background-color: #f4f4f4; + border-color: #f4f4f4; +} + +.pagination-dropdown.MuiPaper-root { + box-shadow: var(--env-var-shadow-1); + border: solid 1px var(--env-var-color-6); + border-radius: var(--env-var-radius-1); +} +.pagination-dropdown ul { + padding: 4px; + min-width: 100px; +} +.pagination-dropdown li, +body:has(.pagination-dropdown) p:has(+ .MuiTablePagination-root) { + font-size: var(--env-var-font-size-medium); + color: var(--env-var-color-2); + padding: 4px; +} +.pagination-dropdown li.Mui-selected, +.pagination-dropdown li.Mui-selected.Mui-focusVisible, +.pagination-dropdown li.Mui-selected:hover { + background-color: #f4f4f4; +} +body:has(.pagination-dropdown) p:has(+ .MuiTablePagination-root) { + font-size: var(--env-var-font-size-small-plus); +} diff --git a/Client/src/Components/BasicTable/index.jsx b/Client/src/Components/BasicTable/index.jsx index 76f1c61c7..8b6cafd91 100644 --- a/Client/src/Components/BasicTable/index.jsx +++ b/Client/src/Components/BasicTable/index.jsx @@ -1,3 +1,6 @@ +import PropTypes from "prop-types"; +import { useState, useEffect } from "react"; +import { useTheme } from "@emotion/react"; import { TableContainer, Paper, @@ -6,14 +9,86 @@ import { TableRow, TableCell, TableBody, - Pagination, - PaginationItem, + TablePagination, + Box, + Typography, + Stack, } from "@mui/material"; -import React, { useState, useEffect } from "react"; -import PropTypes from "prop-types"; +import { useDispatch, useSelector } from "react-redux"; +import { useLocation, useParams } from "react-router-dom"; +import { setRowsPerPage } from "../../Features/UI/uiSlice"; +import LeftArrowDouble from "../../assets/icons/left-arrow-double.svg?react"; +import RightArrowDouble from "../../assets/icons/right-arrow-double.svg?react"; +import LeftArrow from "../../assets/icons/left-arrow.svg?react"; +import RightArrow from "../../assets/icons/right-arrow.svg?react"; +import SelectorVertical from "../../assets/icons/selector-vertical.svg?react"; +import Button from "../Button"; import "./index.css"; -import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded"; -import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded"; +/** + * Component for pagination actions (first, previous, next, last). + * + * @component + * @param {Object} props + * @param {number} props.count - Total number of items. + * @param {number} props.page - Current page number. + * @param {number} props.rowsPerPage - Number of rows per page. + * @param {function} props.onPageChange - Callback function to handle page change. + * + * @returns {JSX.Element} Pagination actions component. + */ +const TablePaginationActions = (props) => { + const { count, page, rowsPerPage, onPageChange } = props; + + const handleFirstPageButtonClick = (event) => { + onPageChange(event, 0); + }; + const handleBackButtonClick = (event) => { + onPageChange(event, page - 1); + }; + const handleNextButtonClick = (event) => { + onPageChange(event, page + 1); + }; + const handleLastPageButtonClick = (event) => { + onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1)); + }; + + return ( + +