- Updated `TODO.md` to reflect new testing tasks and final structure expectations. - Simplified TypeScript path mappings in `tsconfig.json` for better clarity. - Revised business logic separation rules in `.cursor/rules` to align with new directory structure. - Deleted unused client components and services to streamline the codebase. - Adjusted import paths in scripts to match the new structure.
267 lines
6.8 KiB
TypeScript
267 lines
6.8 KiB
TypeScript
import { TaskStatus, TaskPriority } from './types';
|
|
|
|
export interface StatusConfig {
|
|
key: TaskStatus;
|
|
label: string;
|
|
icon: string;
|
|
color: 'gray' | 'blue' | 'green' | 'red' | 'purple';
|
|
order: number;
|
|
}
|
|
|
|
export const STATUS_CONFIG: Record<TaskStatus, StatusConfig> = {
|
|
backlog: {
|
|
key: 'backlog',
|
|
label: 'Backlog',
|
|
icon: '📋',
|
|
color: 'gray',
|
|
order: 0
|
|
},
|
|
todo: {
|
|
key: 'todo',
|
|
label: 'À faire',
|
|
icon: '⚡',
|
|
color: 'gray',
|
|
order: 1
|
|
},
|
|
in_progress: {
|
|
key: 'in_progress',
|
|
label: 'En cours',
|
|
icon: '⚙️',
|
|
color: 'blue',
|
|
order: 2
|
|
},
|
|
freeze: {
|
|
key: 'freeze',
|
|
label: 'Gelé',
|
|
icon: '🧊',
|
|
color: 'purple',
|
|
order: 3
|
|
},
|
|
done: {
|
|
key: 'done',
|
|
label: 'Terminé',
|
|
icon: '✓',
|
|
color: 'green',
|
|
order: 4
|
|
},
|
|
cancelled: {
|
|
key: 'cancelled',
|
|
label: 'Annulé',
|
|
icon: '✕',
|
|
color: 'red',
|
|
order: 5
|
|
},
|
|
archived: {
|
|
key: 'archived',
|
|
label: 'Archivé',
|
|
icon: '📦',
|
|
color: 'gray',
|
|
order: 6
|
|
}
|
|
} as const;
|
|
|
|
// Utilitaires pour récupérer facilement les infos
|
|
export const getStatusConfig = (status: TaskStatus): StatusConfig => {
|
|
return STATUS_CONFIG[status];
|
|
};
|
|
|
|
export const getAllStatuses = (): StatusConfig[] => {
|
|
return Object.values(STATUS_CONFIG).sort((a, b) => a.order - b.order);
|
|
};
|
|
|
|
export const getStatusLabel = (status: TaskStatus): string => {
|
|
return STATUS_CONFIG[status].label;
|
|
};
|
|
|
|
export const getStatusIcon = (status: TaskStatus): string => {
|
|
return STATUS_CONFIG[status].icon;
|
|
};
|
|
|
|
export const getStatusColor = (status: TaskStatus): StatusConfig['color'] => {
|
|
return STATUS_CONFIG[status].color;
|
|
};
|
|
|
|
// Configuration des couleurs tech/cyberpunk
|
|
export const TECH_STYLES = {
|
|
gray: {
|
|
border: 'border-slate-700',
|
|
glow: 'shadow-slate-500/20',
|
|
accent: 'text-slate-400',
|
|
badge: 'bg-slate-800 text-slate-300 border border-slate-600'
|
|
},
|
|
blue: {
|
|
border: 'border-cyan-500/30',
|
|
glow: 'shadow-cyan-500/20',
|
|
accent: 'text-cyan-400',
|
|
badge: 'bg-cyan-950 text-cyan-300 border border-cyan-500/30'
|
|
},
|
|
green: {
|
|
border: 'border-emerald-500/30',
|
|
glow: 'shadow-emerald-500/20',
|
|
accent: 'text-emerald-400',
|
|
badge: 'bg-emerald-950 text-emerald-300 border border-emerald-500/30'
|
|
},
|
|
red: {
|
|
border: 'border-red-500/30',
|
|
glow: 'shadow-red-500/20',
|
|
accent: 'text-red-400',
|
|
badge: 'bg-red-950 text-red-300 border border-red-500/30'
|
|
},
|
|
purple: {
|
|
border: 'border-purple-500/30',
|
|
glow: 'shadow-purple-500/20',
|
|
accent: 'text-purple-400',
|
|
badge: 'bg-purple-950 text-purple-300 border border-purple-500/30'
|
|
}
|
|
} as const;
|
|
|
|
export const getTechStyle = (color: StatusConfig['color']) => {
|
|
return TECH_STYLES[color];
|
|
};
|
|
|
|
export const getBadgeVariant = (color: StatusConfig['color']): 'success' | 'primary' | 'danger' | 'default' => {
|
|
switch (color) {
|
|
case 'green': return 'success';
|
|
case 'blue':
|
|
case 'purple': return 'primary';
|
|
case 'red': return 'danger';
|
|
default: return 'default';
|
|
}
|
|
};
|
|
|
|
// Configuration des priorités
|
|
export interface PriorityConfig {
|
|
key: TaskPriority;
|
|
label: string;
|
|
icon: string;
|
|
color: 'blue' | 'yellow' | 'purple' | 'red';
|
|
order: number;
|
|
}
|
|
|
|
export const PRIORITY_CONFIG: Record<TaskPriority, PriorityConfig> = {
|
|
low: {
|
|
key: 'low',
|
|
label: 'Faible',
|
|
icon: '🔵',
|
|
color: 'blue',
|
|
order: 1
|
|
},
|
|
medium: {
|
|
key: 'medium',
|
|
label: 'Moyenne',
|
|
icon: '🟡',
|
|
color: 'yellow',
|
|
order: 2
|
|
},
|
|
high: {
|
|
key: 'high',
|
|
label: 'Élevée',
|
|
icon: '🟣',
|
|
color: 'purple',
|
|
order: 3
|
|
},
|
|
urgent: {
|
|
key: 'urgent',
|
|
label: 'Urgente',
|
|
icon: '🔴',
|
|
color: 'red',
|
|
order: 4
|
|
}
|
|
} as const;
|
|
|
|
// Utilitaires pour les priorités
|
|
export const getPriorityConfig = (priority: TaskPriority): PriorityConfig => {
|
|
return PRIORITY_CONFIG[priority];
|
|
};
|
|
|
|
export const getAllPriorities = (): PriorityConfig[] => {
|
|
return Object.values(PRIORITY_CONFIG).sort((a, b) => a.order - b.order);
|
|
};
|
|
|
|
export const getPriorityLabel = (priority: TaskPriority): string => {
|
|
return PRIORITY_CONFIG[priority].label;
|
|
};
|
|
|
|
export const getPriorityIcon = (priority: TaskPriority): string => {
|
|
return PRIORITY_CONFIG[priority].icon;
|
|
};
|
|
|
|
export const getPriorityColor = (priority: TaskPriority): PriorityConfig['color'] => {
|
|
return PRIORITY_CONFIG[priority].color;
|
|
};
|
|
|
|
// Configuration des couleurs HEX pour les priorités (cohérente avec le design)
|
|
export const PRIORITY_COLOR_MAP = {
|
|
blue: '#60a5fa', // blue-400 (low priority)
|
|
yellow: '#fbbf24', // amber-400 (medium priority)
|
|
purple: '#a78bfa', // violet-400 (high priority)
|
|
red: '#f87171' // red-400 (urgent priority)
|
|
} as const;
|
|
|
|
// Couleurs alternatives pour les graphiques et charts
|
|
export const PRIORITY_CHART_COLORS = {
|
|
'Faible': '#10b981', // green-500 (plus lisible dans les charts)
|
|
'Moyenne': '#f59e0b', // amber-500
|
|
'Élevée': '#8b5cf6', // violet-500
|
|
'Urgente': '#ef4444', // red-500
|
|
'Non définie': '#6b7280' // gray-500
|
|
} as const;
|
|
|
|
export const getPriorityColorHex = (color: PriorityConfig['color']): string => {
|
|
return PRIORITY_COLOR_MAP[color];
|
|
};
|
|
|
|
// Fonction pour récupérer la couleur d'un chart basée sur le label
|
|
export const getPriorityChartColor = (priorityLabel: string): string => {
|
|
return PRIORITY_CHART_COLORS[priorityLabel as keyof typeof PRIORITY_CHART_COLORS] || PRIORITY_CHART_COLORS['Non définie'];
|
|
};
|
|
|
|
// Configuration des couleurs pour les badges de statut
|
|
export const STATUS_BADGE_COLORS = {
|
|
backlog: 'bg-gray-100 text-gray-800',
|
|
todo: 'bg-gray-100 text-gray-800',
|
|
in_progress: 'bg-orange-100 text-orange-800',
|
|
freeze: 'bg-purple-100 text-purple-800',
|
|
done: 'bg-green-100 text-green-800',
|
|
cancelled: 'bg-red-100 text-red-800',
|
|
archived: 'bg-gray-100 text-gray-600'
|
|
} as const;
|
|
|
|
// Fonction pour récupérer les classes CSS d'un badge de statut
|
|
export const getStatusBadgeClasses = (status: TaskStatus): string => {
|
|
return STATUS_BADGE_COLORS[status] || STATUS_BADGE_COLORS.todo;
|
|
};
|
|
|
|
// Configuration des couleurs pour les cartes de statistiques du dashboard
|
|
export const DASHBOARD_STAT_COLORS = {
|
|
total: {
|
|
color: 'bg-blue-500',
|
|
textColor: 'text-blue-600',
|
|
progressColor: 'bg-blue-500',
|
|
dotColor: 'bg-blue-500'
|
|
},
|
|
todo: {
|
|
color: 'bg-gray-500',
|
|
textColor: 'text-gray-600',
|
|
progressColor: 'bg-gray-500',
|
|
dotColor: 'bg-gray-500'
|
|
},
|
|
inProgress: {
|
|
color: 'bg-orange-500',
|
|
textColor: 'text-orange-600',
|
|
progressColor: 'bg-orange-500',
|
|
dotColor: 'bg-orange-500'
|
|
},
|
|
completed: {
|
|
color: 'bg-green-500',
|
|
textColor: 'text-green-600',
|
|
progressColor: 'bg-green-500',
|
|
dotColor: 'bg-green-500'
|
|
}
|
|
} as const;
|
|
|
|
// Fonction pour récupérer les couleurs d'une stat du dashboard
|
|
export const getDashboardStatColors = (statType: keyof typeof DASHBOARD_STAT_COLORS) => {
|
|
return DASHBOARD_STAT_COLORS[statType];
|
|
};
|