mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
panel
This commit is contained in:
@ -7,6 +7,7 @@ import {
|
||||
useCallback,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type {
|
||||
OffsetOptions,
|
||||
Placement,
|
||||
@ -47,6 +48,7 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
||||
popupClassName,
|
||||
asChild,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const [localOpen, setLocalOpen] = useState(false)
|
||||
const open = openFromProps === undefined ? localOpen : openFromProps
|
||||
const handleOpenChange = useCallback((newOpen: boolean) => {
|
||||
@ -95,11 +97,14 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
||||
<PortalToFollowElemContent className='z-[1000]'>
|
||||
<div className={`w-[256px] rounded-lg border-[0.5px] border-gray-200 bg-white shadow-lg ${popupClassName}`}>
|
||||
<div className='px-2 pt-2'>
|
||||
<div className='flex items-center px-2 rounded-lg bg-gray-100'>
|
||||
<div
|
||||
className='flex items-center px-2 rounded-lg bg-gray-100'
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
<SearchLg className='shrink-0 ml-[1px] mr-[5px] w-3.5 h-3.5 text-gray-400' />
|
||||
<input
|
||||
className='grow px-0.5 py-[7px] text-[13px] bg-transparent appearance-none outline-none'
|
||||
placeholder='Search block'
|
||||
placeholder={t('workflow.tabs.searchBlock') || ''}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -3,9 +3,10 @@ import {
|
||||
memo,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { groupBy } from 'lodash-es'
|
||||
import BlockIcon from '../block-icon'
|
||||
import type { BlockEnum } from '../types'
|
||||
import { BlockEnum } from '../types'
|
||||
import { BLOCK_CLASSIFICATIONS } from './constants'
|
||||
import {
|
||||
useBlocks,
|
||||
@ -14,6 +15,7 @@ import {
|
||||
import type { ToolDefaultValue } from './types'
|
||||
import { TabsEnum } from './types'
|
||||
import Tools from './tools'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
|
||||
export type TabsProps = {
|
||||
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
|
||||
@ -21,6 +23,8 @@ export type TabsProps = {
|
||||
const Tabs: FC<TabsProps> = ({
|
||||
onSelect,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const appDetail = useAppStore(state => state.appDetail)
|
||||
const blocks = useBlocks()
|
||||
const tabs = useTabs()
|
||||
const [activeTab, setActiveTab] = useState(tabs[0].key)
|
||||
@ -55,12 +59,17 @@ const Tabs: FC<TabsProps> = ({
|
||||
{
|
||||
classification !== '-' && (
|
||||
<div className='flex items-start px-3 h-[22px] text-xs font-medium text-gray-500'>
|
||||
{classification}
|
||||
{t(`workflow.tabs.${classification}`)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
groupBy(blocks, 'classification')[classification].map(block => (
|
||||
groupBy(blocks, 'classification')[classification].filter((block) => {
|
||||
if (block.type === BlockEnum.DirectAnswer && appDetail?.mode === 'workflow')
|
||||
return false
|
||||
|
||||
return true
|
||||
}).map(block => (
|
||||
<div
|
||||
key={block.type}
|
||||
className='flex items-center px-3 h-8 rounded-lg hover:bg-gray-50 cursor-pointer'
|
||||
|
||||
@ -85,9 +85,9 @@ const Item = ({
|
||||
}
|
||||
<div
|
||||
className='grow mr-2 truncate text-sm text-gray-900'
|
||||
title={data.name}
|
||||
title={data.label[language]}
|
||||
>
|
||||
{data.name}
|
||||
{data.label[language]}
|
||||
</div>
|
||||
{
|
||||
data.expanded
|
||||
|
||||
Reference in New Issue
Block a user