secret-key-generate.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use client'
  2. import { useTranslation } from 'react-i18next'
  3. import { XMarkIcon } from '@heroicons/react/20/solid'
  4. import InputCopy from './input-copy'
  5. import s from './style.module.css'
  6. import Button from '@/app/components/base/button'
  7. import Modal from '@/app/components/base/modal'
  8. import type { CreateApiKeyResponse } from '@/models/app'
  9. type ISecretKeyGenerateModalProps = {
  10. isShow: boolean
  11. onClose: () => void
  12. newKey?: CreateApiKeyResponse
  13. className?: string
  14. }
  15. const SecretKeyGenerateModal = ({
  16. isShow = false,
  17. onClose,
  18. newKey,
  19. className,
  20. }: ISecretKeyGenerateModalProps) => {
  21. const { t } = useTranslation()
  22. return (
  23. <Modal isShow={isShow} onClose={onClose} title={`${t('appApi.apiKeyModal.apiSecretKey')}`} className={`px-8 ${className}`}>
  24. <XMarkIcon className={`w-6 h-6 absolute cursor-pointer text-gray-500 ${s.close}`} onClick={onClose} />
  25. <p className='mt-1 text-[13px] text-gray-500 font-normal leading-5'>{t('appApi.apiKeyModal.generateTips')}</p>
  26. <div className='my-4'>
  27. <InputCopy className='w-full' value={newKey?.token} />
  28. </div>
  29. <div className='flex justify-end my-4'>
  30. <Button className={`flex-shrink-0 ${s.w64}`} onClick={onClose}>
  31. <span className='text-xs font-medium text-gray-800'>{t('appApi.actionMsg.ok')}</span>
  32. </Button>
  33. </div>
  34. </Modal >
  35. )
  36. }
  37. export default SecretKeyGenerateModal