| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  | 'use client' | 
					
						
							|  |  |  | import type { FC } from 'react' | 
					
						
							|  |  |  | import React from 'react' | 
					
						
							|  |  |  | import { useTranslation } from 'react-i18next' | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  | import s from './index.module.css' | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  | import { Icon3Dots } from '@/app/components/base/icons/src/vender/line/others' | 
					
						
							|  |  |  | import Button from '@/app/components/base/button' | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  | import { DataSourceProvider } from '@/models/common' | 
					
						
							| 
									
										
										
										
											2025-04-16 15:50:15 +08:00
										 |  |  | import { ENABLE_WEBSITE_FIRECRAWL, ENABLE_WEBSITE_JINAREADER, ENABLE_WEBSITE_WATERCRAWL } from '@/config' | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | const I18N_PREFIX = 'datasetCreation.stepOne.website' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type Props = { | 
					
						
							|  |  |  |   onConfig: () => void | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |   provider: DataSourceProvider | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const NoData: FC<Props> = ({ | 
					
						
							|  |  |  |   onConfig, | 
					
						
							| 
									
										
										
										
											2025-04-29 15:49:31 +08:00
										 |  |  |   provider, | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  | }) => { | 
					
						
							|  |  |  |   const { t } = useTranslation() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |   const providerConfig = { | 
					
						
							| 
									
										
										
										
											2025-04-16 15:50:15 +08:00
										 |  |  |     [DataSourceProvider.jinaReader]: ENABLE_WEBSITE_JINAREADER ? { | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |       emoji: <span className={s.jinaLogo} />, | 
					
						
							|  |  |  |       title: t(`${I18N_PREFIX}.jinaReaderNotConfigured`), | 
					
						
							|  |  |  |       description: t(`${I18N_PREFIX}.jinaReaderNotConfiguredDescription`), | 
					
						
							| 
									
										
										
										
											2025-04-16 15:50:15 +08:00
										 |  |  |     } : null, | 
					
						
							|  |  |  |     [DataSourceProvider.fireCrawl]: ENABLE_WEBSITE_FIRECRAWL ? { | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |       emoji: '🔥', | 
					
						
							|  |  |  |       title: t(`${I18N_PREFIX}.fireCrawlNotConfigured`), | 
					
						
							|  |  |  |       description: t(`${I18N_PREFIX}.fireCrawlNotConfiguredDescription`), | 
					
						
							| 
									
										
										
										
											2025-04-16 15:50:15 +08:00
										 |  |  |     } : null, | 
					
						
							|  |  |  |     [DataSourceProvider.waterCrawl]: ENABLE_WEBSITE_WATERCRAWL ? { | 
					
						
							|  |  |  |       emoji: '💧', | 
					
						
							| 
									
										
										
										
											2025-04-07 06:43:23 +02:00
										 |  |  |       title: t(`${I18N_PREFIX}.waterCrawlNotConfigured`), | 
					
						
							|  |  |  |       description: t(`${I18N_PREFIX}.waterCrawlNotConfiguredDescription`), | 
					
						
							| 
									
										
										
										
											2025-04-16 15:50:15 +08:00
										 |  |  |     } : null, | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-29 15:49:31 +08:00
										 |  |  |   const currentProvider = providerConfig[provider] || providerConfig[DataSourceProvider.jinaReader] | 
					
						
							| 
									
										
										
										
											2025-04-16 15:50:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (!currentProvider) return null | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  |   return ( | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |     <> | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |       <div className='mt-4 max-w-[640px] rounded-2xl bg-workflow-process-bg p-6'> | 
					
						
							|  |  |  |         <div className='flex h-12 w-12 items-center justify-center rounded-[10px] border-[0.5px] | 
					
						
							|  |  |  |           border-components-card-border bg-components-card-bg shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'> | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |           {currentProvider.emoji} | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |         <div className='mb-1 mt-2 flex flex-col gap-y-1 pb-3 pt-1'> | 
					
						
							|  |  |  |           <span className='system-md-semibold text-text-secondary'> | 
					
						
							| 
									
										
										
										
											2025-03-19 11:19:57 +08:00
										 |  |  |             {currentProvider.title} | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |             <Icon3Dots className='relative -left-1.5 -top-2.5 inline' /> | 
					
						
							| 
									
										
										
										
											2025-03-19 11:19:57 +08:00
										 |  |  |           </span> | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |           <div className='system-sm-regular text-text-tertiary'> | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |             {currentProvider.description} | 
					
						
							|  |  |  |           </div> | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |         <Button variant='primary' onClick={onConfig}> | 
					
						
							|  |  |  |           {t(`${I18N_PREFIX}.configure`)} | 
					
						
							|  |  |  |         </Button> | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2024-09-30 09:57:19 +08:00
										 |  |  |     </> | 
					
						
							| 
									
										
										
										
											2024-06-14 22:02:41 +08:00
										 |  |  |   ) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | export default React.memo(NoData) |