195 lines
4.4 KiB
TypeScript
195 lines
4.4 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> = {
|
|
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;
|
|
};
|
|
|
|
export const getPriorityColorHex = (color: PriorityConfig['color']): string => {
|
|
const colorMap = {
|
|
blue: '#60a5fa',
|
|
yellow: '#fbbf24',
|
|
purple: '#a78bfa',
|
|
red: '#f87171'
|
|
};
|
|
return colorMap[color];
|
|
};
|