import { Button } from '@langgenius/dify-ui/button' import { cn } from '@langgenius/dify-ui/cn' 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 disabled?: boolean isOpen?: boolean successPluginsLength: number runningPluginsLength: number totalPluginsLength: number onClick: () => void } function ErrorBadgeIcon() { return ( ) } function SuccessBadgeIcon() { return ( ) } function TaskStatusIndicator({ tip, isInstalling, isInstallingWithSuccess, isInstallingWithError, isSuccess, isFailed, disabled = false, isOpen = false, successPluginsLength, runningPluginsLength, onClick, }: TaskStatusIndicatorProps) { const showErrorStyle = isInstallingWithError || isFailed const hasActiveInstall = isInstalling || isInstallingWithSuccess || isInstallingWithError const showSuccessIcon = isSuccess || (!hasActiveInstall && !isFailed && successPluginsLength > 0 && runningPluginsLength === 0) const showSuccessBadge = showSuccessIcon && !isInstallingWithError && !isFailed const showBadge = isInstallingWithError || showSuccessBadge || isFailed const isClickable = !disabled && (hasActiveInstall || isSuccess || isFailed) return ( {showBadge && (
{isInstallingWithError && } {showSuccessBadge && } {isFailed && }
)} } /> {tip}
) } export default TaskStatusIndicator