Initial commit
This commit is contained in:
52
components/chantiers/ChantierUrgencyIndicator.tsx
Normal file
52
components/chantiers/ChantierUrgencyIndicator.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Composant pour les indicateurs d'urgence des chantiers
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { URGENCE_INDICATORS } from './ChantierStyles';
|
||||
import { ChantierActif } from '../../hooks/useDashboard';
|
||||
|
||||
interface ChantierUrgencyIndicatorProps {
|
||||
chantier: ChantierActif;
|
||||
size?: 'small' | 'normal' | 'large';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const ChantierUrgencyIndicator: React.FC<ChantierUrgencyIndicatorProps> = ({
|
||||
chantier,
|
||||
size = 'normal',
|
||||
className = ''
|
||||
}) => {
|
||||
const sizeClasses = {
|
||||
small: 'text-sm',
|
||||
normal: 'text-base',
|
||||
large: 'text-xl'
|
||||
};
|
||||
|
||||
const getUrgencyType = () => {
|
||||
if (chantier.statut === 'EN_RETARD') {
|
||||
return 'RETARD';
|
||||
}
|
||||
if (chantier.avancement >= 90) {
|
||||
return 'BIENTOT_TERMINE';
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const urgencyType = getUrgencyType();
|
||||
|
||||
if (!urgencyType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const indicator = URGENCE_INDICATORS[urgencyType];
|
||||
|
||||
return (
|
||||
<i
|
||||
className={`${indicator.icon} ${indicator.color} ${sizeClasses[size]} ${className}`}
|
||||
title={indicator.tooltip}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChantierUrgencyIndicator;
|
||||
Reference in New Issue
Block a user