Skip to content

Commit

Permalink
remove the dailyPlanHour popup from the soft flow (#3197)
Browse files Browse the repository at this point in the history
  • Loading branch information
CREDO23 authored Nov 28, 2024
1 parent 02df050 commit 0ae8dcb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 90 deletions.
41 changes: 1 addition & 40 deletions apps/web/app/hooks/features/useStartStopTimerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ export function useStartStopTimerHandler() {
openModal: openEnforcePlannedTaskSoftModal
} = useModal();

const {
isOpen: isDailyPlanWorkHoursModalOpen,
closeModal: dailyPlanWorkHoursCloseModal,
openModal: openAddDailyPlanWorkHoursModal
} = useModal();

const {
isOpen: isTasksEstimationHoursModalOpen,
closeModal: tasksEstimationHoursCloseModal,
Expand Down Expand Up @@ -98,21 +92,6 @@ export function useStartStopTimerHandler() {
}
};

/**
* Handle missing working hour for a daily plan
*/
const handleMissingDailyPlanWorkHour = () => {
if (hasPlan) {
if (!hasWorkedHours) {
openAddDailyPlanWorkHoursModal();
} else {
startTimerOrAskEstimate();
}
} else {
startTimerOrAskEstimate();
}
};

/**
* Handle missing estimation hours for tasks
*/
Expand All @@ -121,11 +100,7 @@ export function useStartStopTimerHandler() {
if (tasksEstimateHoursModalDate != currentDate) {
handleCheckSelectedTaskOnTodayPlan();
} else if (areAllTasksEstimated) {
if (dailyPlanEstimateHoursModalDate != currentDate) {
handleMissingDailyPlanWorkHour();
} else {
startTimerOrAskEstimate();
}
startTimerOrAskEstimate();
} else {
if (tasksEstimateHoursModalDate != currentDate) {
openAddTasksEstimationHoursModal();
Expand Down Expand Up @@ -180,16 +155,6 @@ export function useStartStopTimerHandler() {
}
} else if (tasksEstimateHoursModalDate != currentDate) {
handleMissingTasksEstimationHours();
} else if (dailyPlanEstimateHoursModalDate != currentDate) {
if (hasPlan) {
if (areAllTasksEstimated) {
handleMissingDailyPlanWorkHour();
} else {
startTimerOrAskEstimate();
}
} else {
startTimerOrAskEstimate();
}
} else {
startTimerOrAskEstimate();
}
Expand All @@ -201,7 +166,6 @@ export function useStartStopTimerHandler() {
hasPlan,
hasWorkedHours,
isActiveTaskPlaned,
openAddDailyPlanWorkHoursModal,
openAddTasksEstimationHoursModal,
openEnforcePlannedTaskModal,
openEnforcePlannedTaskSoftModal,
Expand All @@ -219,9 +183,6 @@ export function useStartStopTimerHandler() {
isEnforceTaskModalOpen,
enforceTaskCloseModal,
openEnforcePlannedTaskModal,
isDailyPlanWorkHoursModalOpen,
dailyPlanWorkHoursCloseModal,
openAddDailyPlanWorkHoursModal,
isTasksEstimationHoursModalOpen,
tasksEstimationHoursCloseModal,
openAddTasksEstimationHoursModal,
Expand Down
15 changes: 1 addition & 14 deletions apps/web/components/shared/timer/timer-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import { useTimer } from '@app/hooks/features/useTimer';
import { ProgressBar } from '@components/ui/progress-bar';
import { PauseIcon } from '@components/ui/svgs/pause-icon';
import { PlayIcon } from '@components/ui/svgs/play-icon';
import {
AddTasksEstimationHoursModal,
AddDailyPlanWorkHourModal,
EnforcePlanedTaskModal,
SuggestDailyPlanModal
} from 'lib/features/daily-plan';
import { AddTasksEstimationHoursModal, EnforcePlanedTaskModal, SuggestDailyPlanModal } from 'lib/features/daily-plan';
import { useTranslations } from 'next-intl';
import { useMemo } from 'react';

Expand Down Expand Up @@ -79,14 +74,6 @@ const Timer = () => {
/>
)}

{hasPlan && (
<AddDailyPlanWorkHourModal
isOpen={modals.isDailyPlanWorkHoursModalOpen}
closeModal={modals.dailyPlanWorkHoursCloseModal}
plan={hasPlan}
/>
)}

{/**
* Track time on planned task (REQUIRE PLAN)
*/}
Expand Down
15 changes: 1 addition & 14 deletions apps/web/lib/features/task/task-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ import { AddTaskToPlan } from '../daily-plan/add-task-to-plan';
import { ReloadIcon } from '@radix-ui/react-icons';
import moment from 'moment';
import { useStartStopTimerHandler } from '@app/hooks/features/useStartStopTimerHandler';
import {
AddDailyPlanWorkHourModal,
AddTasksEstimationHoursModal,
EnforcePlanedTaskModal,
SuggestDailyPlanModal
} from '../daily-plan';
import { AddTasksEstimationHoursModal, EnforcePlanedTaskModal, SuggestDailyPlanModal } from '../daily-plan';
import { SetAtom } from 'types';
import { useFavoritesTask } from '@/app/hooks/features/useFavoritesTask';

Expand Down Expand Up @@ -451,14 +446,6 @@ function TimerButtonCall({
/>
)}

{hasPlan && (
<AddDailyPlanWorkHourModal
isOpen={modals.isDailyPlanWorkHoursModalOpen}
closeModal={modals.dailyPlanWorkHoursCloseModal}
plan={hasPlan}
/>
)}

{/**
* Track time on planned task (REQUIRE PLAN)
*/}
Expand Down
23 changes: 1 addition & 22 deletions apps/web/lib/features/timer/timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ import {
} from '@heroicons/react/24/outline';
import { HotkeysEvent } from 'hotkeys-js';
import { useCallback, useMemo } from 'react';
import {
AddDailyPlanWorkHourModal,
AddTasksEstimationHoursModal,
EnforcePlanedTaskModal,
SuggestDailyPlanModal
} from '../daily-plan';
import { AddTasksEstimationHoursModal, EnforcePlanedTaskModal, SuggestDailyPlanModal } from '../daily-plan';
import { useStartStopTimerHandler } from '@app/hooks/features/useStartStopTimerHandler';

export function Timer({ className }: IClassName) {
Expand Down Expand Up @@ -168,14 +163,6 @@ export function Timer({ className }: IClassName) {
/>
)}

{hasPlan && (
<AddDailyPlanWorkHourModal
isOpen={modals.isDailyPlanWorkHoursModalOpen}
closeModal={modals.dailyPlanWorkHoursCloseModal}
plan={hasPlan}
/>
)}

{/**
* Track time on planned task (REQUIRE PLAN)
*/}
Expand Down Expand Up @@ -268,14 +255,6 @@ export function MinTimerFrame({ className }: IClassName) {
/>
)}

{hasPlan && (
<AddDailyPlanWorkHourModal
isOpen={modals.isDailyPlanWorkHoursModalOpen}
closeModal={modals.dailyPlanWorkHoursCloseModal}
plan={hasPlan}
/>
)}

{/**
* Track time on planned task (REQUIRE PLAN)
*/}
Expand Down

0 comments on commit 0ae8dcb

Please sign in to comment.