|
| 1 | +import ReactGA from 'react-ga4' |
| 2 | + |
| 3 | +import DevtronCopyright from '@Common/DevtronCopyright' |
| 4 | +import { EULA_LINK, PRIVACY_POLICY_LINK, TERMS_OF_USE_LINK } from '@Shared/constants' |
| 5 | +import { useMainContext } from '@Shared/Providers' |
| 6 | + |
| 7 | +import { Button, ButtonComponentType, ButtonStyleType, ButtonVariantType } from '../Button' |
| 8 | +import { InstallationType } from '../Header/types' |
| 9 | +import { Icon } from '../Icon' |
| 10 | + |
| 11 | +const AboutDevtronBody = ({ isFELibAvailable }: { isFELibAvailable: boolean }) => { |
| 12 | + const { currentServerInfo } = useMainContext() |
| 13 | + |
| 14 | + const currentVersion = currentServerInfo?.serverInfo?.currentVersion |
| 15 | + const isEnterprise = currentServerInfo?.serverInfo?.installationType === InstallationType.ENTERPRISE |
| 16 | + |
| 17 | + const isVersionSame = isFELibAvailable === isEnterprise |
| 18 | + |
| 19 | + const handleEULAClick = () => { |
| 20 | + ReactGA.event({ |
| 21 | + category: 'about-devtron', |
| 22 | + action: 'ABOUT_DEVTRON_LICENSE_AGREEMENT_CLICKED', |
| 23 | + }) |
| 24 | + } |
| 25 | + |
| 26 | + return ( |
| 27 | + <div className="flexbox-col p-32 dc__gap-24 br-16 border__secondary bg__secondary"> |
| 28 | + <div className="flexbox-col dc__align-items-center dc__gap-16 text-center"> |
| 29 | + <div className="flex p-6 border__primary br-8"> |
| 30 | + <Icon name="ic-devtron" color="B500" size={40} /> |
| 31 | + </div> |
| 32 | + <div> |
| 33 | + <p className="fs-16 cn-9 fw-6 lh-1-5 m-0">Devtron</p> |
| 34 | + {isVersionSame && ( |
| 35 | + <p className="fs-13 cn-7 fw-4 lh-20 m-0">{`${isEnterprise ? 'Enterprise' : 'OSS'} Version${currentVersion ? `(${currentVersion})` : ''}`}</p> |
| 36 | + )} |
| 37 | + </div> |
| 38 | + <DevtronCopyright /> |
| 39 | + </div> |
| 40 | + <div className="flexbox flex-wrap dc__content-center dc__gap-4"> |
| 41 | + <Button |
| 42 | + dataTestId="terms-of-service" |
| 43 | + text="Terms of service" |
| 44 | + variant={ButtonVariantType.text} |
| 45 | + style={ButtonStyleType.neutral} |
| 46 | + component={ButtonComponentType.anchor} |
| 47 | + anchorProps={{ |
| 48 | + href: TERMS_OF_USE_LINK, |
| 49 | + }} |
| 50 | + /> |
| 51 | + <span>•</span> |
| 52 | + <Button |
| 53 | + dataTestId="privacy-policy" |
| 54 | + text="Privacy policy" |
| 55 | + variant={ButtonVariantType.text} |
| 56 | + style={ButtonStyleType.neutral} |
| 57 | + component={ButtonComponentType.anchor} |
| 58 | + anchorProps={{ |
| 59 | + href: PRIVACY_POLICY_LINK, |
| 60 | + }} |
| 61 | + /> |
| 62 | + <span>•</span> |
| 63 | + <Button |
| 64 | + dataTestId="license-agreement" |
| 65 | + text="End-User License agreement" |
| 66 | + variant={ButtonVariantType.text} |
| 67 | + style={ButtonStyleType.neutral} |
| 68 | + onClick={handleEULAClick} |
| 69 | + component={ButtonComponentType.anchor} |
| 70 | + anchorProps={{ |
| 71 | + href: EULA_LINK, |
| 72 | + }} |
| 73 | + /> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + ) |
| 77 | +} |
| 78 | + |
| 79 | +export default AboutDevtronBody |
0 commit comments