refactor(TaskRow): improve layout and styling for task indicators and subtasks
- Enhanced the layout of the TaskRow component to ensure better spacing and alignment for task indicators and subtasks. - Updated CSS classes to prevent compression of elements and maintain consistent visual presentation. - Improved tooltip functionality for task display names and indicators, ensuring better accessibility and user experience.
This commit is contained in:
@@ -292,15 +292,15 @@ const TaskRow: React.FC<TaskRowProps> = memo(({ taskId, projectId, visibleColumn
|
|||||||
case 'title':
|
case 'title':
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-between group" style={baseStyle}>
|
<div className="flex items-center justify-between group" style={baseStyle}>
|
||||||
<div className="flex items-center flex-1">
|
<div className="flex items-center flex-1 min-w-0">
|
||||||
{/* Indentation for subtasks - tighter spacing */}
|
{/* Indentation for subtasks - tighter spacing */}
|
||||||
{isSubtask && <div className="w-4" />}
|
{isSubtask && <div className="w-4 flex-shrink-0" />}
|
||||||
|
|
||||||
{/* Expand/Collapse button - only show for parent tasks */}
|
{/* Expand/Collapse button - only show for parent tasks */}
|
||||||
{!isSubtask && (
|
{!isSubtask && (
|
||||||
<button
|
<button
|
||||||
onClick={handleToggleExpansion}
|
onClick={handleToggleExpansion}
|
||||||
className={`flex h-4 w-4 items-center justify-center rounded-sm text-xs mr-1 hover:border hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 hover:scale-110 transition-all duration-300 ease-out ${
|
className={`flex h-4 w-4 items-center justify-center rounded-sm text-xs mr-1 hover:border hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 hover:scale-110 transition-all duration-300 ease-out flex-shrink-0 ${
|
||||||
task.sub_tasks_count != null && Number(task.sub_tasks_count) > 0
|
task.sub_tasks_count != null && Number(task.sub_tasks_count) > 0
|
||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-0 group-hover:opacity-100'
|
: 'opacity-0 group-hover:opacity-100'
|
||||||
@@ -319,14 +319,15 @@ const TaskRow: React.FC<TaskRowProps> = memo(({ taskId, projectId, visibleColumn
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Additional indentation for subtasks after the expand button space */}
|
{/* Additional indentation for subtasks after the expand button space */}
|
||||||
{isSubtask && <div className="w-2" />}
|
{isSubtask && <div className="w-2 flex-shrink-0" />}
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2 flex-1 min-w-0">
|
||||||
|
{/* Task name with dynamic width */}
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
<Tooltip title={taskDisplayName}>
|
<Tooltip title={taskDisplayName}>
|
||||||
<span
|
<span
|
||||||
className="text-sm text-gray-700 dark:text-gray-300 truncate cursor-pointer"
|
className="text-sm text-gray-700 dark:text-gray-300 truncate cursor-pointer block"
|
||||||
style={{
|
style={{
|
||||||
maxWidth: '200px',
|
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
@@ -335,71 +336,64 @@ const TaskRow: React.FC<TaskRowProps> = memo(({ taskId, projectId, visibleColumn
|
|||||||
{taskDisplayName}
|
{taskDisplayName}
|
||||||
</span>
|
</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Subtask count indicator - only show if count > 1 */}
|
{/* Indicators container - flex-shrink-0 to prevent compression */}
|
||||||
|
<div className="flex items-center gap-1 flex-shrink-0">
|
||||||
|
{/* Subtask count indicator - only show if count > 0 */}
|
||||||
{!isSubtask && task.sub_tasks_count != null && task.sub_tasks_count !== 0 && (
|
{!isSubtask && task.sub_tasks_count != null && task.sub_tasks_count !== 0 && (
|
||||||
<Tooltip title={t(`indicators.tooltips.subtasks${task.sub_tasks_count === 1 ? '' : '_plural'}`, { count: task.sub_tasks_count })}>
|
<Tooltip title={t(`indicators.tooltips.subtasks${task.sub_tasks_count === 1 ? '' : '_plural'}`, { count: task.sub_tasks_count })}>
|
||||||
<div className="flex items-center gap-1 px-2 py-1 bg-blue-50 dark:bg-blue-900/20 rounded-md">
|
<div className="flex items-center gap-1 px-1.5 py-0.5 bg-blue-50 dark:bg-blue-900/20 rounded text-xs">
|
||||||
<span className="text-xs text-blue-600 dark:text-blue-400 font-medium">
|
<span className="text-blue-600 dark:text-blue-400 font-medium">
|
||||||
{task.sub_tasks_count}
|
{task.sub_tasks_count}
|
||||||
</span>
|
</span>
|
||||||
<DoubleRightOutlined className="text-xs text-blue-600 dark:text-blue-400" />
|
<DoubleRightOutlined className="text-blue-600 dark:text-blue-400" style={{ fontSize: 10 }} />
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Task indicators */}
|
{/* Task indicators - compact layout */}
|
||||||
<div className="flex items-center gap-1 ml-2">
|
|
||||||
{/* Comments count indicator - only show if count > 1 */}
|
|
||||||
{task.comments_count != null && task.comments_count !== 0 && (
|
{task.comments_count != null && task.comments_count !== 0 && (
|
||||||
<Tooltip title={t(`indicators.tooltips.comments${task.comments_count === 1 ? '' : '_plural'}`, { count: task.comments_count })}>
|
<Tooltip title={t(`indicators.tooltips.comments${task.comments_count === 1 ? '' : '_plural'}`, { count: task.comments_count })}>
|
||||||
<div className="flex items-center gap-1">
|
|
||||||
<CommentOutlined
|
<CommentOutlined
|
||||||
className="text-gray-500 dark:text-gray-400"
|
className="text-gray-500 dark:text-gray-400"
|
||||||
style={{ fontSize: 14 }}
|
style={{ fontSize: 12 }}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Subscribers indicator */}
|
|
||||||
{task.has_subscribers && (
|
{task.has_subscribers && (
|
||||||
<Tooltip title={t('indicators.tooltips.subscribers')}>
|
<Tooltip title={t('indicators.tooltips.subscribers')}>
|
||||||
<EyeOutlined
|
<EyeOutlined
|
||||||
className="text-gray-500 dark:text-gray-400"
|
className="text-gray-500 dark:text-gray-400"
|
||||||
style={{ fontSize: 14 }}
|
style={{ fontSize: 12 }}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Attachments count indicator - only show if count > 1 */}
|
|
||||||
{task.attachments_count != null && task.attachments_count !== 0 && (
|
{task.attachments_count != null && task.attachments_count !== 0 && (
|
||||||
<Tooltip title={t(`indicators.tooltips.attachments${task.attachments_count === 1 ? '' : '_plural'}`, { count: task.attachments_count })}>
|
<Tooltip title={t(`indicators.tooltips.attachments${task.attachments_count === 1 ? '' : '_plural'}`, { count: task.attachments_count })}>
|
||||||
<div className="flex items-center gap-1">
|
|
||||||
<PaperClipOutlined
|
<PaperClipOutlined
|
||||||
className="text-gray-500 dark:text-gray-400"
|
className="text-gray-500 dark:text-gray-400"
|
||||||
style={{ fontSize: 14 }}
|
style={{ fontSize: 12 }}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Dependencies indicator */}
|
|
||||||
{task.has_dependencies && (
|
{task.has_dependencies && (
|
||||||
<Tooltip title={t('indicators.tooltips.dependencies')}>
|
<Tooltip title={t('indicators.tooltips.dependencies')}>
|
||||||
<MinusCircleOutlined
|
<MinusCircleOutlined
|
||||||
className="text-gray-500 dark:text-gray-400"
|
className="text-gray-500 dark:text-gray-400"
|
||||||
style={{ fontSize: 14 }}
|
style={{ fontSize: 12 }}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Recurring task indicator */}
|
|
||||||
{task.schedule_id && (
|
{task.schedule_id && (
|
||||||
<Tooltip title={t('indicators.tooltips.recurring')}>
|
<Tooltip title={t('indicators.tooltips.recurring')}>
|
||||||
<RetweetOutlined
|
<RetweetOutlined
|
||||||
className="text-gray-500 dark:text-gray-400"
|
className="text-gray-500 dark:text-gray-400"
|
||||||
style={{ fontSize: 14 }}
|
style={{ fontSize: 12 }}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
@@ -408,7 +402,7 @@ const TaskRow: React.FC<TaskRowProps> = memo(({ taskId, projectId, visibleColumn
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="opacity-0 group-hover:opacity-100 transition-all duration-200 ml-2 mr-2 px-3 py-1.5 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 cursor-pointer rounded-md shadow-sm hover:shadow-md flex items-center gap-1"
|
className="opacity-0 group-hover:opacity-100 transition-all duration-200 ml-2 mr-2 px-3 py-1.5 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 cursor-pointer rounded-md shadow-sm hover:shadow-md flex items-center gap-1 flex-shrink-0"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
dispatch(setSelectedTaskId(task.id));
|
dispatch(setSelectedTaskId(task.id));
|
||||||
|
|||||||
Reference in New Issue
Block a user