dify/web/app/components/header/account-about/index.tsx

88 lines
3.4 KiB
TypeScript
Raw Normal View History

2023-05-15 08:51:32 +08:00
'use client'
import { useTranslation } from 'react-i18next'
import classNames from 'classnames'
import Link from 'next/link'
import s from './index.module.css'
import Modal from '@/app/components/base/modal'
2023-07-18 16:57:14 +08:00
import { XClose } from '@/app/components/base/icons/src/vender/line/general'
2023-05-15 08:51:32 +08:00
import type { LangGeniusVersionResponse } from '@/models/common'
import { IS_CE_EDITION } from '@/config'
2023-10-16 15:26:25 +08:00
import LogoSite from '@/app/components/base/logo/logo-site'
2023-05-15 08:51:32 +08:00
type IAccountSettingProps = {
langeniusVersionInfo: LangGeniusVersionResponse
onCancel: () => void
}
const buttonClassName = `
shrink-0 flex items-center h-8 px-3 rounded-lg border border-gray-200
text-xs text-gray-800 font-medium
`
export default function AccountAbout({
langeniusVersionInfo,
onCancel,
}: IAccountSettingProps) {
const { t } = useTranslation()
const isLatest = langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version
return (
<Modal
isShow
onClose={() => { }}
className={s.modal}
>
2023-10-16 15:26:25 +08:00
<div className='relative pt-4'>
2023-07-18 16:57:14 +08:00
<div className='absolute -top-2 -right-4 flex justify-center items-center w-8 h-8 cursor-pointer' onClick={onCancel}>
<XClose className='w-4 h-4 text-gray-500' />
</div>
2023-05-15 08:51:32 +08:00
<div>
2023-10-16 15:26:25 +08:00
<LogoSite className='mx-auto mb-2' />
2023-05-15 08:51:32 +08:00
<div className='mb-3 text-center text-xs font-normal text-gray-500'>Version {langeniusVersionInfo?.current_version}</div>
<div className='mb-4 text-center text-xs font-normal text-gray-700'>
<div>© 2023 LangGenius, Inc., Contributors.</div>
<div className='text-[#1C64F2]'>
{
IS_CE_EDITION
2024-02-02 15:24:17 +08:00
? <Link href={'https://github.com/langgenius/dify/blob/main/LICENSE'} target='_blank' rel='noopener noreferrer'>Open Source License</Link>
2023-05-15 08:51:32 +08:00
: <>
2024-03-02 13:47:51 +08:00
<Link href='https://dify.ai/privacy' target='_blank' rel='noopener noreferrer'>Privacy Policy</Link>,
<Link href='https://dify.ai/terms' target='_blank' rel='noopener noreferrer'>Terms of Service</Link>
2023-05-15 08:51:32 +08:00
</>
}
</div>
</div>
</div>
2023-07-18 16:57:14 +08:00
<div className='mb-4 -mx-8 h-[0.5px] bg-gray-200' />
2023-05-15 08:51:32 +08:00
<div className='flex justify-between items-center'>
<div className='text-xs font-medium text-gray-800'>
{
isLatest
? t('common.about.latestAvailable', { version: langeniusVersionInfo.latest_version })
: t('common.about.nowAvailable', { version: langeniusVersionInfo.latest_version })
}
</div>
<div className='flex items-center'>
<Link
className={classNames(buttonClassName, 'mr-2')}
2023-05-26 10:22:35 +08:00
href={'https://github.com/langgenius/dify/releases'}
2024-02-02 15:24:17 +08:00
target='_blank' rel='noopener noreferrer'
2023-05-15 08:51:32 +08:00
>
{t('common.about.changeLog')}
</Link>
{
!isLatest && !IS_CE_EDITION && (
<Link
className={classNames(buttonClassName, 'text-primary-600')}
href={langeniusVersionInfo.release_notes}
2024-02-02 15:24:17 +08:00
target='_blank' rel='noopener noreferrer'
2023-05-15 08:51:32 +08:00
>
{t('common.about.updateNow')}
</Link>
)
}
</div>
</div>
</div>
</Modal>
)
}