dify/web/app/components/plugins/install-plugin/install-bundle/item/package-item.tsx
2024-11-20 14:27:46 +08:00

35 lines
820 B
TypeScript

'use client'
import type { FC } from 'react'
import React from 'react'
import type { Plugin } from '../../../types'
import type { PackageDependency } from '../../../types'
import { pluginManifestToCardPluginProps } from '../../utils'
import LoadedItem from './loaded-item'
import LoadingError from '../../base/loading-error'
type Props = {
checked: boolean
onCheckedChange: (plugin: Plugin) => void
payload: PackageDependency
}
const PackageItem: FC<Props> = ({
payload,
checked,
onCheckedChange,
}) => {
if (!payload.value?.manifest)
return <LoadingError />
const plugin = pluginManifestToCardPluginProps(payload.value.manifest)
return (
<LoadedItem
payload={plugin}
checked={checked}
onCheckedChange={onCheckedChange}
/>
)
}
export default React.memo(PackageItem)