dify/web/app/components/integrations/tool-provider-toolbar.tsx
Jingyi 9b74df21d0
feat(web): refine onboarding UI (#37433)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: fatelei <fatelei@gmail.com>
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
Co-authored-by: gigglewang <gigglewang@dify.ai>
Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai>
Co-authored-by: chariri <w@chariri.moe>
Co-authored-by: Evan <2869018789@qq.com>
Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
2026-06-15 08:47:15 +00:00

82 lines
2.2 KiB
TypeScript

'use client'
import type { ReactNode } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import { SearchInput } from '@/app/components/base/search-input'
import TabSliderNew from '@/app/components/base/tab-slider-new'
import UpdateSettingDialog from '@/app/components/header/account-setting/update-setting-dialog'
import { PluginCategoryEnum } from '@/app/components/plugins/types'
import LabelFilter from '@/app/components/tools/labels/filter'
type ToolProviderToolbarOption = {
value: string
text: string
}
export function ToolProviderToolbar({
activeTab,
currentProviderId,
frameClassName,
isRouteCategory,
keywords,
options,
showLabelFilter,
showToolsUpdateSetting,
tagFilterValue,
toolbarAction,
onCategoryChange,
onKeywordsChange,
onTagsChange,
}: {
activeTab: string
currentProviderId?: string
frameClassName?: string
isRouteCategory: boolean
keywords: string
options: ToolProviderToolbarOption[]
showLabelFilter: boolean
showToolsUpdateSetting: boolean
tagFilterValue: string[]
toolbarAction?: ReactNode
onCategoryChange: (category: string) => void
onKeywordsChange: (keywords: string) => void
onTagsChange: (tags: string[]) => void
}) {
return (
<div
className={cn(
'flex shrink-0 flex-wrap items-center justify-start gap-x-2 gap-y-2',
frameClassName ? 'bg-components-panel-bg pt-2 pb-0' : 'w-full',
frameClassName,
currentProviderId && 'pr-6',
)}
>
{!isRouteCategory && (
<TabSliderNew
value={activeTab}
onChange={onCategoryChange}
options={options}
/>
)}
<div className="flex min-w-[200px] flex-1 items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-2">
{showLabelFilter && (
<LabelFilter value={tagFilterValue} onChange={onTagsChange} />
)}
<SearchInput
className="w-[200px]"
value={keywords}
onValueChange={onKeywordsChange}
/>
</div>
{toolbarAction}
{!toolbarAction && showToolsUpdateSetting && (
<UpdateSettingDialog
category={PluginCategoryEnum.tool}
/>
)}
</div>
</div>
)
}