index.tsx 3.8 KB

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