index.tsx 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. 'use client'
  2. import { useTranslation } from 'react-i18next'
  3. import classNames from 'classnames'
  4. import Link from 'next/link'
  5. import { useContext } from 'use-context-selector'
  6. import s from './index.module.css'
  7. import Modal from '@/app/components/base/modal'
  8. import { XClose } from '@/app/components/base/icons/src/vender/line/general'
  9. import type { LangGeniusVersionResponse } from '@/models/common'
  10. import { IS_CE_EDITION } from '@/config'
  11. import I18n from '@/context/i18n'
  12. import LogoSite from '@/app/components/base/logo/logo-site'
  13. type IAccountSettingProps = {
  14. langeniusVersionInfo: LangGeniusVersionResponse
  15. onCancel: () => void
  16. }
  17. const buttonClassName = `
  18. shrink-0 flex items-center h-8 px-3 rounded-lg border border-gray-200
  19. text-xs text-gray-800 font-medium
  20. `
  21. export default function AccountAbout({
  22. langeniusVersionInfo,
  23. onCancel,
  24. }: IAccountSettingProps) {
  25. const { t } = useTranslation()
  26. const { locale } = useContext(I18n)
  27. const isLatest = langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version
  28. return (
  29. <Modal
  30. isShow
  31. onClose={() => { }}
  32. className={s.modal}
  33. >
  34. <div className='relative pt-4'>
  35. <div className='absolute -top-2 -right-4 flex justify-center items-center w-8 h-8 cursor-pointer' onClick={onCancel}>
  36. <XClose className='w-4 h-4 text-gray-500' />
  37. </div>
  38. <div>
  39. <LogoSite className='mx-auto mb-2' />
  40. <div className='mb-3 text-center text-xs font-normal text-gray-500'>Version {langeniusVersionInfo?.current_version}</div>
  41. <div className='mb-4 text-center text-xs font-normal text-gray-700'>
  42. <div>© 2023 LangGenius, Inc., Contributors.</div>
  43. <div className='text-[#1C64F2]'>
  44. {
  45. IS_CE_EDITION
  46. ? <Link href={'https://github.com/langgenius/dify/blob/main/LICENSE'} target='_blank'>Open Source License</Link>
  47. : <>
  48. <Link href={locale === 'en' ? 'https://docs.dify.ai/user-agreement/privacy-policy' : 'https://docs.dify.ai/v/zh-hans/user-agreement/privacy-policy'} target='_blank'>Privacy Policy</Link>,
  49. <Link href={locale === 'en' ? 'https://docs.dify.ai/user-agreement/terms-of-service' : 'https://docs.dify.ai/v/zh-hans/user-agreement/terms-of-service'} target='_blank'>Terms of Service</Link>
  50. </>
  51. }
  52. </div>
  53. </div>
  54. </div>
  55. <div className='mb-4 -mx-8 h-[0.5px] bg-gray-200' />
  56. <div className='flex justify-between items-center'>
  57. <div className='text-xs font-medium text-gray-800'>
  58. {
  59. isLatest
  60. ? t('common.about.latestAvailable', { version: langeniusVersionInfo.latest_version })
  61. : t('common.about.nowAvailable', { version: langeniusVersionInfo.latest_version })
  62. }
  63. </div>
  64. <div className='flex items-center'>
  65. <Link
  66. className={classNames(buttonClassName, 'mr-2')}
  67. href={'https://github.com/langgenius/dify/releases'}
  68. target='_blank'
  69. >
  70. {t('common.about.changeLog')}
  71. </Link>
  72. {
  73. !isLatest && !IS_CE_EDITION && (
  74. <Link
  75. className={classNames(buttonClassName, 'text-primary-600')}
  76. href={langeniusVersionInfo.release_notes}
  77. target='_blank'
  78. >
  79. {t('common.about.updateNow')}
  80. </Link>
  81. )
  82. }
  83. </div>
  84. </div>
  85. </div>
  86. </Modal>
  87. )
  88. }