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.

header.tsx 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React from 'react'
  2. import Divider from '@/app/components/base/divider'
  3. import Button from '@/app/components/base/button'
  4. import { RiBookOpenLine, RiEqualizer2Line } from '@remixicon/react'
  5. import type { CredentialSelectorProps } from './credential-selector'
  6. import CredentialSelector from './credential-selector'
  7. import Tooltip from '@/app/components/base/tooltip'
  8. import { useTranslation } from 'react-i18next'
  9. type HeaderProps = {
  10. docTitle: string
  11. docLink: string
  12. onClickConfiguration?: () => void
  13. } & CredentialSelectorProps
  14. const Header = ({
  15. docTitle,
  16. docLink,
  17. onClickConfiguration,
  18. ...rest
  19. }: HeaderProps) => {
  20. const { t } = useTranslation()
  21. return (
  22. <div className='flex items-center gap-x-2'>
  23. <div className='flex grow items-center gap-x-1'>
  24. <CredentialSelector
  25. {...rest}
  26. />
  27. <Divider type='vertical' className='mx-1 h-3.5 shrink-0' />
  28. <Tooltip
  29. popupContent={t('datasetPipeline.configurationTip', { pluginName: rest.pluginName })}
  30. position='top'
  31. >
  32. <Button
  33. variant='ghost'
  34. size='small'
  35. className='size-6 shrink-0 px-1'
  36. >
  37. <RiEqualizer2Line
  38. className='h-4 w-4'
  39. onClick={onClickConfiguration}
  40. />
  41. </Button>
  42. </Tooltip>
  43. </div>
  44. <a
  45. className='system-xs-medium flex shrink-0 items-center gap-x-1 text-text-accent'
  46. href={docLink}
  47. target='_blank'
  48. rel='noopener noreferrer'
  49. >
  50. <RiBookOpenLine className='size-3.5 shrink-0' />
  51. <span title={docTitle}>{docTitle}</span>
  52. </a>
  53. </div>
  54. )
  55. }
  56. export default React.memo(Header)