feat(task-logging): enhance time log functionality with subtask handling and UI improvements
- Implemented recursive task hierarchy in SQL query to support subtasks in time logging. - Updated time log export to include task names for better clarity. - Added tooltips to inform users when time logging and timer functionalities are disabled due to subtasks. - Enhanced UI components in the task drawer to reflect new time log features and improve user experience. - Introduced responsive design adjustments for better accessibility on mobile devices.
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
import { IProjectTask } from '@/types/project/projectTasksViewModel.types';
|
||||
import TaskTimer from '@/components/taskListCommon/task-timer/task-timer';
|
||||
import { useTaskTimer } from '@/hooks/useTaskTimer';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
type TaskListTimeTrackerCellProps = {
|
||||
task: IProjectTask;
|
||||
};
|
||||
|
||||
const TaskListTimeTrackerCell = ({ task }: TaskListTimeTrackerCellProps) => {
|
||||
const { t } = useTranslation('task-drawer/task-drawer');
|
||||
const { started, timeString, handleStartTimer, handleStopTimer } = useTaskTimer(
|
||||
task.id || '',
|
||||
task.timer_start_time || null
|
||||
);
|
||||
|
||||
// Check if task has subtasks
|
||||
const hasSubTasks = (task.sub_tasks_count || 0) > 0;
|
||||
const timerDisabledTooltip = hasSubTasks
|
||||
? t('taskTimeLogTab.timerDisabledTooltip', {
|
||||
count: task.sub_tasks_count || 0,
|
||||
defaultValue: `Timer is disabled because this task has ${task.sub_tasks_count || 0} subtasks. Time should be logged on individual subtasks.`
|
||||
})
|
||||
: '';
|
||||
|
||||
return (
|
||||
<TaskTimer
|
||||
taskId={task.id || ''}
|
||||
@@ -19,6 +30,8 @@ const TaskListTimeTrackerCell = ({ task }: TaskListTimeTrackerCellProps) => {
|
||||
handleStartTimer={handleStartTimer}
|
||||
handleStopTimer={handleStopTimer}
|
||||
timeString={timeString}
|
||||
disabled={hasSubTasks}
|
||||
disabledTooltip={timerDisabledTooltip}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user