You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

authorized-in-data-source-node.tsx 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {
  2. memo,
  3. } from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. import { RiEqualizer2Line } from '@remixicon/react'
  6. import Button from '@/app/components/base/button'
  7. import Indicator from '@/app/components/header/indicator'
  8. import cn from '@/utils/classnames'
  9. type AuthorizedInDataSourceNodeProps = {
  10. authorizationsNum: number
  11. onJumpToDataSourcePage: () => void
  12. }
  13. const AuthorizedInDataSourceNode = ({
  14. authorizationsNum,
  15. onJumpToDataSourcePage,
  16. }: AuthorizedInDataSourceNodeProps) => {
  17. const { t } = useTranslation()
  18. return (
  19. <Button
  20. size='small'
  21. onClick={onJumpToDataSourcePage}
  22. >
  23. <Indicator
  24. className='mr-1.5'
  25. color='green'
  26. />
  27. {
  28. authorizationsNum > 1
  29. ? t('plugin.auth.authorizations')
  30. : t('plugin.auth.authorization')
  31. }
  32. <RiEqualizer2Line
  33. className={cn(
  34. 'h-3.5 w-3.5 text-components-button-ghost-text',
  35. )}
  36. />
  37. </Button>
  38. )
  39. }
  40. export default memo(AuthorizedInDataSourceNode)