index.tsx 3.4 KB

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