2025-12-03 21:56:50 +00:00
|
|
|
/**
|
|
|
|
|
* Composant TimeDisplay
|
|
|
|
|
* Affiche le temps actuel et la durée totale au format MM:SS
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { formatTime } from '../services/playerService';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
|
|
|
|
|
export interface TimeDisplayProps {
|
|
|
|
|
currentTime: number;
|
|
|
|
|
duration: number;
|
|
|
|
|
className?: string;
|
|
|
|
|
showSeparator?: boolean;
|
|
|
|
|
separator?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function TimeDisplay({
|
|
|
|
|
currentTime,
|
|
|
|
|
duration,
|
|
|
|
|
className,
|
|
|
|
|
showSeparator = true,
|
|
|
|
|
separator = ' / ',
|
|
|
|
|
}: TimeDisplayProps) {
|
|
|
|
|
const formattedCurrentTime = formatTime(currentTime);
|
|
|
|
|
const formattedDuration = formatTime(duration);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
2026-02-07 14:33:31 +00:00
|
|
|
'flex items-center text-sm text-muted-foreground',
|
2025-12-13 02:34:34 +00:00
|
|
|
className,
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
|
|
|
|
role="timer"
|
|
|
|
|
aria-live="polite"
|
|
|
|
|
aria-atomic="true"
|
|
|
|
|
>
|
|
|
|
|
<span aria-label={`Temps actuel: ${formattedCurrentTime}`}>
|
|
|
|
|
{formattedCurrentTime}
|
|
|
|
|
</span>
|
|
|
|
|
{showSeparator && (
|
|
|
|
|
<span className="mx-1" aria-hidden="true">
|
|
|
|
|
{separator}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
<span aria-label={`Durée totale: ${formattedDuration}`}>
|
|
|
|
|
{formattedDuration}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default TimeDisplay;
|