feat(task-list): enhance empty state display in task list component

- Added EmptyListPlaceholder component to visually represent the empty state in the task list.
- Adjusted styling and layout for the empty group drop zone to improve user experience.
- Removed unused progress properties from the task group data structure for cleaner code.
This commit is contained in:
chamikaJ
2025-07-22 12:46:09 +05:30
parent 5f86ba6b13
commit 256f1eb3a9
2 changed files with 18 additions and 17 deletions

View File

@@ -1,17 +1,24 @@
import { Empty, Typography } from 'antd'; import { Empty, Typography } from 'antd';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next';
type EmptyListPlaceholderProps = { type EmptyListPlaceholderProps = {
imageSrc?: string; imageSrc?: string;
imageHeight?: number; imageHeight?: number;
text: string; text?: string;
textKey?: string;
i18nNs?: string;
}; };
const EmptyListPlaceholder = ({ const EmptyListPlaceholder = ({
imageSrc = 'https://s3.us-west-2.amazonaws.com/worklenz.com/assets/empty-box.webp', imageSrc = 'https://s3.us-west-2.amazonaws.com/worklenz.com/assets/empty-box.webp',
imageHeight = 60, imageHeight = 60,
text, text,
textKey,
i18nNs = 'task-list-table',
}: EmptyListPlaceholderProps) => { }: EmptyListPlaceholderProps) => {
const { t } = useTranslation(i18nNs);
const description = textKey ? t(textKey) : text;
return ( return (
<Empty <Empty
image={imageSrc} image={imageSrc}
@@ -22,7 +29,7 @@ const EmptyListPlaceholder = ({
alignItems: 'center', alignItems: 'center',
marginBlockStart: 24, marginBlockStart: 24,
}} }}
description={<Typography.Text type="secondary">{text}</Typography.Text>} description={<Typography.Text type="secondary">{description}</Typography.Text>}
/> />
); );
}; };

View File

@@ -67,6 +67,7 @@ import AddTaskRow from './components/AddTaskRow';
import { AddCustomColumnButton, CustomColumnHeader } from './components/CustomColumnComponents'; import { AddCustomColumnButton, CustomColumnHeader } from './components/CustomColumnComponents';
import TaskListSkeleton from './components/TaskListSkeleton'; import TaskListSkeleton from './components/TaskListSkeleton';
import ConvertToSubtaskDrawer from '@/components/task-list-common/convert-to-subtask-drawer/convert-to-subtask-drawer'; import ConvertToSubtaskDrawer from '@/components/task-list-common/convert-to-subtask-drawer/convert-to-subtask-drawer';
import EmptyListPlaceholder from '@/components/EmptyListPlaceholder';
// Empty Group Drop Zone Component // Empty Group Drop Zone Component
const EmptyGroupDropZone: React.FC<{ const EmptyGroupDropZone: React.FC<{
@@ -89,8 +90,9 @@ const EmptyGroupDropZone: React.FC<{
className={`relative w-full transition-colors duration-200 ${ className={`relative w-full transition-colors duration-200 ${
isOver && active ? 'bg-blue-50 dark:bg-blue-900/20' : '' isOver && active ? 'bg-blue-50 dark:bg-blue-900/20' : ''
}`} }`}
style={{ minHeight: 80 }}
> >
<div className="flex items-center min-w-max px-1 py-6"> <div className="flex items-center min-w-max px-1 py-2">
{visibleColumns.map((column, index) => { {visibleColumns.map((column, index) => {
const emptyColumnStyle = { const emptyColumnStyle = {
width: column.width, width: column.width,
@@ -105,16 +107,12 @@ const EmptyGroupDropZone: React.FC<{
); );
})} })}
</div> </div>
<div className="absolute left-4 top-1/2 transform -translate-y-1/2 flex items-center"> {/* Left-aligned visually appealing empty state */}
<div <div className="pl-4 flex items-center">
className={`text-sm px-4 py-3 rounded-md border shadow-sm transition-colors duration-200 ${ <EmptyListPlaceholder
isOver && active textKey="noTasksInGroup"
? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600' imageHeight={48}
: 'text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700' />
}`}
>
{isOver && active ? t('dropTaskHere') || 'Drop task here' : t('noTasksInGroup')}
</div>
</div> </div>
{isOver && active && ( {isOver && active && (
<div className="absolute inset-0 border-2 border-dashed border-blue-400 dark:border-blue-500 rounded-md pointer-events-none" /> <div className="absolute inset-0 border-2 border-dashed border-blue-400 dark:border-blue-500 rounded-md pointer-events-none" />
@@ -551,10 +549,6 @@ const TaskListV2Section: React.FC = () => {
name: group.title, name: group.title,
count: group.actualCount, count: group.actualCount,
color: group.color, color: group.color,
todo_progress: group.todo_progress,
doing_progress: group.doing_progress,
done_progress: group.done_progress,
groupType: group.groupType,
}} }}
isCollapsed={isGroupCollapsed} isCollapsed={isGroupCollapsed}
onToggle={() => handleGroupCollapse(group.id)} onToggle={() => handleGroupCollapse(group.id)}