no-data.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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='mt-4 max-w-[640px] rounded-2xl bg-workflow-process-bg p-6'>
  35. <div className='flex h-12 w-12 items-center justify-center rounded-[10px] border-[0.5px]
  36. border-components-card-border bg-components-card-bg shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
  37. {currentProvider.emoji}
  38. </div>
  39. <div className='mb-1 mt-2 flex flex-col gap-y-1 pb-3 pt-1'>
  40. <span className='system-md-semibold text-text-secondary'>
  41. {currentProvider.title}
  42. <Icon3Dots className='relative -left-1.5 -top-2.5 inline' />
  43. </span>
  44. <div className='system-sm-regular text-text-tertiary'>
  45. {currentProvider.description}
  46. </div>
  47. </div>
  48. <Button variant='primary' onClick={onConfig}>
  49. {t(`${I18N_PREFIX}.configure`)}
  50. </Button>
  51. </div>
  52. </>
  53. )
  54. }
  55. export default React.memo(NoData)