|
|
|
@ -10,6 +10,7 @@ import { Group } from '@/app/components/base/icons/src/vender/other'
|
|
|
|
type Status = 'not-installed' | 'not-authorized' | undefined
|
|
|
|
type Status = 'not-installed' | 'not-authorized' | undefined
|
|
|
|
|
|
|
|
|
|
|
|
export type ToolIconProps = {
|
|
|
|
export type ToolIconProps = {
|
|
|
|
|
|
|
|
id: string
|
|
|
|
providerName: string
|
|
|
|
providerName: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -29,10 +30,11 @@ export const ToolIcon = memo(({ providerName }: ToolIconProps) => {
|
|
|
|
const author = providerNameParts[0]
|
|
|
|
const author = providerNameParts[0]
|
|
|
|
const name = providerNameParts[1]
|
|
|
|
const name = providerNameParts[1]
|
|
|
|
const icon = useMemo(() => {
|
|
|
|
const icon = useMemo(() => {
|
|
|
|
|
|
|
|
if (!isDataReady) return ''
|
|
|
|
if (currentProvider) return currentProvider.icon as string
|
|
|
|
if (currentProvider) return currentProvider.icon as string
|
|
|
|
const iconFromMarketPlace = getIconFromMarketPlace(`${author}/${name}`)
|
|
|
|
const iconFromMarketPlace = getIconFromMarketPlace(`${author}/${name}`)
|
|
|
|
return iconFromMarketPlace
|
|
|
|
return iconFromMarketPlace
|
|
|
|
}, [author, currentProvider, name])
|
|
|
|
}, [author, currentProvider, name, isDataReady])
|
|
|
|
const status: Status = useMemo(() => {
|
|
|
|
const status: Status = useMemo(() => {
|
|
|
|
if (!isDataReady) return undefined
|
|
|
|
if (!isDataReady) return undefined
|
|
|
|
if (!currentProvider) return 'not-installed'
|
|
|
|
if (!currentProvider) return 'not-installed'
|
|
|
|
@ -60,7 +62,7 @@ export const ToolIcon = memo(({ providerName }: ToolIconProps) => {
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
ref={containerRef}
|
|
|
|
ref={containerRef}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{!iconFetchError
|
|
|
|
{(!iconFetchError && isDataReady)
|
|
|
|
|
|
|
|
|
|
|
|
? <img
|
|
|
|
? <img
|
|
|
|
src={icon}
|
|
|
|
src={icon}
|
|
|
|
|