From ece73315a0db504ae5665e161bbca8f6be6d75d3 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Tue, 20 Aug 2024 22:21:00 +0200 Subject: [PATCH] fixbug: SOFT FLOW, popups logic when user added the today plan yesterday :ok_hand: --- apps/web/app/hooks/features/useStartStopTimerHandler.ts | 6 +++++- .../daily-plan/add-daily-plan-work-hours-modal.tsx | 6 +++--- .../daily-plan/add-task-estimation-hours-modal.tsx | 7 ++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/web/app/hooks/features/useStartStopTimerHandler.ts b/apps/web/app/hooks/features/useStartStopTimerHandler.ts index 9760a68c0..48c5d74f8 100644 --- a/apps/web/app/hooks/features/useStartStopTimerHandler.ts +++ b/apps/web/app/hooks/features/useStartStopTimerHandler.ts @@ -88,7 +88,11 @@ export function useStartStopTimerHandler() { startTimer(); } } else { - openAddTasksEstimationHoursModal(); + if (tasksEstimateHoursModalDate != currentDate) { + openAddTasksEstimationHoursModal(); + } else { + startTimer(); + } } } else { startTimer(); diff --git a/apps/web/lib/features/daily-plan/add-daily-plan-work-hours-modal.tsx b/apps/web/lib/features/daily-plan/add-daily-plan-work-hours-modal.tsx index 115b7c694..aa66a0d35 100644 --- a/apps/web/lib/features/daily-plan/add-daily-plan-work-hours-modal.tsx +++ b/apps/web/lib/features/daily-plan/add-daily-plan-work-hours-modal.tsx @@ -28,13 +28,13 @@ export function AddDailyPlanWorkHourModal(props: IAddDailyPlanWorkHoursModalProp const handleCloseModal = useCallback(() => { localStorage.setItem(DAILY_PLAN_ESTIMATE_HOURS_MODAL_DATE, currentDate); closeModal(); - }, [closeModal, currentDate]); + startTimer(); + }, [closeModal, currentDate, startTimer]); const handleSubmit = useCallback(() => { updateDailyPlan({ workTimePlanned }, plan.id ?? ''); - startTimer(); handleCloseModal(); - }, [handleCloseModal, plan.id, startTimer, updateDailyPlan, workTimePlanned]); + }, [handleCloseModal, plan.id, updateDailyPlan, workTimePlanned]); return ( diff --git a/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx b/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx index f415c0413..dda0385bb 100644 --- a/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx +++ b/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx @@ -31,13 +31,14 @@ export function AddTasksEstimationHoursModal(props: IAddTasksEstimationHoursModa const handleCloseModal = useCallback(() => { localStorage.setItem(TASKS_ESTIMATE_HOURS_MODAL_DATE, currentDate); closeModal(); - }, [closeModal, currentDate]); + startTimer(); + }, [closeModal, currentDate, startTimer]); const handleSubmit = useCallback(() => { updateDailyPlan({ workTimePlanned }, plan.id ?? ''); - startTimer(); + handleCloseModal(); - }, [handleCloseModal, plan.id, startTimer, updateDailyPlan, workTimePlanned]); + }, [handleCloseModal, plan.id, updateDailyPlan, workTimePlanned]); return (