maintenance-notice.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { useState } from 'react'
  2. import { useContext } from 'use-context-selector'
  3. import I18n from '@/context/i18n'
  4. import { X } from '@/app/components/base/icons/src/vender/line/general'
  5. const NOTICE_I18N = {
  6. title: {
  7. 'en': 'Important Notice',
  8. 'zh-Hans': '重要公告',
  9. },
  10. desc: {
  11. 'en': 'Our system will be unavailable from 19:00 to 24:00 UTC on August 28 for an upgrade. For questions, kindly contact our support team (support@dify.ai). We value your patience.',
  12. 'zh-Hans': '为了有效提升数据检索能力及稳定性,Dify 将于 2023 年 8 月 29 日 03:00 至 08:00 期间进行服务升级,届时 Dify 云端版及应用将无法访问。感谢您的耐心与支持。',
  13. },
  14. }
  15. const MaintenanceNotice = () => {
  16. const { locale } = useContext(I18n)
  17. const [showNotice, setShowNotice] = useState(localStorage.getItem('hide-maintenance-notice') !== '1')
  18. const handleCloseNotice = () => {
  19. localStorage.setItem('hide-maintenance-notice', '1')
  20. setShowNotice(false)
  21. }
  22. if (!showNotice)
  23. return null
  24. return (
  25. <div className='shrink-0 flex items-center px-4 h-[38px] bg-[#FFFAEB] border-b border-[0.5px] border-b-[#FEF0C7] z-20'>
  26. <div className='shrink-0 flex items-center mr-2 px-2 h-[22px] bg-[#F79009] text-white text-[11px] font-medium rounded-xl'>{NOTICE_I18N.title[locale]}</div>
  27. <div className='grow text-xs font-medium text-gray-700'>{NOTICE_I18N.desc[locale]}</div>
  28. <X className='shrink-0 w-4 h-4 text-gray-500 cursor-pointer' onClick={handleCloseNotice} />
  29. </div>
  30. )
  31. }
  32. export default MaintenanceNotice