fix: 4th attempt for: now able to delete schedule even if active (#435)
* fix: 2nd attempt for: now able to delete schedule even if active * fix: 3rd attempt for: now able to delete schedule even if active * fix: 4th attempt for: now able to delete schedule even if active --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
This commit is contained in:
@@ -61,54 +61,34 @@ export default function ScheduleListItem({ schedule, dragHandleProps, onClick }:
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
if (schedule.id === activeSchedule.id) {
|
||||
showDialog({
|
||||
title: `Unable to delete active schedule.`,
|
||||
|
||||
description: (
|
||||
<>
|
||||
<Text>Deleting the active schedule</Text>
|
||||
<Text className='text-ut-burntorange'> {schedule.name} </Text>
|
||||
<Text>is not allowed. Please switch to another schedule and try again.</Text>
|
||||
</>
|
||||
),
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
buttons: close => (
|
||||
<Button variant='filled' color='ut-burntorange' onClick={close}>
|
||||
I Understand
|
||||
showDialog({
|
||||
title: `Are you sure?`,
|
||||
description: (
|
||||
<>
|
||||
<Text>Deleting</Text>
|
||||
<Text className='text-ut-burntorange'> {schedule.name} </Text>
|
||||
<Text>is permanent and will remove all added courses from that schedule.</Text>
|
||||
</>
|
||||
),
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
buttons: close => (
|
||||
<>
|
||||
<Button variant='single' color='ut-black' onClick={close}>
|
||||
Cancel
|
||||
</Button>
|
||||
),
|
||||
});
|
||||
} else {
|
||||
showDialog({
|
||||
title: `Are you sure?`,
|
||||
description: (
|
||||
<>
|
||||
<Text>Deleting</Text>
|
||||
<Text className='text-ut-burntorange'> {schedule.name} </Text>
|
||||
<Text>is permanent and will remove all added courses from that schedule.</Text>
|
||||
</>
|
||||
),
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
buttons: close => (
|
||||
<>
|
||||
<Button variant='single' color='ut-black' onClick={close}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant='filled'
|
||||
color='theme-red'
|
||||
onClick={() => {
|
||||
close();
|
||||
deleteSchedule(schedule.id);
|
||||
}}
|
||||
>
|
||||
Delete Permanently
|
||||
</Button>
|
||||
</>
|
||||
),
|
||||
});
|
||||
}
|
||||
<Button
|
||||
variant='filled'
|
||||
color='theme-red'
|
||||
onClick={() => {
|
||||
close();
|
||||
deleteSchedule(schedule.id);
|
||||
}}
|
||||
>
|
||||
Delete Permanently
|
||||
</Button>
|
||||
</>
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user