66 Delete as DeleteIcon ,
77 Pencil as PencilIcon ,
88 Restore as RestoreIcon ,
9- Check as CheckIcon
9+ Check as CheckIcon ,
10+ Close as CloseIcon
1011} from "mdi-material-ui" ;
1112import { TaskType , Task , taskUrgency } from "task.json" ;
1213import { DateTime } from "luxon" ;
@@ -83,6 +84,7 @@ interface CustomToolbarSelectProps {
8384 selectedIds : string [ ] ;
8485 taskType : TaskType ;
8586 onRemove : ( ids : string [ ] ) => void ;
87+ onErase : ( ids : string [ ] ) => void ;
8688 onUndo : ( ids : string [ ] ) => void ;
8789 onDo : ( ids : string [ ] ) => void ;
8890} ;
@@ -122,6 +124,16 @@ const CustomToolbarSelect = (props: CustomToolbarSelectProps) => {
122124 </ IconButton >
123125 </ Tooltip >
124126 }
127+ { props . taskType === "removed" &&
128+ < Tooltip title = "Erase Tasks" >
129+ < IconButton
130+ className = { classes . del }
131+ onClick = { ( ) => props . onErase ( props . selectedIds ) }
132+ >
133+ < CloseIcon />
134+ </ IconButton >
135+ </ Tooltip >
136+ }
125137 </ div >
126138 ) ;
127139} ;
@@ -130,6 +142,7 @@ interface ActionsProps {
130142 taskType : TaskType ;
131143 task : Task ;
132144 onRemove : ( ids : string [ ] ) => void ;
145+ onErase : ( ids : string [ ] ) => void ;
133146 onUndo : ( ids : string [ ] ) => void ;
134147 onDo : ( ids : string [ ] ) => void ;
135148 onEdit : ( task : Task ) => void ;
@@ -182,6 +195,17 @@ const Actions = (props: ActionsProps) => {
182195 </ IconButton >
183196 </ Tooltip >
184197 }
198+ { props . taskType === "removed" &&
199+ < Tooltip title = "Erase" >
200+ < IconButton
201+ className = { `${ classes . del } ${ classes . actionButton } ` }
202+ size = "small"
203+ onClick = { ( ) => props . onErase ( [ props . task . id ] ) }
204+ >
205+ < CloseIcon />
206+ </ IconButton >
207+ </ Tooltip >
208+ }
185209 </ >
186210 ) ;
187211} ;
@@ -224,6 +248,10 @@ function TaskList(props: Props) {
224248 }
225249 } ;
226250
251+ const eraseTasks = ( ids : string [ ] ) => {
252+ dispatch ( rootActions . eraseTasks ( ids ) ) ;
253+ } ;
254+
227255 const undoTasks = ( ids : string [ ] ) => {
228256 if ( props . taskType !== "todo" ) {
229257 dispatch ( rootActions . undoTasks ( {
@@ -268,6 +296,7 @@ function TaskList(props: Props) {
268296 taskType = { props . taskType }
269297 selectedIds = { ids }
270298 onRemove = { removeTasks }
299+ onErase = { eraseTasks }
271300 onUndo = { undoTasks }
272301 onDo = { doTasks }
273302 />
@@ -366,6 +395,7 @@ function TaskList(props: Props) {
366395 task = { tasks [ index ] }
367396 onEdit = { props . onEdit }
368397 onRemove = { removeTasks }
398+ onErase = { eraseTasks }
369399 onUndo = { undoTasks }
370400 onDo = { doTasks }
371401 />
0 commit comments