| | |
| | | memo, |
| | | useCallback, |
| | | } from 'react' |
| | | import Link from 'next/link' |
| | | import { useTranslation } from 'react-i18next' |
| | | import { |
| | | RiAddLine, |
| | |
| | | key={toolWithProvider.id} |
| | | className='group mb-1 last-of-type:mb-0' |
| | | > |
| | | <div className='flex h-[22px] w-full items-center justify-between pl-3 pr-1 text-xs font-medium text-gray-500'> |
| | | <div className='flex items-center justify-between w-full pl-3 pr-1 h-[22px] text-xs font-medium text-gray-500'> |
| | | {toolWithProvider.label[language]} |
| | | <Link className='hidden cursor-pointer items-center group-hover:flex' href={`/tools?category=${toolWithProvider.type}`} target='_blank'>{t('tools.addToolModal.manageInTools')}<ArrowUpRight className='ml-0.5 h-3 w-3' /></Link> |
| | | <a className='hidden cursor-pointer items-center group-hover:flex' href={`/tools?category=${toolWithProvider.type}`} target='_blank'>{t('tools.addToolModal.manageInTools')}<ArrowUpRight className='ml-0.5 w-3 h-3' /></a> |
| | | </div> |
| | | {list.map((tool) => { |
| | | const labelContent = (() => { |
| | |
| | | toolIcon={toolWithProvider.icon} |
| | | /> |
| | | <div className='mb-1 text-sm leading-5 text-gray-900'>{tool.label[language]}</div> |
| | | <div className='text-xs leading-[18px] text-gray-700'>{tool.description[language]}</div> |
| | | <div className='text-xs text-gray-700 leading-[18px]'>{tool.description[language]}</div> |
| | | {tool.labels?.length > 0 && ( |
| | | <div className='mt-1 flex shrink-0 items-center'> |
| | | <div className='relative flex w-full items-center gap-1 rounded-md py-1 text-gray-500' title={labelContent}> |
| | | <Tag01 className='h-3 w-3 shrink-0 text-gray-500' /> |
| | | <div className='grow truncate text-start text-xs font-normal leading-[18px]'>{labelContent}</div> |
| | | <div className='flex items-center shrink-0 mt-1'> |
| | | <div className='relative w-full flex items-center gap-1 py-1 rounded-md text-gray-500' title={labelContent}> |
| | | <Tag01 className='shrink-0 w-3 h-3 text-gray-500' /> |
| | | <div className='grow text-xs text-start leading-[18px] font-normal truncate'>{labelContent}</div> |
| | | </div> |
| | | </div> |
| | | )} |
| | | </div> |
| | | )} |
| | | > |
| | | <div className='group/item flex h-8 w-full cursor-pointer items-center rounded-lg pl-3 pr-1 hover:bg-gray-50'> |
| | | <div className='group/item flex items-center w-full pl-3 pr-1 h-8 rounded-lg hover:bg-gray-50 cursor-pointer'> |
| | | <BlockIcon |
| | | className={cn('mr-2 shrink-0', needAuth && 'opacity-30')} |
| | | type={BlockEnum.Tool} |
| | | toolIcon={toolWithProvider.icon} |
| | | /> |
| | | <div className={cn('grow truncate text-sm text-gray-900', needAuth && 'opacity-30')}>{tool.label[language]}</div> |
| | | <div className={cn('grow text-sm text-gray-900 truncate', needAuth && 'opacity-30')}>{tool.label[language]}</div> |
| | | {!needAuth && added && ( |
| | | <div className='flex items-center gap-1 rounded-[6px] border border-gray-100 bg-white px-2 py-[3px] text-xs font-medium leading-[18px] text-gray-300'> |
| | | <Check className='h-3 w-3' /> |
| | | <div className='flex items-center gap-1 rounded-[6px] border border-gray-100 px-2 py-[3px] bg-white text-gray-300 text-xs font-medium leading-[18px]'> |
| | | <Check className='w-3 h-3' /> |
| | | {t('tools.addToolModal.added').toLocaleUpperCase()} |
| | | </div> |
| | | )} |
| | |
| | | className={cn('hidden shrink-0 items-center group-hover/item:flex')} |
| | | onClick={() => onSelect(toolWithProvider, tool)} |
| | | > |
| | | <RiAddLine className='h-3 w-3' /> |
| | | <RiAddLine className='w-3 h-3' /> |
| | | {t('tools.addToolModal.add').toLocaleUpperCase()} |
| | | </Button> |
| | | )} |
| | |
| | | }, [addable, language, t, labelList, addedTools, onAuthSetup, onSelect]) |
| | | |
| | | return ( |
| | | <div className='max-w-[440px] p-1 pb-6'> |
| | | <div className='p-1 pb-6 max-w-[440px]'> |
| | | {!tools.length && !showWorkflowEmpty && ( |
| | | <div className='flex h-[22px] items-center px-3 text-xs font-medium text-gray-500'>{t('workflow.tabs.noResult')}</div> |
| | | <div className='flex items-center px-3 h-[22px] text-xs font-medium text-gray-500'>{t('workflow.tabs.noResult')}</div> |
| | | )} |
| | | {!tools.length && showWorkflowEmpty && ( |
| | | <div className='pt-[280px]'> |