2023-05-15 08:51:32 +08:00
|
|
|
'use client'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
2023-11-27 11:47:48 +08:00
|
|
|
import s from './secret-key/style.module.css'
|
2023-05-15 08:51:32 +08:00
|
|
|
import Doc from '@/app/components/develop/doc'
|
2024-04-08 18:51:46 +08:00
|
|
|
import Loading from '@/app/components/base/loading'
|
2023-05-15 08:51:32 +08:00
|
|
|
import InputCopy from '@/app/components/develop/secret-key/input-copy'
|
|
|
|
import SecretKeyButton from '@/app/components/develop/secret-key/secret-key-button'
|
2024-04-08 18:51:46 +08:00
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
2023-05-15 08:51:32 +08:00
|
|
|
|
|
|
|
type IDevelopMainProps = {
|
|
|
|
appId: string
|
|
|
|
}
|
|
|
|
|
2024-01-11 11:08:32 +08:00
|
|
|
const DevelopMain = ({ appId }: IDevelopMainProps) => {
|
2024-04-24 04:07:28 +00:00
|
|
|
const appDetail = useAppStore(state => state.appDetail)
|
2023-05-15 08:51:32 +08:00
|
|
|
const { t } = useTranslation()
|
|
|
|
|
2024-04-08 18:51:46 +08:00
|
|
|
if (!appDetail) {
|
|
|
|
return (
|
|
|
|
<div className='flex h-full items-center justify-center bg-white'>
|
|
|
|
<Loading />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
return (
|
2025-03-21 17:41:03 +08:00
|
|
|
<div className='relative flex h-full flex-col overflow-hidden'>
|
|
|
|
<div className='flex shrink-0 items-center justify-between border-b border-solid border-b-gray-100 px-6 py-2'>
|
2024-01-11 11:08:32 +08:00
|
|
|
<div className='text-lg font-medium text-gray-900'></div>
|
2025-03-21 17:41:03 +08:00
|
|
|
<div className='flex flex-wrap items-center gap-y-1'>
|
|
|
|
<InputCopy className='mr-1 w-52 shrink-0 sm:w-80' value={appDetail.api_base_url}>
|
|
|
|
<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}`}>
|
2023-05-15 08:51:32 +08:00
|
|
|
{t('appApi.apiServer')}
|
|
|
|
</div>
|
|
|
|
</InputCopy>
|
2025-03-21 17:41:03 +08:00
|
|
|
<div className={`mr-2 flex h-9 items-center rounded-lg
|
|
|
|
px-3 text-[13px] font-normal ${appDetail.enable_api ? 'bg-green-50 text-green-500' : 'bg-yellow-50 text-yellow-500'}`}>
|
2023-05-15 08:51:32 +08:00
|
|
|
<div className='mr-1'>{t('appApi.status')}</div>
|
2024-04-08 18:51:46 +08:00
|
|
|
<div className='font-semibold'>{appDetail.enable_api ? `${t('appApi.ok')}` : `${t('appApi.disabled')}`}</div>
|
2023-05-15 08:51:32 +08:00
|
|
|
</div>
|
2025-03-21 17:41:03 +08:00
|
|
|
<SecretKeyButton className='shrink-0' appId={appId} />
|
2023-05-15 08:51:32 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-03-21 17:41:03 +08:00
|
|
|
<div className='grow overflow-auto px-4 py-4 sm:px-10'>
|
2023-05-15 08:51:32 +08:00
|
|
|
<Doc appDetail={appDetail} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DevelopMain
|