fix: market icon not show

This commit is contained in:
Joel
2024-11-15 16:35:09 +08:00
parent 746838e276
commit 3b032f086d
6 changed files with 25 additions and 10 deletions

View File

@ -6,17 +6,20 @@ import Card from '../../../card'
import Checkbox from '@/app/components/base/checkbox'
import Badge, { BadgeState } from '@/app/components/base/badge/index'
import useGetIcon from '../../base/use-get-icon'
import { MARKETPLACE_API_PREFIX } from '@/config'
type Props = {
checked: boolean
onCheckedChange: (plugin: Plugin) => void
payload: Plugin
isFromMarketPlace?: boolean
}
const LoadedItem: FC<Props> = ({
checked,
onCheckedChange,
payload,
isFromMarketPlace,
}) => {
const { getIconUrl } = useGetIcon()
return (
@ -30,7 +33,7 @@ const LoadedItem: FC<Props> = ({
className='grow'
payload={{
...payload,
icon: getIconUrl(payload.icon),
icon: isFromMarketPlace ? `${MARKETPLACE_API_PREFIX}/plugins/${payload.org}/${payload.name}/icon` : getIconUrl(payload.icon),
}}
titleLeft={payload.version ? <Badge className='mx-1' size="s" state={BadgeState.Default}>{payload.version}</Badge> : null}
/>

View File

@ -22,6 +22,7 @@ const MarketPlaceItem: FC<Props> = ({
checked={checked}
onCheckedChange={onCheckedChange}
payload={payload}
isFromMarketPlace
/>
)
}