mirror of
https://github.com/langgenius/dify.git
synced 2026-05-02 15:17:39 +08:00
fix: add plugin type to card payload and integrate categories hook
This commit is contained in:
parent
3f2baf0131
commit
70bf321fd7
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
import type { PluginDeclaration, UpdateFromGitHubPayload } from '../../../types'
|
import type { PluginDeclaration, PluginType, UpdateFromGitHubPayload } from '../../../types'
|
||||||
import Card from '../../../card'
|
import Card from '../../../card'
|
||||||
import Badge, { BadgeState } from '@/app/components/base/badge/index'
|
import Badge, { BadgeState } from '@/app/components/base/badge/index'
|
||||||
import { pluginManifestToCardPluginProps } from '../../utils'
|
import { pluginManifestToCardPluginProps } from '../../utils'
|
||||||
@ -13,6 +13,7 @@ import { RiLoader2Line } from '@remixicon/react'
|
|||||||
import { usePluginTaskList } from '@/service/use-plugins'
|
import { usePluginTaskList } from '@/service/use-plugins'
|
||||||
import checkTaskStatus from '../../base/check-task-status'
|
import checkTaskStatus from '../../base/check-task-status'
|
||||||
import { parseGitHubUrl } from '../../utils'
|
import { parseGitHubUrl } from '../../utils'
|
||||||
|
import { useCategories } from '../../../hooks'
|
||||||
|
|
||||||
type LoadedProps = {
|
type LoadedProps = {
|
||||||
updatePayload: UpdateFromGitHubPayload
|
updatePayload: UpdateFromGitHubPayload
|
||||||
@ -40,6 +41,7 @@ const Loaded: React.FC<LoadedProps> = ({
|
|||||||
onFailed,
|
onFailed,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const { categoriesMap } = useCategories()
|
||||||
const [isInstalling, setIsInstalling] = React.useState(false)
|
const [isInstalling, setIsInstalling] = React.useState(false)
|
||||||
const { mutateAsync: installPackageFromGitHub } = useInstallPackageFromGitHub()
|
const { mutateAsync: installPackageFromGitHub } = useInstallPackageFromGitHub()
|
||||||
const { handleRefetch } = usePluginTaskList()
|
const { handleRefetch } = usePluginTaskList()
|
||||||
@ -115,7 +117,7 @@ const Loaded: React.FC<LoadedProps> = ({
|
|||||||
<div className='flex p-2 items-start content-start gap-1 self-stretch flex-wrap rounded-2xl bg-background-section-burn'>
|
<div className='flex p-2 items-start content-start gap-1 self-stretch flex-wrap rounded-2xl bg-background-section-burn'>
|
||||||
<Card
|
<Card
|
||||||
className='w-full'
|
className='w-full'
|
||||||
payload={pluginManifestToCardPluginProps(payload)}
|
payload={{ ...pluginManifestToCardPluginProps(payload), type: categoriesMap[payload.category].label as PluginType }}
|
||||||
titleLeft={<Badge className='mx-1' size="s" state={BadgeState.Default}>{payload.version}</Badge>}
|
titleLeft={<Badge className='mx-1' size="s" state={BadgeState.Default}>{payload.version}</Badge>}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user