no-data.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. import s from './index.module.css'
  6. import { Icon3Dots } from '@/app/components/base/icons/src/vender/line/others'
  7. import Button from '@/app/components/base/button'
  8. import { DataSourceProvider } from '@/models/common'
  9. const I18N_PREFIX = 'datasetCreation.stepOne.website'
  10. type Props = {
  11. onConfig: () => void
  12. provider: DataSourceProvider
  13. }
  14. const NoData: FC<Props> = ({
  15. onConfig,
  16. provider,
  17. }) => {
  18. const { t } = useTranslation()
  19. const providerConfig = {
  20. [DataSourceProvider.jinaReader]: {
  21. emoji: <span className={s.jinaLogo} />,
  22. title: t(`${I18N_PREFIX}.jinaReaderNotConfigured`),
  23. description: t(`${I18N_PREFIX}.jinaReaderNotConfiguredDescription`),
  24. },
  25. [DataSourceProvider.fireCrawl]: {
  26. emoji: '🔥',
  27. title: t(`${I18N_PREFIX}.fireCrawlNotConfigured`),
  28. description: t(`${I18N_PREFIX}.fireCrawlNotConfiguredDescription`),
  29. },
  30. }
  31. const currentProvider = providerConfig[provider]
  32. return (
  33. <>
  34. <div className='max-w-[640px] p-6 rounded-2xl bg-gray-50 mt-4'>
  35. <div className='flex w-11 h-11 items-center justify-center bg-gray-50 rounded-xl border-[0.5px] border-gray-100 shadow-lg'>
  36. {currentProvider.emoji}
  37. </div>
  38. <div className='my-2'>
  39. <span className='text-gray-700 font-semibold'>{currentProvider.title}<Icon3Dots className='inline relative -top-3 -left-1.5' /></span>
  40. <div className='mt-1 pb-3 text-gray-500 text-[13px] font-normal'>
  41. {currentProvider.description}
  42. </div>
  43. </div>
  44. <Button variant='primary' onClick={onConfig}>
  45. {t(`${I18N_PREFIX}.configure`)}
  46. </Button>
  47. </div>
  48. </>
  49. )
  50. }
  51. export default React.memo(NoData)