From b0782fbfb3090b2f726726beddb5f2098d3356f9 Mon Sep 17 00:00:00 2001 From: Innocent-akim Date: Wed, 11 Dec 2024 19:14:15 +0200 Subject: [PATCH] fix: coderabbitai --- .../timesheet/[memberId]/components/AddTaskModal.tsx | 6 ++++-- .../timesheet/[memberId]/components/EditTaskModal.tsx | 5 ++--- .../[memberId]/components/TimeSheetFilterPopover.tsx | 2 +- apps/web/app/hooks/features/useTimesheet.ts | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx index bdd4f9ef3..7faed107e 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx @@ -101,9 +101,11 @@ export function AddTaskModal({ closeModal, isOpen }: IAddTaskModalProps) { startedAt, stoppedAt, }).then(() => { - console.log('succes') + closeModal() }).catch((error) => { - console.error(error) + if (!error) { + closeModal(); + } }) }) } diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx index d73840f92..1f90136cd 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx @@ -128,10 +128,9 @@ export function EditTaskModal({ isOpen, closeModal, dataTimesheet }: IEditTaskMo variant: 'destructive', className: 'bg-red-50 text-red-600 border-red-500 z-[10000px]' }); - if (error) { - return; + if (!error) { + closeModal(); } - closeModal(); }); }, [dateRange, timeRange, timesheetData, dataTimesheet, updateTimesheet]); diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx index d9166953d..bed377d60 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx @@ -147,7 +147,7 @@ export const TimeSheetFilterPopover = React.memo(function TimeSheetFilterPopover status)} + items={statusTable?.flat()} itemToString={(status) => (status ? status.label : '')} itemId={(item) => item.label} onValueChange={(selectedItems) => setStatusState(selectedItems as any)} diff --git a/apps/web/app/hooks/features/useTimesheet.ts b/apps/web/app/hooks/features/useTimesheet.ts index e3d115c21..ecbcaacda 100644 --- a/apps/web/app/hooks/features/useTimesheet.ts +++ b/apps/web/app/hooks/features/useTimesheet.ts @@ -167,7 +167,7 @@ export function useTimesheet({ const response = await queryUpdateTimesheet(timesheet); setTimesheet(prevTimesheet => prevTimesheet.map(item => - item.timesheet.id === response.data.id + item.timesheet?.id === response.data.id ? response.data : item )