import type { FC } from 'react' import { RiCheckboxCircleFill, RiErrorWarningFill, RiInstallLine, } from '@remixicon/react' import ProgressCircle from '@/app/components/base/progress-bar/progress-circle' import Tooltip from '@/app/components/base/tooltip' import DownloadingIcon from '@/app/components/header/plugins-nav/downloading-icon' import { cn } from '@/utils/classnames' export type TaskStatusIndicatorProps = { tip: string isInstalling: boolean isInstallingWithSuccess: boolean isInstallingWithError: boolean isSuccess: boolean isFailed: boolean successPluginsLength: number runningPluginsLength: number totalPluginsLength: number onClick: () => void } const TaskStatusIndicator: FC = ({ tip, isInstalling, isInstallingWithSuccess, isInstallingWithError, isSuccess, isFailed, successPluginsLength, runningPluginsLength, totalPluginsLength, onClick, }) => { const showDownloadingIcon = isInstalling || isInstallingWithError const showErrorStyle = isInstallingWithError || isFailed const showSuccessIcon = isSuccess || (successPluginsLength > 0 && runningPluginsLength === 0) return (
{/* Main Icon */} {showDownloadingIcon ? : ( )} {/* Status Indicator Badge */}
{(isInstalling || isInstallingWithSuccess) && ( 0 ? successPluginsLength / totalPluginsLength : 0) * 100} circleFillColor="fill-components-progress-brand-bg" /> )} {isInstallingWithError && ( 0 ? runningPluginsLength / totalPluginsLength : 0) * 100} circleFillColor="fill-components-progress-brand-bg" sectorFillColor="fill-components-progress-error-border" circleStrokeColor="stroke-components-progress-error-border" /> )} {showSuccessIcon && !isInstalling && !isInstallingWithSuccess && !isInstallingWithError && ( )} {isFailed && ( )}
) } export default TaskStatusIndicator