Skip to content

Commit d18af56

Browse files
committed
refactor: fix further deprecations in mui v6
1 parent ff8469f commit d18af56

File tree

6 files changed

+28
-18
lines changed

6 files changed

+28
-18
lines changed

src/components/BaseCard.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ export const BaseCard = ({
8585
{header.avatar?.[0].toUpperCase()}
8686
</Avatar>
8787
}
88+
slotProps={{
89+
subheader: { variant: "subtitle1" },
90+
title: { variant: "body1" },
91+
}}
8892
subheader={header.subtitle}
89-
subheaderTypographyProps={{ variant: "subtitle1" }}
9093
title={header.title}
91-
titleTypographyProps={{ variant: "body1" }}
9294
/>
9395
)}
9496
<CardContent>{children}</CardContent>

src/components/FileSelector/FileListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const FileListItem = ({
8383
)}
8484
{type.startsWith("dir") && <ListItemIcon>{folderIcon ?? <FolderRoundedIcon />}</ListItemIcon>}
8585
<Tooltip title={title}>
86-
<ListItemText id={labelId} primary={title} primaryTypographyProps={{ noWrap: true }} />
86+
<ListItemText id={labelId} primary={title} slotProps={{ primary: { noWrap: true } }} />
8787
</Tooltip>
8888
<FavouriteButton fullPath={fullPath} mimeType={mimeType} projectId={projectId} type={type} />
8989
</>

src/components/instances/JobDetails/ExitCodeFromTask.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ export interface ExitCodeFromTaskProps {
88
}
99

1010
export const ExitCodeFromTask = ({ taskId }: ExitCodeFromTaskProps) => {
11-
const { data } = useGetTask(taskId);
12-
const code = data?.exit_code;
11+
const { data: code, isLoading } = useGetTask(taskId, undefined, {
12+
query: {
13+
select: (data) => data.exit_code,
14+
},
15+
});
16+
17+
if (code === undefined && !isLoading) {
18+
return null;
19+
}
1320

1421
return (
1522
<ListItem>
@@ -18,11 +25,17 @@ export const ExitCodeFromTask = ({ taskId }: ExitCodeFromTaskProps) => {
1825
</ListItemIcon>
1926
<ListItemText
2027
primary="Exit Code"
21-
secondary={code}
22-
secondaryTypographyProps={{
23-
color: code === 0 ? "green" : "error",
24-
fontWeight: "bold",
25-
}}
28+
secondary={isLoading ? "Loading..." : code}
29+
slotProps={
30+
isLoading
31+
? undefined
32+
: {
33+
secondary: {
34+
color: code === 0 ? "green" : "error",
35+
fontWeight: "bold",
36+
},
37+
}
38+
}
2639
/>
2740
</ListItem>
2841
);

src/components/runCards/InstancesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export const InstancesList = ({ predicate }: InstancesListProps) => {
6161
<ListItemButton component="a">
6262
<ListItemText
6363
primary={instance.name}
64-
primaryTypographyProps={{ variant: "body1" }}
6564
secondary={<LocalTime utcTimestamp={instance.launched} />}
65+
slotProps={{ primary: { variant: "body1" } }}
6666
/>
6767
</ListItemButton>
6868
</A>

src/features/DatasetsTable/DatasetDetails/VersionInfoSection/VersionInfoListItem.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ export const VersionInfoListItem = ({ name, value }: VersionInfoListItemProps) =
1818
return (
1919
<ListItem>
2020
<ListItemText primary={name} />
21-
<ListItemText
22-
primary={value}
23-
primaryTypographyProps={{
24-
align: "right",
25-
}}
26-
/>
21+
<ListItemText primary={value} slotProps={{ primary: { align: "right" } }} />
2722
</ListItem>
2823
);
2924
};

src/features/DatasetsTable/filters/LabelsFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const LabelsFilter = ({ labels, setLabels }: LabelsFilterProps) => {
9292
value={currentLabel}
9393
variant="outlined"
9494
onChange={(event) => setCurrentLabel(event.target.value)}
95-
onKeyPress={(event) => addLabelWithKeyboard(event.key)}
95+
onKeyUp={(event) => addLabelWithKeyboard(event.key)}
9696
/>
9797
);
9898
};

0 commit comments

Comments
 (0)