feat(search-box): enhance marketplace search box with new triggers and conditional rendering

This commit is contained in:
twwu
2025-08-29 14:45:04 +08:00
parent d0dd728e6c
commit 1c8190f142
10 changed files with 242 additions and 143 deletions

View File

@ -184,7 +184,6 @@ const NodeSelector: FC<NodeSelectorProps> = ({
onSearchChange={setSearchText}
tags={tags}
onTagsChange={setTags}
size='small'
placeholder={t('plugin.searchTools')!}
inputClassName='grow'
/>

View File

@ -13,7 +13,7 @@ import type {
} from '@floating-ui/react'
import AllTools from '@/app/components/workflow/block-selector/all-tools'
import type { ToolDefaultValue, ToolValue } from './types'
import type { BlockEnum } from '@/app/components/workflow/types'
import type { BlockEnum, OnSelectBlock } from '@/app/components/workflow/types'
import SearchBox from '@/app/components/plugins/marketplace/search-box'
import { useTranslation } from 'react-i18next'
import { useBoolean } from 'ahooks'
@ -158,13 +158,11 @@ const ToolPicker: FC<Props> = ({
onSearchChange={setSearchText}
tags={tags}
onTagsChange={setTags}
size='small'
placeholder={t('plugin.searchTools')!}
supportAddCustomTool={supportAddCustomTool}
onAddedCustomTool={handleAddedCustomTool}
onShowAddCustomCollectionModal={showEditCustomCollectionModal}
inputClassName='grow'
/>
</div>
<AllTools
@ -172,7 +170,7 @@ const ToolPicker: FC<Props> = ({
toolContentClassName='max-w-[100%]'
tags={tags}
searchText={searchText}
onSelect={handleSelect}
onSelect={handleSelect as OnSelectBlock}
onSelectMultiple={handleSelectMultiple}
buildInTools={builtinToolList || []}
customTools={customToolList || []}

View File

@ -1,36 +0,0 @@
import { memo } from 'react'
import { RiPriceTag3Line } from '@remixicon/react'
import TagsFilter from '@/app/components/plugins/marketplace/search-box/tags-filter'
import cn from '@/utils/classnames'
type ToolSearchInputTagProps = {
tags: string[]
onTagsChange: (tags: string[]) => void
}
const ToolSearchInputTag = ({
tags,
onTagsChange,
}: ToolSearchInputTagProps) => {
return (
<TagsFilter
tags={tags}
onTagsChange={onTagsChange}
size='large'
className={cn(
'p-0',
tags.length && 'px-0.5',
)}
triggerClassName={cn(
'p-0',
tags.length && 'px-0.5',
)}
emptyTrigger={
<div className='flex h-7 w-[34px] items-center justify-center'>
<RiPriceTag3Line className='h-4 w-4 text-text-tertiary' />
</div>
}
/>
)
}
export default memo(ToolSearchInputTag)