has-not-set-api.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. import WarningMask from '.'
  6. import Button from '@/app/components/base/button'
  7. export type IHasNotSetAPIProps = {
  8. isTrailFinished: boolean
  9. onSetting: () => void
  10. }
  11. const icon = (
  12. <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
  13. <path d="M14 6.00001L14 2.00001M14 2.00001H9.99999M14 2.00001L8 8M6.66667 2H5.2C4.0799 2 3.51984 2 3.09202 2.21799C2.71569 2.40973 2.40973 2.71569 2.21799 3.09202C2 3.51984 2 4.07989 2 5.2V10.8C2 11.9201 2 12.4802 2.21799 12.908C2.40973 13.2843 2.71569 13.5903 3.09202 13.782C3.51984 14 4.07989 14 5.2 14H10.8C11.9201 14 12.4802 14 12.908 13.782C13.2843 13.5903 13.5903 13.2843 13.782 12.908C14 12.4802 14 11.9201 14 10.8V9.33333" stroke="white" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
  14. </svg>
  15. )
  16. const HasNotSetAPI: FC<IHasNotSetAPIProps> = ({
  17. isTrailFinished,
  18. onSetting,
  19. }) => {
  20. const { t } = useTranslation()
  21. return (
  22. <WarningMask
  23. title={isTrailFinished ? t('appDebug.notSetAPIKey.trailFinished') : t('appDebug.notSetAPIKey.title')}
  24. description={t('appDebug.notSetAPIKey.description')}
  25. footer={
  26. <Button variant='primary' className='flex space-x-2' onClick={onSetting}>
  27. <span>{t('appDebug.notSetAPIKey.settingBtn')}</span>
  28. {icon}
  29. </Button>}
  30. />
  31. )
  32. }
  33. export default React.memo(HasNotSetAPI)