From 710fad0ec81709f4c8b3af67fd3cbf5de2066bf3 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 22 Aug 2024 13:54:21 -0700 Subject: [PATCH] Add table prop to BasicTable to specify table name --- Client/src/Components/BasicTable/index.jsx | 6 ++---- Client/src/Components/TabPanels/Account/TeamPanel.jsx | 7 ++++++- Client/src/Pages/Monitors/Details/index.jsx | 2 -- Client/src/Pages/Monitors/index.jsx | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Client/src/Components/BasicTable/index.jsx b/Client/src/Components/BasicTable/index.jsx index 17ba781f2..bef5bd651 100644 --- a/Client/src/Components/BasicTable/index.jsx +++ b/Client/src/Components/BasicTable/index.jsx @@ -15,7 +15,6 @@ import { Stack, } from "@mui/material"; import { useDispatch, useSelector } from "react-redux"; -import { useLocation } 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"; @@ -150,13 +149,11 @@ TablePaginationActions.propTypes = { * */ -const BasicTable = ({ data, paginated, reversed }) => { +const BasicTable = ({ data, paginated, reversed, table }) => { const DEFAULT_ROWS_PER_PAGE = 5; const theme = useTheme(); - const location = useLocation(); const dispatch = useDispatch(); const uiState = useSelector((state) => state.ui); - let table = location.pathname.split("/").pop(); let rowsPerPage = uiState?.[table]?.rowsPerPage ?? DEFAULT_ROWS_PER_PAGE; const [page, setPage] = useState(0); @@ -293,6 +290,7 @@ BasicTable.propTypes = { paginated: PropTypes.bool, reversed: PropTypes.bool, rowPerPage: PropTypes.number, + table: PropTypes.string, }; export default BasicTable; diff --git a/Client/src/Components/TabPanels/Account/TeamPanel.jsx b/Client/src/Components/TabPanels/Account/TeamPanel.jsx index a6c378a60..06b0d9d0a 100644 --- a/Client/src/Components/TabPanels/Account/TeamPanel.jsx +++ b/Client/src/Components/TabPanels/Account/TeamPanel.jsx @@ -294,7 +294,12 @@ const TeamPanel = () => { onClick={() => setIsOpen(true)} /> - + { History - {/* TODO New Table */} - {/* */} diff --git a/Client/src/Pages/Monitors/index.jsx b/Client/src/Pages/Monitors/index.jsx index dc293ef49..926f50c8a 100644 --- a/Client/src/Pages/Monitors/index.jsx +++ b/Client/src/Pages/Monitors/index.jsx @@ -452,7 +452,7 @@ const Monitors = () => { {/* TODO - add search bar */} - + )}