index.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. //开发环境
  18. <div className={`
  19. flex items-center h-[22px] mr-4 rounded-md px-2 text-xs font-medium border
  20. ${headerEnvClassName[langeniusVersionInfo.current_env]}
  21. `}>
  22. {
  23. langeniusVersionInfo.current_env === 'TESTING' && (
  24. <>
  25. <Beaker02 className='w-3 h-3 mr-1' />
  26. {t('common.environment.testing')}
  27. </>
  28. )
  29. }
  30. {
  31. langeniusVersionInfo.current_env === 'DEVELOPMENT' && (
  32. <>
  33. <TerminalSquare className='w-3 h-3 mr-1' />
  34. {t('common.environment.development')}
  35. </>
  36. )
  37. }
  38. </div>
  39. )
  40. }
  41. export default EnvNav