- Introduced a new hook `useTaskTimerWithConflictCheck` to manage timer conflicts, prompting users when a timer is already running for a different task. - Updated localization files for Albanian, German, English, Spanish, Portuguese, and Chinese to include new translation keys related to timer conflict handling and cancellation. - Refactored components to utilize the new timer hook, enhancing user experience by preventing overlapping timers.
29 lines
833 B
TypeScript
29 lines
833 B
TypeScript
import React from 'react';
|
|
import TaskTimer from '@/components/taskListCommon/task-timer/task-timer';
|
|
import { useTaskTimerWithConflictCheck } from '@/hooks/useTaskTimerWithConflictCheck';
|
|
|
|
interface TaskTimeTrackingProps {
|
|
taskId: string;
|
|
isDarkMode: boolean;
|
|
}
|
|
|
|
const TaskTimeTracking: React.FC<TaskTimeTrackingProps> = React.memo(({ taskId, isDarkMode }) => {
|
|
const { started, timeString, handleStartTimer, handleStopTimer } = useTaskTimerWithConflictCheck(
|
|
taskId,
|
|
null // The hook will get the timer start time from Redux
|
|
);
|
|
|
|
return (
|
|
<TaskTimer
|
|
taskId={taskId}
|
|
started={started}
|
|
handleStartTimer={handleStartTimer}
|
|
handleStopTimer={handleStopTimer}
|
|
timeString={timeString}
|
|
/>
|
|
);
|
|
});
|
|
|
|
TaskTimeTracking.displayName = 'TaskTimeTracking';
|
|
|
|
export default TaskTimeTracking;
|