From a48145b25e1c4d9f3d6d71088c6938eb877fa153 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Thu, 10 Apr 2025 14:08:53 -0600 Subject: [PATCH] put back everything else minus the styling --- src/common/ResponsiveTable.tsx | 242 ++++++++++++++++----------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/src/common/ResponsiveTable.tsx b/src/common/ResponsiveTable.tsx index 0159c6c..4dbe820 100644 --- a/src/common/ResponsiveTable.tsx +++ b/src/common/ResponsiveTable.tsx @@ -96,7 +96,7 @@ interface Props { export default function ResponsiveTable(props: Props) { const { - // rows, + rows, total, page, pageSize, @@ -136,7 +136,7 @@ export default function ResponsiveTable(props: Props) { const filterKey = window.location.pathname.split('/').pop() + "-table-filter-list"; - console.log("Most of the function and the table container") + console.log("Put back everything minus the style classes") const [filterList, setFilterList] = useState(() => { const saved = localStorage.getItem(filterKey); @@ -260,125 +260,125 @@ export default function ResponsiveTable(props: Props) { return String(val).charAt(0).toUpperCase() + String(val).slice(1); } - // const renderMobileRow = (row: T) => { - // if (renderMobile) return ( - // renderMobile(row) - // ) - // if (columns) { - // return ( - // - // {columns.map((column, index) => { - // return ( - // - // { !hideKeys && - // - // {column.title+": "} - // - // } - // - // {column.render(row)} - // - // - // ) - // })} - // - // ) - // } - // return ( - // Object.keys(row).map((key, index) => { - // let value = row[key as keyof typeof row] + const renderMobileRow = (row: T) => { + if (renderMobile) return ( + renderMobile(row) + ) + if (columns) { + return ( + + {columns.map((column, index) => { + return ( + + { !hideKeys && + + {column.title+": "} + + } + + {column.render(row)} + + + ) + })} + + ) + } + return ( + Object.keys(row).map((key, index) => { + let value = row[key as keyof typeof row] - // return ( - // - // - // - // {capitalize(key)+": "} - // - // - // - // - // {value+""} - // - // - // - // ) - // }) - // ) - // } + return ( + + + + {capitalize(key)+": "} + + + + + {value+""} + + + + ) + }) + ) + } - // if (isMobile || mobileView) return ( - // - // - // {renderTitle()} - // {renderSubtitle()} - // {setSearchText && searchBar()} - // - // {rows.map((row, index) => { - // return ( - // onRowClick&&onRowClick(row)}> - // {renderMobileRow(row)} - // {renderGutter && - // <> - // - // - // {renderGutter(row)} - // - // {openGutters.includes(index) && } - // handleCollapse(index, event)} - // // style={{pre}} - // > - // - // - // - // - // - // } - // - // ) - // })} - // {(rows && rows.length < 1) && - // (!isLoading ? - // - // { noDataMessage ? noDataMessage : "No data."} - // - // : - // - // - // - // ) - // } - // - // ) + if (isMobile || mobileView) return ( + + + {renderTitle()} + {renderSubtitle()} + {setSearchText && searchBar()} + + {rows.map((row, index) => { + return ( + onRowClick&&onRowClick(row)}> + {renderMobileRow(row)} + {renderGutter && + <> + + + {renderGutter(row)} + + {openGutters.includes(index) && } + handleCollapse(index, event)} + // style={{pre}} + > + + + + + + } + + ) + })} + {(rows && rows.length < 1) && + (!isLoading ? + + { noDataMessage ? noDataMessage : "No data."} + + : + + + + ) + } + + ) - // const filter = (colName: string) => { - // let newFilterList = [...filterList] - // if (filterList.includes(colName)) { - // newFilterList = newFilterList.filter(name => name !== colName) - // } else { - // newFilterList.push(colName) - // } - // setFilterList(newFilterList) - // } + const filter = (colName: string) => { + let newFilterList = [...filterList] + if (filterList.includes(colName)) { + newFilterList = newFilterList.filter(name => name !== colName) + } else { + newFilterList.push(colName) + } + setFilterList(newFilterList) + } return ( - {/* +
@@ -396,7 +396,7 @@ export default function ResponsiveTable(props: Props) { {actions && actions} - {setSearchText && + {setSearchText && {searchBar()} } @@ -459,7 +459,7 @@ export default function ResponsiveTable(props: Props) { // if (filterList.includes()) return null return ( - onRowClick&&onRowClick(row)} className={onRowClick ? classes.rowHover : undefined}> + onRowClick&&onRowClick(row)} /*className={onRowClick ? classes.rowHover : undefined}*/> {rowSelect && (props: Props) { } {renderGutter && - + {renderGutter(row)} @@ -530,8 +530,8 @@ export default function ResponsiveTable(props: Props) { } -
*/} - {/* {!hidePagination && + + {!hidePagination && (props: Props) { onPageChange={(_event, page) => handlePageChange(page)} onRowsPerPageChange={handleRowsPerPageChange} /> - } */} - {/* (props: Props) { ) })} - */} +
) } \ No newline at end of file