feat: add backlog status and update task stats
- Introduced 'backlog' status in TaskStatus type and STATUS_CONFIG for better task categorization. - Updated TaskStats interface to include backlog count. - Enhanced getTaskStats method to fetch backlog statistics and display in Header component. - Added backlog stat card in Header for improved visibility of task status.
This commit is contained in:
@@ -90,6 +90,13 @@ export function Header({ title, subtitle, stats, syncing = false }: HeaderProps)
|
|||||||
color="yellow"
|
color="yellow"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{stats.backlog > 0 && (
|
||||||
|
<StatCard
|
||||||
|
label="BACKLOG"
|
||||||
|
value={String(stats.backlog).padStart(2, '0')}
|
||||||
|
color="gray"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{stats.todo > 0 && (
|
{stats.todo > 0 && (
|
||||||
<StatCard
|
<StatCard
|
||||||
label="QUEUE"
|
label="QUEUE"
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ export interface StatusConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const STATUS_CONFIG: Record<TaskStatus, StatusConfig> = {
|
export const STATUS_CONFIG: Record<TaskStatus, StatusConfig> = {
|
||||||
|
backlog: {
|
||||||
|
key: 'backlog',
|
||||||
|
label: 'Backlog',
|
||||||
|
icon: '📋',
|
||||||
|
color: 'gray',
|
||||||
|
order: 0
|
||||||
|
},
|
||||||
todo: {
|
todo: {
|
||||||
key: 'todo',
|
key: 'todo',
|
||||||
label: 'À faire',
|
label: 'À faire',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Types de base pour les tâches
|
// Types de base pour les tâches
|
||||||
// Note: TaskStatus et TaskPriority sont maintenant gérés par la configuration centralisée dans lib/status-config.ts
|
// Note: TaskStatus et TaskPriority sont maintenant gérés par la configuration centralisée dans lib/status-config.ts
|
||||||
export type TaskStatus = 'todo' | 'in_progress' | 'done' | 'cancelled' | 'freeze' | 'archived';
|
export type TaskStatus = 'backlog' | 'todo' | 'in_progress' | 'done' | 'cancelled' | 'freeze' | 'archived';
|
||||||
export type TaskPriority = 'low' | 'medium' | 'high' | 'urgent';
|
export type TaskPriority = 'low' | 'medium' | 'high' | 'urgent';
|
||||||
export type TaskSource = 'reminders' | 'jira' | 'manual';
|
export type TaskSource = 'reminders' | 'jira' | 'manual';
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ export interface TaskStats {
|
|||||||
completed: number;
|
completed: number;
|
||||||
inProgress: number;
|
inProgress: number;
|
||||||
todo: number;
|
todo: number;
|
||||||
|
backlog: number;
|
||||||
cancelled: number;
|
cancelled: number;
|
||||||
freeze: number;
|
freeze: number;
|
||||||
archived: number;
|
archived: number;
|
||||||
|
|||||||
@@ -189,13 +189,15 @@ export class TasksService {
|
|||||||
* Récupère les statistiques des tâches
|
* Récupère les statistiques des tâches
|
||||||
*/
|
*/
|
||||||
async getTaskStats() {
|
async getTaskStats() {
|
||||||
const [total, completed, inProgress, todo, cancelled, freeze] = await Promise.all([
|
const [total, completed, inProgress, todo, backlog, cancelled, freeze, archived] = await Promise.all([
|
||||||
prisma.task.count(),
|
prisma.task.count(),
|
||||||
prisma.task.count({ where: { status: 'done' } }),
|
prisma.task.count({ where: { status: 'done' } }),
|
||||||
prisma.task.count({ where: { status: 'in_progress' } }),
|
prisma.task.count({ where: { status: 'in_progress' } }),
|
||||||
prisma.task.count({ where: { status: 'todo' } }),
|
prisma.task.count({ where: { status: 'todo' } }),
|
||||||
|
prisma.task.count({ where: { status: 'backlog' } }),
|
||||||
prisma.task.count({ where: { status: 'cancelled' } }),
|
prisma.task.count({ where: { status: 'cancelled' } }),
|
||||||
prisma.task.count({ where: { status: 'freeze' } })
|
prisma.task.count({ where: { status: 'freeze' } }),
|
||||||
|
prisma.task.count({ where: { status: 'archived' } })
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -203,8 +205,10 @@ export class TasksService {
|
|||||||
completed,
|
completed,
|
||||||
inProgress,
|
inProgress,
|
||||||
todo,
|
todo,
|
||||||
|
backlog,
|
||||||
cancelled,
|
cancelled,
|
||||||
freeze,
|
freeze,
|
||||||
|
archived,
|
||||||
completionRate: total > 0 ? Math.round((completed / total) * 100) : 0
|
completionRate: total > 0 ? Math.round((completed / total) * 100) : 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user