index.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use client'
  2. import { useTranslation } from 'react-i18next'
  3. import s from './secret-key/style.module.css'
  4. import Doc from '@/app/components/develop/doc'
  5. import Loading from '@/app/components/base/loading'
  6. import InputCopy from '@/app/components/develop/secret-key/input-copy'
  7. import SecretKeyButton from '@/app/components/develop/secret-key/secret-key-button'
  8. import { useStore as useAppStore } from '@/app/components/app/store'
  9. type IDevelopMainProps = {
  10. appId: string
  11. }
  12. const DevelopMain = ({ appId }: IDevelopMainProps) => {
  13. const appDetail = useAppStore(state => state.appDetail)
  14. const { t } = useTranslation()
  15. if (!appDetail) {
  16. return (
  17. <div className='flex h-full items-center justify-center bg-white'>
  18. <Loading />
  19. </div>
  20. )
  21. }
  22. return (
  23. <div className='relative flex flex-col h-full overflow-hidden'>
  24. <div className='flex items-center justify-between flex-shrink-0 px-6 border-b border-solid py-2 border-b-gray-100'>
  25. <div className='text-lg font-medium text-gray-900'></div>
  26. <div className='flex items-center flex-wrap gap-y-1'>
  27. <InputCopy className='flex-shrink-0 mr-1 w-52 sm:w-80' value={appDetail.api_base_url}>
  28. <div className={`ml-2 border border-gray-200 border-solid flex-shrink-0 px-2 py-0.5 rounded-[6px] text-gray-500 text-[0.625rem] ${s.customApi}`}>
  29. {t('appApi.apiServer')}
  30. </div>
  31. </InputCopy>
  32. <div className={`flex items-center h-9 px-3 rounded-lg
  33. text-[13px] font-normal mr-2 ${appDetail.enable_api ? 'text-green-500 bg-green-50' : 'text-yellow-500 bg-yellow-50'}`}>
  34. <div className='mr-1'>{t('appApi.status')}</div>
  35. <div className='font-semibold'>{appDetail.enable_api ? `${t('appApi.ok')}` : `${t('appApi.disabled')}`}</div>
  36. </div>
  37. <SecretKeyButton className='flex-shrink-0' appId={appId} />
  38. </div>
  39. </div>
  40. <div className='px-4 sm:px-10 py-4 overflow-auto grow'>
  41. <Doc appDetail={appDetail} />
  42. </div>
  43. </div>
  44. )
  45. }
  46. export default DevelopMain