'use client' import type { FC } from 'react' import React from 'react' import type { PluginDeclaration } from '../../../types' import Card from '../../../card' import { pluginManifestToCardPluginProps } from '../../utils' import Button from '@/app/components/base/button' import { sleep } from '@/utils' import { Trans, useTranslation } from 'react-i18next' import { RiLoader2Line } from '@remixicon/react' import Badge, { BadgeState } from '@/app/components/base/badge/index' import { installPackageFromLocal } from '@/service/plugins' const i18nPrefix = 'plugin.installModal' type Props = { uniqueIdentifier: string payload: PluginDeclaration onCancel: () => void onInstalled: () => void onFailed: () => void } const Installed: FC = ({ uniqueIdentifier, payload, onCancel, onInstalled, onFailed, }) => { const { t } = useTranslation() const [isInstalling, setIsInstalling] = React.useState(false) const handleInstall = async () => { if (isInstalling) return setIsInstalling(true) try { await installPackageFromLocal(uniqueIdentifier) onInstalled() } catch (e) { onFailed() } await sleep(1500) } return ( <>

{t(`${i18nPrefix}.readyToInstall`)}

}} />

{payload.version}} />
{/* Action Buttons */}
{!isInstalling && ( )}
) } export default React.memo(Installed)