Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.tsx 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 Modal from '@/app/components/base/modal'
  7. import Button from '@/app/components/base/button'
  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. import { noop } from 'lodash-es'
  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={noop}
  30. className='!w-[480px] !max-w-[480px] !px-6 !py-4'
  31. >
  32. <div className='relative pt-4'>
  33. <div className='absolute -right-4 -top-2 flex h-8 w-8 cursor-pointer items-center justify-center' onClick={onCancel}>
  34. <RiCloseLine className='h-4 w-4 text-text-tertiary' />
  35. </div>
  36. <div>
  37. <LogoSite className='mx-auto mb-2' />
  38. <div className='mb-3 text-center text-xs font-normal text-text-tertiary'>Version {langeniusVersionInfo?.current_version}</div>
  39. <div className='mb-4 text-center text-xs font-normal text-text-secondary'>
  40. <div>© {dayjs().year()} LangGenius, Inc., Contributors.</div>
  41. <div className='text-text-accent'>
  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='-mx-8 mb-4 h-[0.5px] bg-divider-regular' />
  54. <div className='flex items-center justify-between'>
  55. <div className='text-xs font-medium text-text-primary'>
  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. <Button className='mr-2'>
  64. <Link
  65. href={'https://github.com/langgenius/dify/releases'}
  66. target='_blank' rel='noopener noreferrer'
  67. >
  68. {t('common.about.changeLog')}
  69. </Link>
  70. </Button>
  71. {
  72. !isLatest && !IS_CE_EDITION && (
  73. <Button variant='primary'>
  74. <Link
  75. href={langeniusVersionInfo.release_notes}
  76. target='_blank' rel='noopener noreferrer'
  77. >
  78. {t('common.about.updateNow')}
  79. </Link>
  80. </Button>
  81. )
  82. }
  83. </div>
  84. </div>
  85. </div>
  86. </Modal>
  87. )
  88. }