Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

plugin-auth-in-datasource-node.tsx 997B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { memo } from 'react'
  2. import type { ReactNode } from 'react'
  3. import { useTranslation } from 'react-i18next'
  4. import { RiAddLine } from '@remixicon/react'
  5. import Button from '@/app/components/base/button'
  6. type PluginAuthInDataSourceNodeProps = {
  7. children?: ReactNode
  8. isAuthorized?: boolean
  9. onJumpToDataSourcePage: () => void
  10. }
  11. const PluginAuthInDataSourceNode = ({
  12. children,
  13. isAuthorized,
  14. onJumpToDataSourcePage,
  15. }: PluginAuthInDataSourceNodeProps) => {
  16. const { t } = useTranslation()
  17. return (
  18. <>
  19. {
  20. !isAuthorized && (
  21. <div className='px-4 pb-2'>
  22. <Button
  23. className='w-full'
  24. variant='primary'
  25. onClick={onJumpToDataSourcePage}
  26. >
  27. <RiAddLine className='mr-1 h-4 w-4' />
  28. {t('common.integrations.connect')}
  29. </Button>
  30. </div>
  31. )
  32. }
  33. {isAuthorized && children}
  34. </>
  35. )
  36. }
  37. export default memo(PluginAuthInDataSourceNode)