index.tsx 2.0 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 h-full flex-col overflow-hidden'>
  24. <div className='flex shrink-0 items-center justify-between border-b border-solid border-b-gray-100 px-6 py-2'>
  25. <div className='text-lg font-medium text-gray-900'></div>
  26. <div className='flex flex-wrap items-center gap-y-1'>
  27. <InputCopy className='mr-1 w-52 shrink-0 sm:w-80' value={appDetail.api_base_url}>
  28. <div className={`ml-2 shrink-0 rounded-[6px] border border-solid border-gray-200 px-2 py-0.5 text-[0.625rem] text-gray-500 ${s.customApi}`}>
  29. {t('appApi.apiServer')}
  30. </div>
  31. </InputCopy>
  32. <div className={`mr-2 flex h-9 items-center rounded-lg
  33. px-3 text-[13px] font-normal ${appDetail.enable_api ? 'bg-green-50 text-green-500' : 'bg-yellow-50 text-yellow-500'}`}>
  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='shrink-0' appId={appId} />
  38. </div>
  39. </div>
  40. <div className='grow overflow-auto px-4 py-4 sm:px-10'>
  41. <Doc appDetail={appDetail} />
  42. </div>
  43. </div>
  44. )
  45. }
  46. export default DevelopMain