Skip to content

Commit 1deda44

Browse files
committed
fix: added a title for moga pareto table
Signed-off-by: Alejandro Parcet <[email protected]>
1 parent 46a9980 commit 1deda44

File tree

1 file changed

+63
-55
lines changed

1 file changed

+63
-55
lines changed

node/src/components/plots/MOGAParetoTable.tsx

Lines changed: 63 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
22
import { Typography, Button, Box, Chip, Popover, Slider } from "@mui/material";
33
import { DataGrid, GridColDef, GridSortModel } from "@mui/x-data-grid";
44
import { useMMUXContext } from "../../context/MMUXContext";
5+
import Header from "../navigation/Header";
56

67
interface MogaParetoTableProps {
78
tableData: MogaDataType | undefined;
@@ -185,64 +186,71 @@ function MogaParetoTable({ tableData, hovered, setHovered }: MogaParetoTableProp
185186
]);
186187

187188
return (
188-
<DataGrid
189-
rows={data?.rows || []}
190-
columns={columns}
191-
sx={theme => ({
192-
borderRadius: theme.spacing(2),
193-
overflow: "hidden",
194-
fontFamily: "inherit",
195-
padding: "0px 8px",
196-
"& .MuiDataGrid-cell": {
197-
fontWeight: 400,
198-
},
199-
"& .MuiDataGrid-row:hover": {
200-
backgroundColor: `color-mix(in srgb, ${theme.palette.primary.main} 50%, ${theme.palette.mode === "dark" ? "black" : "white"}`,
201-
},
202-
"& .MuiDataGrid-row.Mui-selected": {
203-
backgroundColor: `color-mix(in srgb, ${theme.palette.primary.main} 70%, ${theme.palette.mode === "dark" ? "black" : "white"}`,
204-
},
205-
"& .MuiDataGrid-row.Mui-selected:hover": {
206-
backgroundColor: `color-mix(in srgb, ${theme.palette.primary.main} 50%, ${theme.palette.mode === "dark" ? "black" : "white"}`,
207-
},
208-
"& .MuiDataGrid-sortButton": {
209-
backgroundColor: theme.palette.background.paper,
210-
},
211-
})}
212-
getRowId={getRowId}
213-
initialState={{
214-
pagination: {
215-
paginationModel: { pageSize: 10 },
216-
},
217-
filter: {
218-
filterModel: {
219-
items: [],
189+
<>
190+
<Header
191+
tabTitle="Pareto-Optimal MOGA Samples"
192+
headerType="subTitle"
193+
ExtendedInfoText="Explore the pareto-optimal solutions."
194+
/>
195+
<DataGrid
196+
rows={data?.rows || []}
197+
columns={columns}
198+
sx={theme => ({
199+
borderRadius: theme.spacing(2),
200+
overflow: "hidden",
201+
fontFamily: "inherit",
202+
padding: "0px 8px",
203+
"& .MuiDataGrid-cell": {
204+
fontWeight: 400,
220205
},
221-
},
222-
}}
223-
pageSizeOptions={[5, 10, 20, 50]}
224-
loading={loading}
225-
slotProps={{
226-
loadingOverlay: {
227-
variant: "linear-progress",
228-
noRowsVariant: "linear-progress",
229-
},
230-
row: {
231-
onMouseEnter: (event: React.MouseEvent<HTMLElement>) => {
232-
const rowData = event.currentTarget!.dataset;
233-
setHovered(Number(rowData.id));
206+
"& .MuiDataGrid-row:hover": {
207+
backgroundColor: `color-mix(in srgb, ${theme.palette.primary.main} 50%, ${theme.palette.mode === "dark" ? "black" : "white"}`,
234208
},
235-
onMouseLeave: () => {
236-
setHovered(null);
209+
"& .MuiDataGrid-row.Mui-selected": {
210+
backgroundColor: `color-mix(in srgb, ${theme.palette.primary.main} 70%, ${theme.palette.mode === "dark" ? "black" : "white"}`,
237211
},
238-
},
239-
}}
240-
sortModel={localSortModel}
241-
onSortModelChange={handleSortModelChange}
242-
disableColumnMenu
243-
disableColumnSelector
244-
disableRowSelectionOnClick
245-
/>
212+
"& .MuiDataGrid-row.Mui-selected:hover": {
213+
backgroundColor: `color-mix(in srgb, ${theme.palette.primary.main} 50%, ${theme.palette.mode === "dark" ? "black" : "white"}`,
214+
},
215+
"& .MuiDataGrid-sortButton": {
216+
backgroundColor: theme.palette.background.paper,
217+
},
218+
})}
219+
getRowId={getRowId}
220+
initialState={{
221+
pagination: {
222+
paginationModel: { pageSize: 10 },
223+
},
224+
filter: {
225+
filterModel: {
226+
items: [],
227+
},
228+
},
229+
}}
230+
pageSizeOptions={[5, 10, 20, 50]}
231+
loading={loading}
232+
slotProps={{
233+
loadingOverlay: {
234+
variant: "linear-progress",
235+
noRowsVariant: "linear-progress",
236+
},
237+
row: {
238+
onMouseEnter: (event: React.MouseEvent<HTMLElement>) => {
239+
const rowData = event.currentTarget!.dataset;
240+
setHovered(Number(rowData.id));
241+
},
242+
onMouseLeave: () => {
243+
setHovered(null);
244+
},
245+
},
246+
}}
247+
sortModel={localSortModel}
248+
onSortModelChange={handleSortModelChange}
249+
disableColumnMenu
250+
disableColumnSelector
251+
disableRowSelectionOnClick
252+
/>
253+
</>
246254
);
247255
}
248256

0 commit comments

Comments
 (0)