import type { FC } from 'react' import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' import { ProgressCircle } from '@langgenius/dify-ui/progress' import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip' import DownloadingIcon from '@/app/components/header/plugins-nav/downloading-icon' 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 ( {showDownloadingIcon ? : ( )}
{(isInstalling || isInstallingWithSuccess) && ( 0 ? successPluginsLength / totalPluginsLength : 0) * 100} aria-label={tip} /> )} {isInstallingWithError && ( 0 ? runningPluginsLength / totalPluginsLength : 0) * 100} color="error" aria-label={tip} /> )} {showSuccessIcon && !isInstalling && !isInstallingWithSuccess && !isInstallingWithError && ( )} {isFailed && ( )}
)} /> {tip}
) } export default TaskStatusIndicator