import { useMemo, useState, } from 'react' import { RiCheckboxCircleFill, RiErrorWarningFill, RiInstallLine, } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { usePluginTaskStatus } from './hooks' import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' import Tooltip from '@/app/components/base/tooltip' import Button from '@/app/components/base/button' import ProgressCircle from '@/app/components/base/progress-bar/progress-circle' import CardIcon from '@/app/components/plugins/card/base/card-icon' import cn from '@/utils/classnames' import { useGetLanguage } from '@/context/i18n' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' import DownloadingIcon from '@/app/components/header/plugins-nav/downloading-icon' const PluginTasks = () => { const { t } = useTranslation() const language = useGetLanguage() const [open, setOpen] = useState(false) const { errorPlugins, runningPluginsLength, successPluginsLength, errorPluginsLength, totalPluginsLength, isInstalling, isInstallingWithSuccess, isInstallingWithError, isSuccess, isFailed, handleClearErrorPlugin, handleClearAllErrorPlugin, opacity, } = usePluginTaskStatus() const { getIconUrl } = useGetIcon() const tip = useMemo(() => { if (isInstalling) return t('plugin.task.installing', { installingLength: runningPluginsLength }) if (isInstallingWithSuccess) return t('plugin.task.installingWithSuccess', { installingLength: runningPluginsLength, successLength: successPluginsLength }) if (isInstallingWithError) return t('plugin.task.installingWithError', { installingLength: runningPluginsLength, successLength: successPluginsLength, errorLength: errorPluginsLength }) if (isFailed) return t('plugin.task.installError', { errorLength: errorPluginsLength }) }, [isInstalling, isInstallingWithSuccess, isInstallingWithError, isFailed, errorPluginsLength, runningPluginsLength, successPluginsLength, t]) if (!totalPluginsLength) return null return (