fix: can not get url

This commit is contained in:
Joel
2024-11-15 15:03:08 +08:00
parent 984e4564f8
commit 0738c2ef54
3 changed files with 18 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import type { Plugin } from '../../../types'
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'
type Props = {
checked: boolean
@ -17,6 +18,7 @@ const LoadedItem: FC<Props> = ({
onCheckedChange,
payload,
}) => {
const { getIconUrl } = useGetIcon()
return (
<div className='flex items-center space-x-2'>
<Checkbox
@ -26,7 +28,10 @@ const LoadedItem: FC<Props> = ({
/>
<Card
className='grow'
payload={payload}
payload={{
...payload,
icon: getIconUrl(payload.icon),
}}
titleLeft={payload.version ? <Badge className='mx-1' size="s" state={BadgeState.Default}>{payload.version}</Badge> : null}
/>
</div>

View File

@ -6,6 +6,7 @@ import Card from '@/app/components/plugins/card'
import Button from '@/app/components/base/button'
import { useTranslation } from 'react-i18next'
import Badge, { BadgeState } from '@/app/components/base/badge/index'
import useGetIcon from '../../base/use-get-icon'
type Props = {
list: Plugin[]
@ -19,6 +20,7 @@ const Installed: FC<Props> = ({
onCancel,
}) => {
const { t } = useTranslation()
const { getIconUrl } = useGetIcon()
return (
<>
<div className='flex flex-col px-6 py-3 justify-center items-start gap-4 self-stretch'>
@ -29,7 +31,10 @@ const Installed: FC<Props> = ({
<Card
key={plugin.plugin_id}
className='w-full'
payload={plugin}
payload={{
...plugin,
icon: getIconUrl(plugin.icon),
}}
installed={installStatus[index].success}
installFailed={!installStatus[index].success}
titleLeft={plugin.version ? <Badge className='mx-1' size="s" state={BadgeState.Default}>{plugin.version}</Badge> : null}