fix: not show from market bundle package icon

This commit is contained in:
Joel 2024-11-26 14:07:45 +08:00
parent b84b0c8ba8
commit 4b77ced4ad
5 changed files with 14 additions and 0 deletions

View File

@ -11,12 +11,14 @@ type Props = {
checked: boolean
onCheckedChange: (plugin: Plugin) => void
payload: PackageDependency
isFromMarketPlace?: boolean
}
const PackageItem: FC<Props> = ({
payload,
checked,
onCheckedChange,
isFromMarketPlace,
}) => {
if (!payload.value?.manifest)
return <LoadingError />
@ -27,6 +29,7 @@ const PackageItem: FC<Props> = ({
payload={plugin}
checked={checked}
onCheckedChange={onCheckedChange}
isFromMarketPlace={isFromMarketPlace}
/>
)
}

View File

@ -11,6 +11,7 @@ type Props = {
onStepChange: (step: InstallStep) => void,
allPlugins: Dependency[]
onClose: () => void
isFromMarketPlace?: boolean
}
const ReadyToInstall: FC<Props> = ({
@ -18,6 +19,7 @@ const ReadyToInstall: FC<Props> = ({
onStepChange,
allPlugins,
onClose,
isFromMarketPlace,
}) => {
const [installedPlugins, setInstalledPlugins] = useState<Plugin[]>([])
const [installStatus, setInstallStatus] = useState<InstallStatusResponse[]>([])
@ -33,6 +35,7 @@ const ReadyToInstall: FC<Props> = ({
allPlugins={allPlugins}
onCancel={onClose}
onInstalled={handleInstalled}
isFromMarketPlace={isFromMarketPlace}
/>
)}
{step === InstallStep.installed && (

View File

@ -14,6 +14,7 @@ type Props = {
selectedPlugins: Plugin[]
onSelect: (plugin: Plugin, selectedIndex: number) => void
onLoadedAllPlugin: () => void
isFromMarketPlace?: boolean
}
const InstallByDSLList: FC<Props> = ({
@ -21,6 +22,7 @@ const InstallByDSLList: FC<Props> = ({
selectedPlugins,
onSelect,
onLoadedAllPlugin,
isFromMarketPlace,
}) => {
// DSL has id, to get plugin info to show more info
const { isLoading: isFetchingMarketplaceDataById, data: infoGetById, error: infoByIdError } = useFetchPluginsInMarketPlaceByIds(allPlugins.filter(d => d.type === 'marketplace').map(d => (d as GitHubItemAndMarketPlaceDependency).value.plugin_unique_identifier!))
@ -171,12 +173,14 @@ const InstallByDSLList: FC<Props> = ({
)
}
// Local package
return (
<PackageItem
key={index}
checked={!!selectedPlugins.find(p => p.plugin_id === plugins[index]?.plugin_id)}
onCheckedChange={handleSelect(index)}
payload={d as PackageDependency}
isFromMarketPlace={isFromMarketPlace}
/>
)
})

View File

@ -14,12 +14,14 @@ type Props = {
allPlugins: Dependency[]
onInstalled: (plugins: Plugin[], installStatus: InstallStatusResponse[]) => void
onCancel: () => void
isFromMarketPlace?: boolean
}
const Install: FC<Props> = ({
allPlugins,
onInstalled,
onCancel,
isFromMarketPlace,
}) => {
const { t } = useTranslation()
const [selectedPlugins, setSelectedPlugins] = React.useState<Plugin[]>([])
@ -75,6 +77,7 @@ const Install: FC<Props> = ({
selectedPlugins={selectedPlugins}
onSelect={handleSelect}
onLoadedAllPlugin={handleLoadedAllPlugin}
isFromMarketPlace={isFromMarketPlace}
/>
</div>
</div>

View File

@ -83,6 +83,7 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({
onStepChange={setStep}
onClose={onClose}
allPlugins={dependencies!}
isFromMarketPlace
/>
) : (<>
{