diff --git a/apps/web/lib/features/task/task-card.tsx b/apps/web/lib/features/task/task-card.tsx index 91968ae1c..152ba751d 100644 --- a/apps/web/lib/features/task/task-card.tsx +++ b/apps/web/lib/features/task/task-card.tsx @@ -513,16 +513,23 @@ function TaskCardMenu({ const canSeeActivity = useCanSeeActivityScreen(); const { todayPlan, futurePlans } = useDailyPlan(); - const taskPlannedToday = todayPlan[0]?.tasks?.find((_task) => _task.id === task.id); + const taskPlannedToday = useMemo( + () => todayPlan[todayPlan.length - 1]?.tasks?.find((_task) => _task.id === task.id), + [task.id, todayPlan] + ); - const taskPlannedTomorrow = futurePlans - .filter((_plan) => - moment(_plan.date) - .format('YYYY-MM-DD') - ?.toString() - ?.startsWith(moment()?.add(1, 'day').format('YYYY-MM-DD')) - )[0] - ?.tasks?.find((_task) => _task.id === task.id); + const taskPlannedTomorrow = useMemo( + () => + futurePlans + .filter((_plan) => + moment(_plan.date) + .format('YYYY-MM-DD') + ?.toString() + ?.startsWith(moment()?.add(1, 'day').format('YYYY-MM-DD')) + )[0] + ?.tasks?.find((_task) => _task.id === task.id), + [futurePlans, task.id] + ); return ( @@ -574,14 +581,17 @@ function TaskCardMenu({ <>
-
  • - -
  • + {!taskPlannedToday && ( +
  • + +
  • + )} +
  • { @@ -716,12 +726,13 @@ export function PlanTask({ return ( <> - {planMode === 'today' && !taskPlannedToday && ( - - {isPending ? ( + + {isPending || createDailyPlanLoading ? ( ) : ( t('dailyPlan.PLAN_FOR_TODAY') @@ -750,7 +761,7 @@ export function PlanTask({ )} {planMode === 'custom' && t('dailyPlan.PLAN_FOR_SOME_DAY')} - + ); }