30 lines
964 B
TypeScript
30 lines
964 B
TypeScript
export function useClientTicketHelpers() {
|
|
function typeBadgeClass(type: string): string {
|
|
switch (type) {
|
|
case 'bug': return 'bg-red-500'
|
|
case 'improvement': return 'bg-blue-500'
|
|
default: return 'bg-neutral-500'
|
|
}
|
|
}
|
|
|
|
function statusBadgeClass(status: string): string {
|
|
switch (status) {
|
|
case 'new': return 'bg-blue-100 text-blue-700'
|
|
case 'in_progress': return 'bg-yellow-100 text-yellow-700'
|
|
case 'done': return 'bg-green-100 text-green-700'
|
|
case 'rejected': return 'bg-red-100 text-red-700'
|
|
default: return 'bg-neutral-100 text-neutral-700'
|
|
}
|
|
}
|
|
|
|
function formatDate(iso: string): string {
|
|
return new Date(iso).toLocaleDateString('fr-FR', {
|
|
day: 'numeric',
|
|
month: 'short',
|
|
year: 'numeric',
|
|
})
|
|
}
|
|
|
|
return { typeBadgeClass, statusBadgeClass, formatDate }
|
|
}
|