2023-07-18 16:57:14 +08:00
|
|
|
'use client'
|
|
|
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useAppContext } from '@/context/app-context'
|
|
|
|
import { Beaker02 } from '@/app/components/base/icons/src/vender/solid/education'
|
|
|
|
import { TerminalSquare } from '@/app/components/base/icons/src/vender/solid/development'
|
|
|
|
|
|
|
|
const headerEnvClassName: { [k: string]: string } = {
|
|
|
|
DEVELOPMENT: 'bg-[#FEC84B] border-[#FDB022] text-[#93370D]',
|
|
|
|
TESTING: 'bg-[#A5F0FC] border-[#67E3F9] text-[#164C63]',
|
|
|
|
}
|
|
|
|
|
|
|
|
const EnvNav = () => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { langeniusVersionInfo } = useAppContext()
|
|
|
|
const showEnvTag = langeniusVersionInfo.current_env === 'TESTING' || langeniusVersionInfo.current_env === 'DEVELOPMENT'
|
|
|
|
|
|
|
|
if (!showEnvTag)
|
|
|
|
return null
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={`
|
2025-06-17 17:37:06 +08:00
|
|
|
mr-1 flex h-[22px] items-center rounded-md border px-2 text-xs font-medium
|
2023-07-18 16:57:14 +08:00
|
|
|
${headerEnvClassName[langeniusVersionInfo.current_env]}
|
|
|
|
`}>
|
|
|
|
{
|
|
|
|
langeniusVersionInfo.current_env === 'TESTING' && (
|
|
|
|
<>
|
2025-06-17 17:37:06 +08:00
|
|
|
<Beaker02 className='h-3 w-3' />
|
|
|
|
<div className='ml-1 max-[1280px]:hidden'>{t('common.environment.testing')}</div>
|
2023-07-18 16:57:14 +08:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
langeniusVersionInfo.current_env === 'DEVELOPMENT' && (
|
|
|
|
<>
|
2025-06-17 17:37:06 +08:00
|
|
|
<TerminalSquare className='h-3 w-3' />
|
|
|
|
<div className='ml-1 max-[1280px]:hidden'>{t('common.environment.development')}</div>
|
2023-07-18 16:57:14 +08:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default EnvNav
|