|
|
|
@ -14,6 +14,7 @@ import cn from '@/utils/classnames'
|
|
|
|
import ToolItem from './tool-item'
|
|
|
|
import ToolItem from './tool-item'
|
|
|
|
import Loading from '@/app/components/base/loading'
|
|
|
|
import Loading from '@/app/components/base/loading'
|
|
|
|
import NoDataPlaceholder from './no-data-placeholder'
|
|
|
|
import NoDataPlaceholder from './no-data-placeholder'
|
|
|
|
|
|
|
|
import { PluginSource } from '../../types'
|
|
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
type Props = {
|
|
|
|
trigger: React.ReactNode
|
|
|
|
trigger: React.ReactNode
|
|
|
|
@ -70,8 +71,9 @@ const ToolPicker: FC<Props> = ({
|
|
|
|
const filteredList = useMemo(() => {
|
|
|
|
const filteredList = useMemo(() => {
|
|
|
|
const list = data ? data.plugins : []
|
|
|
|
const list = data ? data.plugins : []
|
|
|
|
return list.filter((plugin) => {
|
|
|
|
return list.filter((plugin) => {
|
|
|
|
|
|
|
|
const isFromMarketPlace = plugin.source === PluginSource.marketplace
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
(pluginType === PLUGIN_TYPE_SEARCH_MAP.all || plugin.declaration.category === pluginType)
|
|
|
|
isFromMarketPlace && (pluginType === PLUGIN_TYPE_SEARCH_MAP.all || plugin.declaration.category === pluginType)
|
|
|
|
&& (tags.length === 0 || tags.some(tag => plugin.declaration.tags.includes(tag)))
|
|
|
|
&& (tags.length === 0 || tags.some(tag => plugin.declaration.tags.includes(tag)))
|
|
|
|
&& (query === '' || plugin.plugin_id.toLowerCase().includes(query.toLowerCase()))
|
|
|
|
&& (query === '' || plugin.plugin_id.toLowerCase().includes(query.toLowerCase()))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|