@ -3,19 +3,26 @@ import React, { useMemo } from 'react'
import type { FC } from 'react'
import { useContext } from 'use-context-selector'
import { useTranslation } from 'react-i18next'
import { RiCloseLine , RiVerifiedBadgeLine } from '@remixicon/react'
import type { Plugin } from '../types'
// import { PluginType } from '../types'
import Badge from '../../base/badge'
import Description from '../card/base/description'
import {
RiBugLine ,
RiCloseLine ,
RiHardDrive3Line ,
// RiVerifiedBadgeLine,
} from '@remixicon/react'
import type { PluginDetail } from '../types'
import { PluginSource } from '../types'
// import Description from '../card/base/description'
import Icon from '../card/base/card-icon'
import Title from '../card/base/title'
import OrgInfo from '../card/base/org-info'
import OperationDropdown from './operation-dropdown'
import EndpointList from './endpoint-list'
import ActionList from './action-list'
import ModelList from './model-list'
// import type { Locale } from '@/i18n'
import Badge from '@/app/components/base/badge'
import Tooltip from '@/app/components/base/tooltip'
import { BoxSparkleFill } from '@/app/components/base/icons/src/vender/plugin'
import { Github } from '@/app/components/base/icons/src/public/common'
import Button from '@/app/components/base/button'
import ActionButton from '@/app/components/base/action-button'
import Drawer from '@/app/components/base/drawer'
@ -24,7 +31,7 @@ import I18n from '@/context/i18n'
import cn from '@/utils/classnames'
type Props = {
pluginDetail : Plugin | undefined
pluginDetail : Plugin Detail | undefined
onHide : ( ) = > void
}
@ -38,7 +45,8 @@ const PluginDetailPanel: FC<Props> = ({
const hasNewVersion = useMemo ( ( ) = > {
if ( ! pluginDetail )
return false
return pluginDetail . latest_version !== pluginDetail . version
return false // TODO
// return pluginDetail.latest_version !== pluginDetail.version
} , [ pluginDetail ] )
const handleUpdate = ( ) = > { }
@ -61,11 +69,11 @@ const PluginDetailPanel: FC<Props> = ({
< >
< div className = { cn ( 'shrink-0 p-4 pb-3 border-b border-divider-subtle bg-components-panel-bg' ) } >
< div className = "flex" >
< Icon src = { pluginDetail . icon} / >
< Icon src = { pluginDetail . declaration. icon} / >
< div className = "ml-3 w-0 grow" >
< div className = "flex items-center h-5" >
< Title title = { pluginDetail . label[ locale ] } / >
<RiVerifiedBadgeLine className = "shrink-0 ml-0.5 w-4 h-4 text-text-accent" / >
< Title title = { pluginDetail . declaration. label[ locale ] } / >
{/* <RiVerifiedBadgeLine className="shrink-0 ml-0.5 w-4 h-4 text-text-accent" /> */ }
< Badge
className = 'mx-1'
text = { pluginDetail . version }
@ -77,9 +85,33 @@ const PluginDetailPanel: FC<Props> = ({
< / div >
< div className = 'mb-1 flex justify-between items-center h-4' >
< div className = 'flex items-center' >
< div className = 'text-text-tertiary system-xs-regular' > { pluginDetail . org } < / div >
< div className = 'ml-1 text-text-quaternary system-xs-regular' > · < / div >
< BoxSparkleFill className = 'w-3.5 h-3.5 text-text-tertiary' / >
< OrgInfo
className = "mt-0.5"
packageNameClassName = 'w-auto'
orgName = { pluginDetail . declaration . author }
packageName = { pluginDetail . declaration . name }
/ >
< div className = 'ml-1 mr-0.5 text-text-quaternary system-xs-regular' > · < / div >
{ pluginDetail . source === PluginSource . marketplace && (
< Tooltip popupContent = { t ( 'plugin.detailPanel.categoryTip.marketplace' ) } >
< BoxSparkleFill className = 'w-3.5 h-3.5 text-text-tertiary hover:text-text-accent' / >
< / Tooltip >
) }
{ pluginDetail . source === PluginSource . github && (
< Tooltip popupContent = { t ( 'plugin.detailPanel.categoryTip.github' ) } >
< Github className = 'w-3.5 h-3.5 text-text-secondary hover:text-text-primary' / >
< / Tooltip >
) }
{ pluginDetail . source === PluginSource . local && (
< Tooltip popupContent = { t ( 'plugin.detailPanel.categoryTip.local' ) } >
< RiHardDrive3Line className = 'w-3.5 h-3.5 text-text-tertiary' / >
< / Tooltip >
) }
{ pluginDetail . source === PluginSource . debugging && (
< Tooltip popupContent = { t ( 'plugin.detailPanel.categoryTip.debugging' ) } >
< RiBugLine className = 'w-3.5 h-3.5 text-text-tertiary hover:text-text-warning' / >
< / Tooltip >
) }
< / div >
< / div >
< / div >
@ -90,7 +122,8 @@ const PluginDetailPanel: FC<Props> = ({
< / ActionButton >
< / div >
< / div >
< Description className = 'mt-3' text = { pluginDetail . brief [ locale ] } descriptionLineRows = { 2 } > < / Description >
{ /* category === extension TODO */ }
{ /* <Description className='mt-3' text={pluginDetail.declaration.brief[locale]} descriptionLineRows={2}></Description> */ }
< / div >
< div className = 'grow overflow-y-auto' >
< ActionList / >