mirror of
				https://github.com/langgenius/dify.git
				synced 2025-11-04 12:53:38 +00:00 
			
		
		
		
	
		
			
	
	
		
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			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'
							 | 
						||
| 
								 | 
							
								import type { VersionProps } from '@/app/components/plugins/types'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type Props = {
							 | 
						||
| 
								 | 
							
								  checked: boolean
							 | 
						||
| 
								 | 
							
								  onCheckedChange: (plugin: Plugin) => void
							 | 
						||
| 
								 | 
							
								  payload: PackageDependency
							 | 
						||
| 
								 | 
							
								  isFromMarketPlace?: boolean
							 | 
						||
| 
								 | 
							
								  versionInfo: VersionProps
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const PackageItem: FC<Props> = ({
							 | 
						||
| 
								 | 
							
								  payload,
							 | 
						||
| 
								 | 
							
								  checked,
							 | 
						||
| 
								 | 
							
								  onCheckedChange,
							 | 
						||
| 
								 | 
							
								  isFromMarketPlace,
							 | 
						||
| 
								 | 
							
								  versionInfo,
							 | 
						||
| 
								 | 
							
								}) => {
							 | 
						||
| 
								 | 
							
								  if (!payload.value?.manifest)
							 | 
						||
| 
								 | 
							
								    return <LoadingError />
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const plugin = pluginManifestToCardPluginProps(payload.value.manifest)
							 | 
						||
| 
								 | 
							
								  return (
							 | 
						||
| 
								 | 
							
								    <LoadedItem
							 | 
						||
| 
								 | 
							
								      payload={plugin}
							 | 
						||
| 
								 | 
							
								      checked={checked}
							 | 
						||
| 
								 | 
							
								      onCheckedChange={onCheckedChange}
							 | 
						||
| 
								 | 
							
								      isFromMarketPlace={isFromMarketPlace}
							 | 
						||
| 
								 | 
							
								      versionInfo={versionInfo}
							 | 
						||
| 
								 | 
							
								    />
							 | 
						||
| 
								 | 
							
								  )
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default React.memo(PackageItem)
							 |