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

View File

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

View File

@ -14,6 +14,7 @@ type Props = {
selectedPlugins: Plugin[] selectedPlugins: Plugin[]
onSelect: (plugin: Plugin, selectedIndex: number) => void onSelect: (plugin: Plugin, selectedIndex: number) => void
onLoadedAllPlugin: () => void onLoadedAllPlugin: () => void
isFromMarketPlace?: boolean
} }
const InstallByDSLList: FC<Props> = ({ const InstallByDSLList: FC<Props> = ({
@ -21,6 +22,7 @@ const InstallByDSLList: FC<Props> = ({
selectedPlugins, selectedPlugins,
onSelect, onSelect,
onLoadedAllPlugin, onLoadedAllPlugin,
isFromMarketPlace,
}) => { }) => {
// DSL has id, to get plugin info to show more info // 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!)) 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 ( return (
<PackageItem <PackageItem
key={index} key={index}
checked={!!selectedPlugins.find(p => p.plugin_id === plugins[index]?.plugin_id)} checked={!!selectedPlugins.find(p => p.plugin_id === plugins[index]?.plugin_id)}
onCheckedChange={handleSelect(index)} onCheckedChange={handleSelect(index)}
payload={d as PackageDependency} payload={d as PackageDependency}
isFromMarketPlace={isFromMarketPlace}
/> />
) )
}) })

View File

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

View File

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