feat: add todosCount to RecentTasks and TaskCard components
- Included `todosCount` prop in `RecentTasks` and `TaskCard` for better task management visibility. - Updated `TaskCard` UI to display the number of related todos, enhancing user interaction. - Modified `Task` interface and `TasksService` to support todos count retrieval from the database. - Added sample `todosCount` values in `UIShowcaseClient` for demonstration purposes.
This commit is contained in:
@@ -58,6 +58,7 @@ export function RecentTasks({ tasks }: RecentTasksProps) {
|
|||||||
tfsPullRequestId={task.tfsPullRequestId}
|
tfsPullRequestId={task.tfsPullRequestId}
|
||||||
tfsProject={task.tfsProject}
|
tfsProject={task.tfsProject}
|
||||||
tfsRepository={task.tfsRepository}
|
tfsRepository={task.tfsRepository}
|
||||||
|
todosCount={task.todosCount}
|
||||||
availableTags={availableTags}
|
availableTags={availableTags}
|
||||||
fontSize="small"
|
fontSize="small"
|
||||||
onTitleClick={() => {
|
onTitleClick={() => {
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export function TaskCard({ task, onEdit, compactView = false }: TaskCardProps) {
|
|||||||
tfsPullRequestId={task.tfsPullRequestId}
|
tfsPullRequestId={task.tfsPullRequestId}
|
||||||
tfsProject={task.tfsProject}
|
tfsProject={task.tfsProject}
|
||||||
tfsRepository={task.tfsRepository}
|
tfsRepository={task.tfsRepository}
|
||||||
|
todosCount={task.todosCount}
|
||||||
isDragging={isDragging}
|
isDragging={isDragging}
|
||||||
isPending={isPending}
|
isPending={isPending}
|
||||||
onEdit={handleEdit}
|
onEdit={handleEdit}
|
||||||
|
|||||||
@@ -621,6 +621,7 @@ export function UIShowcaseClient() {
|
|||||||
priority="high"
|
priority="high"
|
||||||
tags={["Frontend", "UI"]}
|
tags={["Frontend", "UI"]}
|
||||||
source="manual"
|
source="manual"
|
||||||
|
todosCount={3}
|
||||||
fontSize="medium"
|
fontSize="medium"
|
||||||
availableTags={[
|
availableTags={[
|
||||||
{ id: "1", name: "Frontend", color: "#3b82f6" },
|
{ id: "1", name: "Frontend", color: "#3b82f6" },
|
||||||
@@ -643,6 +644,7 @@ export function UIShowcaseClient() {
|
|||||||
tags={["Design", "Components"]}
|
tags={["Design", "Components"]}
|
||||||
source="manual"
|
source="manual"
|
||||||
dueDate={new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)}
|
dueDate={new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)}
|
||||||
|
todosCount={5}
|
||||||
fontSize="medium"
|
fontSize="medium"
|
||||||
availableTags={[
|
availableTags={[
|
||||||
{ id: "1", name: "Design", color: "#f59e0b" },
|
{ id: "1", name: "Design", color: "#f59e0b" },
|
||||||
@@ -668,6 +670,7 @@ export function UIShowcaseClient() {
|
|||||||
jiraProject="PROJ"
|
jiraProject="PROJ"
|
||||||
jiraType="Bug"
|
jiraType="Bug"
|
||||||
dueDate={new Date(Date.now() + 3 * 24 * 60 * 60 * 1000)}
|
dueDate={new Date(Date.now() + 3 * 24 * 60 * 60 * 1000)}
|
||||||
|
todosCount={2}
|
||||||
fontSize="medium"
|
fontSize="medium"
|
||||||
availableTags={[
|
availableTags={[
|
||||||
{ id: "1", name: "Bug", color: "#ef4444" },
|
{ id: "1", name: "Bug", color: "#ef4444" },
|
||||||
@@ -693,6 +696,7 @@ export function UIShowcaseClient() {
|
|||||||
tfsPullRequestId={456}
|
tfsPullRequestId={456}
|
||||||
tfsProject="MyProject"
|
tfsProject="MyProject"
|
||||||
tfsRepository="backend-api"
|
tfsRepository="backend-api"
|
||||||
|
todosCount={1}
|
||||||
fontSize="medium"
|
fontSize="medium"
|
||||||
availableTags={[
|
availableTags={[
|
||||||
{ id: "1", name: "API", color: "#06b6d4" },
|
{ id: "1", name: "API", color: "#06b6d4" },
|
||||||
@@ -727,6 +731,7 @@ export function UIShowcaseClient() {
|
|||||||
priority="medium"
|
priority="medium"
|
||||||
tags={["Archive"]}
|
tags={["Archive"]}
|
||||||
source="manual"
|
source="manual"
|
||||||
|
todosCount={4}
|
||||||
fontSize="small"
|
fontSize="small"
|
||||||
availableTags={[
|
availableTags={[
|
||||||
{ id: "1", name: "Archive", color: "#6b7280" }
|
{ id: "1", name: "Archive", color: "#6b7280" }
|
||||||
@@ -739,6 +744,7 @@ export function UIShowcaseClient() {
|
|||||||
priority="high"
|
priority="high"
|
||||||
tags={["Cancelled"]}
|
tags={["Cancelled"]}
|
||||||
source="manual"
|
source="manual"
|
||||||
|
todosCount={1}
|
||||||
fontSize="small"
|
fontSize="small"
|
||||||
availableTags={[
|
availableTags={[
|
||||||
{ id: "1", name: "Cancelled", color: "#ef4444" }
|
{ id: "1", name: "Cancelled", color: "#ef4444" }
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ interface TaskCardProps extends HTMLAttributes<HTMLDivElement> {
|
|||||||
tfsProject?: string;
|
tfsProject?: string;
|
||||||
tfsRepository?: string;
|
tfsRepository?: string;
|
||||||
|
|
||||||
|
// Task ID for todos count
|
||||||
|
todosCount?: number;
|
||||||
|
|
||||||
// Interactive
|
// Interactive
|
||||||
isDragging?: boolean;
|
isDragging?: boolean;
|
||||||
isPending?: boolean;
|
isPending?: boolean;
|
||||||
@@ -62,6 +65,7 @@ const TaskCard = forwardRef<HTMLDivElement, TaskCardProps>(
|
|||||||
tfsPullRequestId,
|
tfsPullRequestId,
|
||||||
tfsProject,
|
tfsProject,
|
||||||
tfsRepository,
|
tfsRepository,
|
||||||
|
todosCount,
|
||||||
isDragging = false,
|
isDragging = false,
|
||||||
isPending = false,
|
isPending = false,
|
||||||
onEdit,
|
onEdit,
|
||||||
@@ -519,6 +523,13 @@ const TaskCard = forwardRef<HTMLDivElement, TaskCardProps>(
|
|||||||
✓ DONE
|
✓ DONE
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Nombre de todos reliés */}
|
||||||
|
{todosCount !== undefined && todosCount > 0 && (
|
||||||
|
<Badge variant="outline" size="sm" className="text-cyan-400 border-cyan-400/30">
|
||||||
|
📝 {todosCount}
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export interface Task {
|
|||||||
tfsTargetBranch?: string;
|
tfsTargetBranch?: string;
|
||||||
|
|
||||||
assignee?: string;
|
assignee?: string;
|
||||||
|
todosCount?: number; // Nombre de todos reliés à cette tâche
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface pour les tags
|
// Interface pour les tags
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ export class TasksService {
|
|||||||
include: {
|
include: {
|
||||||
tag: true
|
tag: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
_count: {
|
||||||
|
select: {
|
||||||
|
dailyCheckboxes: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
take: filters?.limit, // Pas de limite par défaut - récupère toutes les tâches
|
take: filters?.limit, // Pas de limite par défaut - récupère toutes les tâches
|
||||||
@@ -338,6 +343,11 @@ export class TasksService {
|
|||||||
include: {
|
include: {
|
||||||
tag: true
|
tag: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
_count: {
|
||||||
|
select: {
|
||||||
|
dailyCheckboxes: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}> | Prisma.TaskGetPayload<object>): Task {
|
}> | Prisma.TaskGetPayload<object>): Task {
|
||||||
@@ -349,6 +359,12 @@ export class TasksService {
|
|||||||
tags = prismaTask.taskTags.map((tt) => tt.tag.name);
|
tags = prismaTask.taskTags.map((tt) => tt.tag.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extraire le count des todos
|
||||||
|
let todosCount = 0;
|
||||||
|
if ('_count' in prismaTask && prismaTask._count) {
|
||||||
|
todosCount = prismaTask._count.dailyCheckboxes || 0;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: prismaTask.id,
|
id: prismaTask.id,
|
||||||
title: prismaTask.title,
|
title: prismaTask.title,
|
||||||
@@ -371,7 +387,8 @@ export class TasksService {
|
|||||||
tfsRepository: prismaTask.tfsRepository ?? undefined,
|
tfsRepository: prismaTask.tfsRepository ?? undefined,
|
||||||
tfsSourceBranch: prismaTask.tfsSourceBranch ?? undefined,
|
tfsSourceBranch: prismaTask.tfsSourceBranch ?? undefined,
|
||||||
tfsTargetBranch: prismaTask.tfsTargetBranch ?? undefined,
|
tfsTargetBranch: prismaTask.tfsTargetBranch ?? undefined,
|
||||||
assignee: prismaTask.assignee ?? undefined
|
assignee: prismaTask.assignee ?? undefined,
|
||||||
|
todosCount: todosCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user