index.tsx 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 { Dify } from '@/app/components/base/icons/src/public/common'
  9. import type { LangGeniusVersionResponse } from '@/models/common'
  10. import { IS_CE_EDITION } from '@/config'
  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'>
  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. <div className={classNames(
  37. s['logo-icon'],
  38. 'mx-auto mb-3 w-12 h-12 bg-white rounded-xl border-[0.5px] border-gray-200',
  39. )} />
  40. <Dify className='mx-auto mb-2' />
  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 -mx-8 h-[0.5px] bg-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. }