index.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use client'
  2. import { useTranslation } from 'react-i18next'
  3. import { useAppContext } from '@/context/app-context'
  4. import { Beaker02 } from '@/app/components/base/icons/src/vender/solid/education'
  5. import { TerminalSquare } from '@/app/components/base/icons/src/vender/solid/development'
  6. const headerEnvClassName: { [k: string]: string } = {
  7. DEVELOPMENT: 'bg-[#FEC84B] border-[#FDB022] text-[#93370D]',
  8. TESTING: 'bg-[#A5F0FC] border-[#67E3F9] text-[#164C63]',
  9. }
  10. const EnvNav = () => {
  11. const { t } = useTranslation()
  12. const { langeniusVersionInfo } = useAppContext()
  13. const showEnvTag = langeniusVersionInfo.current_env === 'TESTING' || langeniusVersionInfo.current_env === 'DEVELOPMENT'
  14. if (!showEnvTag)
  15. return null
  16. return (
  17. <div className={`
  18. flex items-center h-[22px] mr-4 rounded-md px-2 text-xs font-medium border
  19. ${headerEnvClassName[langeniusVersionInfo.current_env]}
  20. `}>
  21. {
  22. langeniusVersionInfo.current_env === 'TESTING' && (
  23. <>
  24. <Beaker02 className='w-3 h-3 mr-1' />
  25. {t('common.environment.testing')}
  26. </>
  27. )
  28. }
  29. {
  30. langeniusVersionInfo.current_env === 'DEVELOPMENT' && (
  31. <>
  32. <TerminalSquare className='w-3 h-3 mr-1' />
  33. {t('common.environment.development')}
  34. </>
  35. )
  36. }
  37. </div>
  38. )
  39. }
  40. export default EnvNav