Skip to content

Commit

Permalink
Queue: Fix props and table options
Browse files Browse the repository at this point in the history
And use TypeScript.

Signed-off-by: Zack Cerza <[email protected]>
  • Loading branch information
zmc committed Jan 25, 2024
1 parent a0883a6 commit 0331e5f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/components/RunList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
type MRT_PaginationState,
type MRT_Updater,
type MRT_ColumnFiltersState,
type MRT_TableOptions,
} from 'material-react-table';
import { type Theme } from "@mui/material/styles";
import { parse } from "date-fns";
Expand Down Expand Up @@ -172,10 +173,11 @@ type RunListParams = {
type RunListProps = {
params: DecodedValueMap<QueryParamConfigMap>;
setter: SetQuery<QueryParamConfigMap>;
tableOptions?: Partial<MRT_TableOptions<Run>>;
}

export default function RunList(props: RunListProps) {
const { params, setter } = props;
const { params, setter, tableOptions } = props;
const options = useDefaultTableOptions<Run>();
const debouncedParams = useDebounce(params, 500);
const columnFilters: MRT_ColumnFiltersState = [];
Expand Down Expand Up @@ -256,6 +258,7 @@ export default function RunList(props: RunListProps) {
if ( category ) return { className: category };
return {};
},
...tableOptions,
});
if (query.isError) return null;
return <MaterialReactTable table={table} />
Expand Down
19 changes: 0 additions & 19 deletions src/pages/Queue/index.jsx

This file was deleted.

29 changes: 29 additions & 0 deletions src/pages/Queue/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Helmet } from "react-helmet";
import { useQueryParams, BooleanParam, withDefault } from "use-query-params";
import Typography from "@mui/material/Typography";

import RunList from "../../components/RunList";

export default function Queue() {
const [params, setParams] = useQueryParams({
queued: withDefault(BooleanParam, true),
}, {
removeDefaultsFromUrl: true,
updateType: "push",
});
const tableOptions = {
enableFilters: false,
enablePagination: false,
}
return (
<div>
<Helmet>
<title>Queue - Pulpito</title>
</Helmet>
<Typography variant="h5" style={{ margin: "20px" }}>
Queue
</Typography>
<RunList params={params} setter={setParams} tableOptions={tableOptions} />
</div>
);
}

0 comments on commit 0331e5f

Please sign in to comment.