import { IconX } from '@tabler/icons-react'
/**
* Компонент для отображения прогресса долгих операций
* Показывает progress bar и возможность отмены
*/
function ProgressIndicator({
progress = 0, // 0-100
total = 100,
current = 0,
message = 'Обработка...',
onCancel = null,
variant = 'blue', // blue, green, red, yellow, purple
showPercentage = true,
showCount = true,
animated = true,
className = ''
}) {
const percentage = total > 0 ? Math.min(100, Math.max(0, (current / total) * 100)) : progress
return (
{message}
{onCancel && (
)}
{/* Progress bar */}
{/* Статистика */}
{showCount && total > 0 && (
Обработано: {current} из {total}
)}
{showPercentage && (
{percentage.toFixed(0)}%
)}
)
}
/**
* Линейный progress indicator (более компактный)
*/
export function LinearProgress({
progress = 0,
variant = 'blue',
message = null,
className = ''
}) {
return (
{message && (
{message}
)}
0 ? { width: `${progress}%` } : {}}
>
)
}
/**
* Circular progress (кольцевой индикатор)
*/
export function CircularProgress({
progress = 0,
size = 64,
strokeWidth = 4,
variant = 'blue',
showPercentage = true,
className = ''
}) {
const radius = (size - strokeWidth) / 2
const circumference = radius * 2 * Math.PI
const offset = circumference - (progress / 100) * circumference
// Цвета Tabler
const colors = {
blue: '#206bc4',
green: '#2fb344',
red: '#d63939',
yellow: '#f76707',
purple: '#ae3ec9',
azure: '#4299e1'
}
return (
)
}
export default ProgressIndicator