Skip to content

Commit

Permalink
revert hide table, use native no content design
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Jan 22, 2024
1 parent 3ba9479 commit 5968ca9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
3 changes: 2 additions & 1 deletion src/components/DataSubmissions/GenericTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ type Props<T> = {
defaultRowsPerPage?: number;
paginationPlacement?: CSSProperties["justifyContent"];
containerProps?: TableContainerProps;
numRowsNoContent?: number;
setItemKey?: (item: T, index: number) => string;
onFetchData?: (params: FetchListing<T>, force: boolean) => void;
onOrderChange?: (order: Order) => void;
Expand All @@ -172,6 +173,7 @@ const GenericTable = <T,>({
defaultRowsPerPage = 10,
paginationPlacement,
containerProps,
numRowsNoContent = 10,
setItemKey,
onFetchData,
onOrderChange,
Expand All @@ -185,7 +187,6 @@ const GenericTable = <T,>({
);
const [page, setPage] = useState<number>(0);
const [perPage, setPerPage] = useState<number>(defaultRowsPerPage);
const numRowsNoContent = 10;

useEffect(() => {
fetchData();
Expand Down
40 changes: 14 additions & 26 deletions src/content/dataSubmissions/FileListDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,6 @@ const StyledFileName = styled(Typography)({
wordBreak: "break-all"
});

const StyledNoFiles = styled(Typography)({
color: "#595959",
fontFamily: "'Nunito Sans', 'Rubik', sans-serif",
fontSize: "16px",
fontStyle: "normal",
fontWeight: "400",
marginTop: "8px",
marginBottom: "40px"
});

const tableContainerSx: TableContainerProps["sx"] = {
"& .MuiTableHead-root .MuiTableCell-root:first-of-type": {
paddingLeft: "26px",
Expand Down Expand Up @@ -237,22 +227,20 @@ const FileListDialog = ({
{`${batch?.fileCount || 0} FILES`}
</StyledNumberOfFiles>

{batch?.fileCount === 0 ? (
<StyledNoFiles variant="body1">No files were uploaded.</StyledNoFiles>
) : (
<GenericTable
columns={columns}
data={batchFiles}
total={batch?.fileCount || 0}
loading={loading}
defaultOrder="asc"
defaultRowsPerPage={20}
paginationPlacement="center"
onFetchData={handleFetchBatchFiles}
setItemKey={(item, idx) => `${idx}_${item.fileName}_${item.createdAt}`}
containerProps={{ sx: tableContainerSx }}
/>
)}
<GenericTable
columns={columns}
data={batchFiles}
total={batch?.fileCount || 0}
loading={loading}
defaultOrder="asc"
defaultRowsPerPage={20}
paginationPlacement="center"
noContentText="No files were uploaded."
numRowsNoContent={5}
onFetchData={handleFetchBatchFiles}
setItemKey={(item, idx) => `${idx}_${item.fileName}_${item.createdAt}`}
containerProps={{ sx: tableContainerSx }}
/>

<StyledCloseButton
id="file-list-dialog-close-button"
Expand Down

0 comments on commit 5968ca9

Please sign in to comment.