Skip to content

Commit ff232a6

Browse files
committed
fix: show add button only on todo tab
1 parent 4f06341 commit ff232a6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/components/TaskList.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,24 @@ const useStyles = makeStyles(theme => ({
6565

6666

6767
interface CustomToolbarProps {
68-
onAdd: () => void
68+
taskType: TaskType;
69+
onAdd: () => void;
6970
};
7071

7172
// The actions are appended to the original toolbar actions
7273
const CustomToolbar = (props: CustomToolbarProps) => {
7374
const classes = useStyles();
7475

7576
return (
76-
<Tooltip title="Add Task">
77-
<IconButton className={classes.add} onClick={props.onAdd}>
78-
<PlusIcon />
79-
</IconButton>
80-
</Tooltip>
77+
<>
78+
{props.taskType === "todo" &&
79+
<Tooltip title="Add Task">
80+
<IconButton className={classes.add} onClick={props.onAdd}>
81+
<PlusIcon />
82+
</IconButton>
83+
</Tooltip>
84+
}
85+
</>
8186
);
8287
};
8388

@@ -307,7 +312,7 @@ function TaskList(props: Props) {
307312
print: false,
308313
download: false,
309314
customToolbar: () => {
310-
return <CustomToolbar onAdd={props.onAdd} />
315+
return <CustomToolbar taskType={props.taskType} onAdd={props.onAdd} />
311316
},
312317
customToolbarSelect: (selectedRows, _, setSelectedRows) => {
313318
const ids = selectedRows.data.map(({ dataIndex }) => tasks[dataIndex].id);

0 commit comments

Comments
 (0)