import React from "react"; import { Box, Typography, LinearProgress, CircularProgress, } from "@mui/material"; interface ModelLoadingIndicatorProps { progress?: number; message?: string; isVisible?: boolean; variant?: "overlay" | "inline"; size?: "small" | "medium" | "large"; showDetails?: boolean; } export const ModelLoadingIndicator: React.FC = ({ progress = 0, message = "Загрузка 3D модели...", isVisible = true, variant = "overlay", size = "medium", showDetails = true, }) => { const sizeConfig = { small: { spinnerSize: 32, fontSize: "0.75rem", progressBarWidth: 150, padding: 2, }, medium: { spinnerSize: 48, fontSize: "0.875rem", progressBarWidth: 200, padding: 3, }, large: { spinnerSize: 64, fontSize: "1rem", progressBarWidth: 250, padding: 4, }, }; const currentSize = sizeConfig[size]; if (!isVisible) return null; const getProgressStage = (progress: number): string => { if (progress < 20) return "Инициализация..."; if (progress < 40) return "Загрузка геометрии..."; if (progress < 60) return "Обработка материалов..."; if (progress < 80) return "Загрузка текстур..."; if (progress < 95) return "Финализация..."; if (progress === 100) return "Готово!"; return "Загрузка..."; }; const content = ( {/* Крутяшка с процентами */} {`${Math.round(progress)}%`} {/* Линейный прогресс бар */} {/* Основное сообщение */} {message} {/* Детальная информация о прогрессе */} {showDetails && progress > 0 && ( {getProgressStage(progress)} )} ); if (variant === "overlay") { return ( {content} ); } return ( {content} ); };