| | |
| | | import { BlockEnum } from '@/app/components/workflow/types' |
| | | import { useGetLanguage } from '@/context/i18n' |
| | | import { CollectionType } from '@/app/components/tools/types' |
| | | import { canFindTool } from '@/utils' |
| | | |
| | | type PanelOperatorPopupProps = { |
| | | id: string |
| | |
| | | return nodesExtraData[data.type].author |
| | | |
| | | if (data.provider_type === CollectionType.builtIn) |
| | | return buildInTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.author |
| | | return buildInTools.find(toolWithProvider => toolWithProvider.id === data.provider_id)?.author |
| | | |
| | | if (data.provider_type === CollectionType.workflow) |
| | | return workflowTools.find(toolWithProvider => toolWithProvider.id === data.provider_id)?.author |
| | |
| | | return nodesExtraData[data.type].about |
| | | |
| | | if (data.provider_type === CollectionType.builtIn) |
| | | return buildInTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.description[language] |
| | | return buildInTools.find(toolWithProvider => toolWithProvider.id === data.provider_id)?.description[language] |
| | | |
| | | if (data.provider_type === CollectionType.workflow) |
| | | return workflowTools.find(toolWithProvider => toolWithProvider.id === data.provider_id)?.description[language] |
| | |
| | | return customTools.find(toolWithProvider => toolWithProvider.id === data.provider_id)?.description[language] |
| | | }, [data, nodesExtraData, language, buildInTools, customTools, workflowTools]) |
| | | |
| | | const showChangeBlock = data.type !== BlockEnum.Start && !nodesReadOnly && data.type !== BlockEnum.Iteration && data.type !== BlockEnum.Loop |
| | | const showChangeBlock = data.type !== BlockEnum.Start && !nodesReadOnly && data.type !== BlockEnum.Iteration |
| | | |
| | | const link = useNodeHelpLink(data.type) |
| | | |
| | | return ( |
| | | <div className='w-[240px] rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl'> |
| | | <div className='w-[240px] border-[0.5px] border-gray-200 rounded-lg shadow-xl bg-white'> |
| | | { |
| | | (showChangeBlock || canRunBySingle(data.type)) && ( |
| | | <> |
| | |
| | | canRunBySingle(data.type) && ( |
| | | <div |
| | | className={` |
| | | flex h-8 cursor-pointer items-center rounded-lg px-3 text-sm text-text-secondary |
| | | hover:bg-state-base-hover |
| | | flex items-center px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer |
| | | hover:bg-gray-50 |
| | | `} |
| | | onClick={() => { |
| | | handleNodeSelect(id) |
| | |
| | | ) |
| | | } |
| | | </div> |
| | | <div className='h-[1px] bg-divider-regular'></div> |
| | | <div className='h-[1px] bg-gray-100'></div> |
| | | </> |
| | | ) |
| | | } |
| | |
| | | <> |
| | | <div className='p-1'> |
| | | <div |
| | | className='flex h-8 cursor-pointer items-center justify-between rounded-lg px-3 text-sm text-text-secondary hover:bg-state-base-hover' |
| | | className='flex items-center justify-between px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50' |
| | | onClick={() => { |
| | | onClosePopup() |
| | | handleNodesCopy(id) |
| | |
| | | <ShortcutsName keys={['ctrl', 'c']} /> |
| | | </div> |
| | | <div |
| | | className='flex h-8 cursor-pointer items-center justify-between rounded-lg px-3 text-sm text-text-secondary hover:bg-state-base-hover' |
| | | className='flex items-center justify-between px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50' |
| | | onClick={() => { |
| | | onClosePopup() |
| | | handleNodesDuplicate(id) |
| | |
| | | <ShortcutsName keys={['ctrl', 'd']} /> |
| | | </div> |
| | | </div> |
| | | <div className='h-[1px] bg-divider-regular'></div> |
| | | <div className='h-[1px] bg-gray-100'></div> |
| | | <div className='p-1'> |
| | | <div |
| | | className={` |
| | | flex h-8 cursor-pointer items-center justify-between rounded-lg px-3 text-sm text-text-secondary |
| | | hover:bg-state-destructive-hover hover:text-red-500 |
| | | flex items-center justify-between px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer |
| | | hover:bg-rose-50 hover:text-red-500 |
| | | `} |
| | | onClick={() => handleNodeDelete(id)} |
| | | > |
| | |
| | | <ShortcutsName keys={['del']} /> |
| | | </div> |
| | | </div> |
| | | <div className='h-[1px] bg-divider-regular'></div> |
| | | <div className='h-[1px] bg-gray-100'></div> |
| | | </> |
| | | ) |
| | | } |
| | | { |
| | | showHelpLink && link && ( |
| | | showHelpLink && ( |
| | | <> |
| | | <div className='p-1'> |
| | | <a |
| | | href={link} |
| | | target='_blank' |
| | | className='flex h-8 cursor-pointer items-center rounded-lg px-3 text-sm text-text-secondary hover:bg-state-base-hover' |
| | | className='flex items-center px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50' |
| | | > |
| | | {t('workflow.panel.helpLink')} |
| | | </a> |
| | | </div> |
| | | <div className='h-[1px] bg-divider-regular'></div> |
| | | <div className='h-[1px] bg-gray-100'></div> |
| | | </> |
| | | ) |
| | | } |
| | | <div className='p-1'> |
| | | <div className='px-3 py-2 text-xs text-text-tertiary'> |
| | | <div className='mb-1 flex h-[22px] items-center font-medium'> |
| | | <div className='px-3 py-2 text-xs text-gray-500'> |
| | | <div className='flex items-center mb-1 h-[22px] font-medium'> |
| | | {t('workflow.panel.about').toLocaleUpperCase()} |
| | | </div> |
| | | <div className='mb-1 leading-[18px] text-text-secondary'>{about}</div> |
| | | <div className='mb-1 text-gray-700 leading-[18px]'>{about}</div> |
| | | <div className='leading-[18px]'> |
| | | {t('workflow.panel.createdBy')} {author} |
| | | </div> |