mirror of
https://github.com/langgenius/dify.git
synced 2026-04-26 18:27:15 +08:00
feat: add install
This commit is contained in:
parent
fcde5b5c9e
commit
4cfbcd9c79
@ -6,6 +6,8 @@ import type { Plugin } from '@/app/components/plugins/types'
|
|||||||
import { MARKETPLACE_URL_PREFIX } from '@/config'
|
import { MARKETPLACE_URL_PREFIX } from '@/config'
|
||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
||||||
|
import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace'
|
||||||
|
import { useBoolean } from 'ahooks'
|
||||||
|
|
||||||
type CardWrapperProps = {
|
type CardWrapperProps = {
|
||||||
plugin: Plugin
|
plugin: Plugin
|
||||||
@ -18,6 +20,12 @@ const CardWrapper = ({
|
|||||||
locale,
|
locale,
|
||||||
}: CardWrapperProps) => {
|
}: CardWrapperProps) => {
|
||||||
const { t } = useMixedTranslation(locale)
|
const { t } = useMixedTranslation(locale)
|
||||||
|
const [isShowInstallFromMarketplace, {
|
||||||
|
setTrue: showInstallFromMarketplace,
|
||||||
|
setFalse: hideInstallFromMarketplace,
|
||||||
|
}] = useBoolean(false)
|
||||||
|
console.log(plugin)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className='group relative rounded-xl cursor-pointer'
|
className='group relative rounded-xl cursor-pointer'
|
||||||
@ -43,6 +51,7 @@ const CardWrapper = ({
|
|||||||
<Button
|
<Button
|
||||||
variant='primary'
|
variant='primary'
|
||||||
className='flex-1'
|
className='flex-1'
|
||||||
|
onClick={showInstallFromMarketplace}
|
||||||
>
|
>
|
||||||
{t('plugin.detailPanel.operation.install')}
|
{t('plugin.detailPanel.operation.install')}
|
||||||
</Button>
|
</Button>
|
||||||
@ -57,6 +66,16 @@ const CardWrapper = ({
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
isShowInstallFromMarketplace && (
|
||||||
|
<InstallFromMarketplace
|
||||||
|
manifest={plugin as any}
|
||||||
|
uniqueIdentifier={plugin.latest_package_identifier}
|
||||||
|
onClose={hideInstallFromMarketplace}
|
||||||
|
onSuccess={hideInstallFromMarketplace}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,6 +110,7 @@ export type Plugin = {
|
|||||||
plugin_id: string
|
plugin_id: string
|
||||||
version: string
|
version: string
|
||||||
latest_version: string
|
latest_version: string
|
||||||
|
latest_package_identifier: string
|
||||||
icon: string
|
icon: string
|
||||||
verified: boolean
|
verified: boolean
|
||||||
label: Record<Locale, string>
|
label: Record<Locale, string>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user