mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 00:48:04 +08:00
chore: remove frontend changes
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import type { NodeDefault } from '../../types'
|
||||
import type { DataSourceEmptyNodeType } from './types'
|
||||
import { genNodeMetaData } from '@/app/components/workflow/utils'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { genNodeMetaData } from '@/app/components/workflow/utils'
|
||||
|
||||
const metaData = genNodeMetaData({
|
||||
sort: -1,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import type { OnSelectBlock } from '@/app/components/workflow/types'
|
||||
import { produce } from 'immer'
|
||||
import { useCallback } from 'react'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { produce } from 'immer'
|
||||
import type { OnSelectBlock } from '@/app/components/workflow/types'
|
||||
import { generateNewNode } from '@/app/components/workflow/utils'
|
||||
import { useNodesMetaData } from '@/app/components/workflow/hooks'
|
||||
import { generateNewNode } from '@/app/components/workflow/utils'
|
||||
|
||||
export const useReplaceDataSourceNode = (id: string) => {
|
||||
const store = useStoreApi()
|
||||
@ -20,7 +20,8 @@ export const useReplaceDataSourceNode = (id: string) => {
|
||||
const nodes = getNodes()
|
||||
const emptyNodeIndex = nodes.findIndex(node => node.id === id)
|
||||
|
||||
if (emptyNodeIndex < 0) return
|
||||
if (emptyNodeIndex < 0)
|
||||
return
|
||||
const {
|
||||
defaultValue,
|
||||
} = nodesMetaDataMap![type]
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import type { NodeProps } from 'reactflow'
|
||||
import { RiAddLine } from '@remixicon/react'
|
||||
import {
|
||||
memo,
|
||||
useCallback,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { NodeProps } from 'reactflow'
|
||||
import { RiAddLine } from '@remixicon/react'
|
||||
import cn from '@/utils/classnames'
|
||||
import Button from '@/app/components/base/button'
|
||||
import BlockSelector from '@/app/components/workflow/block-selector'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { useReplaceDataSourceNode } from './hooks'
|
||||
|
||||
const DataSourceEmptyNode = ({ id, data }: NodeProps) => {
|
||||
@ -17,11 +17,11 @@ const DataSourceEmptyNode = ({ id, data }: NodeProps) => {
|
||||
const renderTrigger = useCallback(() => {
|
||||
return (
|
||||
<Button
|
||||
variant='primary'
|
||||
className='w-full'
|
||||
variant="primary"
|
||||
className="w-full"
|
||||
>
|
||||
<RiAddLine className='mr-1 h-4 w-4' />
|
||||
{t('workflow.nodes.dataSource.add')}
|
||||
<RiAddLine className="mr-1 h-4 w-4" />
|
||||
{t('nodes.dataSource.add', { ns: 'workflow' })}
|
||||
</Button>
|
||||
)
|
||||
}, [])
|
||||
@ -37,9 +37,9 @@ const DataSourceEmptyNode = ({ id, data }: NodeProps) => {
|
||||
height: data.height,
|
||||
}}
|
||||
>
|
||||
<div className='absolute inset-[-2px] top-[-22px] z-[-1] rounded-[18px] bg-node-data-source-bg p-0.5 backdrop-blur-[6px]'>
|
||||
<div className='system-2xs-semibold-uppercase flex h-5 items-center px-2.5 text-text-tertiary'>
|
||||
{t('workflow.blocks.datasource')}
|
||||
<div className="absolute inset-[-2px] top-[-22px] z-[-1] rounded-[18px] bg-node-data-source-bg p-0.5 backdrop-blur-[6px]">
|
||||
<div className="system-2xs-semibold-uppercase flex h-5 items-center px-2.5 text-text-tertiary">
|
||||
{t('blocks.datasource', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -51,15 +51,16 @@ const DataSourceEmptyNode = ({ id, data }: NodeProps) => {
|
||||
>
|
||||
<div className={cn(
|
||||
'flex items-center rounded-t-2xl p-3',
|
||||
)}>
|
||||
)}
|
||||
>
|
||||
<BlockSelector
|
||||
asChild
|
||||
onSelect={handleReplaceNode}
|
||||
trigger={renderTrigger}
|
||||
noBlocks
|
||||
noTools
|
||||
popupClassName='w-[320px]'
|
||||
placement='bottom-start'
|
||||
popupClassName="w-[320px]"
|
||||
placement="bottom-start"
|
||||
offset={{
|
||||
mainAxis: 4,
|
||||
crossAxis: 0,
|
||||
|
||||
Reference in New Issue
Block a user