feat: update badge count when schedule changes (#150)

* feat: update badge count when schedule changes

* fix: fixed linting issues
This commit is contained in:
Sriram Hariharan
2024-03-12 00:59:14 -05:00
committed by GitHub
parent 8e181b3010
commit a5e9e3c214
4 changed files with 61 additions and 8 deletions

View File

@@ -1,5 +1,4 @@
import createSchedule from '@pages/background/lib/createSchedule';
import switchSchedule from '@pages/background/lib/switchSchedule';
import { background } from '@shared/messages';
import type { UserSchedule } from '@shared/types/UserSchedule';
import List from '@views/components/common/List/List';
import ScheduleListItem from '@views/components/common/ScheduleListItem/ScheduleListItem';
@@ -38,8 +37,9 @@ export function CalendarSchedules({ style, dummySchedules, dummyActiveIndex }: P
const handleKeyDown = event => {
if (event.code === 'Enter') {
createSchedule(newSchedule);
setNewSchedule('');
background.createSchedule({ scheduleName: newSchedule }).then(() => {
setNewSchedule('');
});
}
};
@@ -48,8 +48,9 @@ export function CalendarSchedules({ style, dummySchedules, dummyActiveIndex }: P
};
const selectItem = (index: number) => {
setActiveScheduleIndex(index);
switchSchedule(schedules[index].name);
background.switchSchedule({ scheduleName: schedules[index].name }).then(() => {
setActiveScheduleIndex(index);
});
};
const scheduleComponents = schedules.map((schedule, index) => (

View File

@@ -87,14 +87,14 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P
return ReactDOM.createPortal(
<div className='relative'>
<button
className='bg-ut-burntorange w-6 h-6 items-center justify-center color-white! flex m1 rounded'
className='m1 h-6 w-6 flex items-center justify-center rounded bg-ut-burntorange color-white!'
onClick={onClick}
>
<RowIcon color='ut-white' />
</button>
{conflicts.length > 0 && (
<ConflictsWithWarning
className='group-hover:visible invisible text-white absolute left-13 top--3'
className='invisible absolute left-13 top--3 text-white group-hover:visible'
conflicts={conflicts}
/>
)}