ApiServer.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use client'
  2. import type { FC } from 'react'
  3. import { useTranslation } from 'react-i18next'
  4. import CopyFeedback from '@/app/components/base/copy-feedback'
  5. import SecretKeyButton from '@/app/components/develop/secret-key/secret-key-button'
  6. import { randomString } from '@/utils'
  7. type ApiServerProps = {
  8. apiBaseUrl: string
  9. }
  10. const ApiServer: FC<ApiServerProps> = ({
  11. apiBaseUrl,
  12. }) => {
  13. const { t } = useTranslation()
  14. return (
  15. <div className='flex items-center flex-wrap gap-y-2'>
  16. <div className='flex items-center mr-2 pl-1.5 pr-1 h-8 bg-white/80 border-[0.5px] border-white rounded-lg leading-5'>
  17. <div className='mr-0.5 px-1.5 h-5 border border-gray-200 text-[11px] text-gray-500 rounded-md shrink-0'>{t('appApi.apiServer')}</div>
  18. <div className='px-1 truncate w-fit sm:w-[248px] text-[13px] font-medium text-gray-800'>{apiBaseUrl}</div>
  19. <div className='mx-1 w-[1px] h-[14px] bg-gray-200'></div>
  20. <CopyFeedback
  21. content={apiBaseUrl}
  22. selectorId={randomString(8)}
  23. className={'!w-6 !h-6 hover:bg-gray-200'}
  24. />
  25. </div>
  26. <div className='flex items-center mr-2 px-3 h-8 bg-[#ECFDF3] text-xs font-semibold text-[#039855] rounded-lg border-[0.5px] border-[#D1FADF]'>
  27. {t('appApi.ok')}
  28. </div>
  29. <SecretKeyButton
  30. className='flex-shrink-0 !h-8 bg-white'
  31. textCls='!text-gray-700 font-medium'
  32. iconCls='stroke-[1.2px]'
  33. />
  34. </div>
  35. )
  36. }
  37. export default ApiServer