dify/web/app/components/plugins/update-plugin/index.tsx

34 lines
721 B
TypeScript
Raw Normal View History

2024-10-16 18:05:55 +08:00
'use client'
import type { FC } from 'react'
2024-11-05 15:11:44 +08:00
import React from 'react'
import type { UpdatePluginModalType } from '../types'
import { PluginSource } from '../types'
import UpdateFromGitHub from './from-github'
import UpdateFromMarketplace from './from-market-place'
2024-10-16 18:05:55 +08:00
2024-11-05 15:11:44 +08:00
const UpdatePlugin: FC<UpdatePluginModalType> = ({
type,
marketPlace,
github,
onCancel,
onSave,
2024-10-16 18:05:55 +08:00
}) => {
2024-11-05 15:11:44 +08:00
if (type === PluginSource.github) {
return (
<UpdateFromGitHub
payload={github!}
onSave={onSave}
onCancel={onCancel}
/>
)
}
2024-10-16 18:05:55 +08:00
return (
2024-11-05 15:11:44 +08:00
<UpdateFromMarketplace
payload={marketPlace!}
onSave={onSave}
onCancel={onCancel}
/>
2024-10-16 18:05:55 +08:00
)
}
2024-11-05 15:11:44 +08:00
export default React.memo(UpdatePlugin)