index.tsx 3.3 KB

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