index.tsx 3.4 KB

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