Skip to content

Commit 6f1293b

Browse files
committed
feat: add about devtron dialog for oss
1 parent 023d109 commit 6f1293b

6 files changed

Lines changed: 118 additions & 16 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 = () => {
12+
const { currentServerInfo } = useMainContext()
13+
14+
const currentVersion = currentServerInfo?.serverInfo?.currentVersion
15+
const isEnterprise = currentServerInfo?.serverInfo?.installationType === InstallationType.ENTERPRISE
16+
17+
const handleEULAClick = () => {
18+
ReactGA.event({
19+
category: 'about-devtron',
20+
action: 'ABOUT_DEVTRON_LICENSE_AGREEMENT_CLICKED',
21+
})
22+
}
23+
24+
return (
25+
<div className="flexbox-col dc__align-items-center dc__gap-20">
26+
<div className="flex p-6 border__primary br-8">
27+
<Icon name="ic-devtron" color="B500" size={40} />
28+
</div>
29+
<div className="text-center">
30+
<p className="fs-16 cn-9 fw-6 lh-1-5 m-0">Devtron</p>
31+
<p className="fs-13 cn-7 fw-4 lh-20 m-0">{`${isEnterprise ? 'Enterprise' : 'OSS'} Version${currentVersion ? `(${currentVersion})` : ''}`}</p>
32+
</div>
33+
<DevtronCopyright />
34+
<div className="flexbox flex-wrap dc__content-center dc__gap-6">
35+
<Button
36+
dataTestId="terms-of-service"
37+
text="Terms of service"
38+
variant={ButtonVariantType.text}
39+
style={ButtonStyleType.neutral}
40+
component={ButtonComponentType.anchor}
41+
anchorProps={{
42+
href: TERMS_OF_USE_LINK,
43+
}}
44+
/>
45+
<span></span>
46+
<Button
47+
dataTestId="privacy-policy"
48+
text="Privacy policy"
49+
variant={ButtonVariantType.text}
50+
style={ButtonStyleType.neutral}
51+
component={ButtonComponentType.anchor}
52+
anchorProps={{
53+
href: PRIVACY_POLICY_LINK,
54+
}}
55+
/>
56+
<span></span>
57+
<Button
58+
dataTestId="license-agreement"
59+
text="End-User License agreement"
60+
variant={ButtonVariantType.text}
61+
style={ButtonStyleType.neutral}
62+
onClick={handleEULAClick}
63+
component={ButtonComponentType.anchor}
64+
anchorProps={{
65+
href: EULA_LINK,
66+
}}
67+
/>
68+
</div>
69+
</div>
70+
)
71+
}
72+
73+
export default AboutDevtronBody
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentSizeType } from '@Shared/constants'
2+
3+
import { Backdrop } from '../Backdrop'
4+
import { Button } from '../Button'
5+
import AboutDevtronBody from './AboutDevtronBody'
6+
7+
const AboutDevtronDialog = ({ handleCloseLicenseInfoDialog }: { handleCloseLicenseInfoDialog }) => (
8+
<Backdrop onEscape={handleCloseLicenseInfoDialog}>
9+
<div className="flexbox-col w-400 br-12 bg__primary border__primary dc__m-auto mt-40">
10+
<div className="p-24">
11+
<AboutDevtronBody />
12+
</div>
13+
<div className="flex px-24 py-20 dc__content-end">
14+
<Button
15+
dataTestId="license-info-okay"
16+
text="Okay"
17+
size={ComponentSizeType.medium}
18+
onClick={handleCloseLicenseInfoDialog}
19+
/>
20+
</div>
21+
</div>
22+
</Backdrop>
23+
)
24+
25+
export default AboutDevtronDialog
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as AboutDevtronBody } from './AboutDevtronBody'
2+
export { default as AboutDevtronDialog } from './AboutDevtronDialog'

src/Shared/Components/Header/HelpNav.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const HelpNav = ({
7676
onClickHelpOptions(option)
7777
}
7878

79-
const handleOpenLicenseDialog = () => {
79+
const handleOpenAboutDevtron = () => {
8080
ReactGA.event({
8181
category: 'help-nav__about-devtron',
8282
action: 'ABOUT_DEVTRON_CLICKED',
@@ -100,23 +100,22 @@ const HelpNav = ({
100100
<option.icon />
101101
<div className="ml-12 cn-9 fs-14">{option.name}</div>
102102
</a>
103-
{/* licenseData is only set when showLicenseData is received true */}
104-
{isEnterprise && index === 1 && (
103+
{index === 1 && (
105104
<>
106-
{licenseData && (
107-
<button
108-
type="button"
109-
className="dc__transparent help-card__option flexbox dc__align-items-center cn-9 dc__gap-12 fs-14"
110-
onClick={handleOpenLicenseDialog}
111-
data-testid="about-devtron"
112-
>
113-
<Icon name="ic-devtron" color="N600" size={20} />
114-
About Devtron
115-
</button>
105+
<button
106+
type="button"
107+
className="dc__transparent help-card__option flexbox dc__align-items-center cn-9 dc__gap-12 fs-14"
108+
onClick={handleOpenAboutDevtron}
109+
data-testid="about-devtron"
110+
>
111+
<Icon name="ic-devtron" color="N600" size={20} />
112+
About Devtron
113+
</button>
114+
{isEnterprise && (
115+
<div className="help__enterprise pl-8 pb-4-imp pt-4-imp dc__gap-12 flexbox dc__align-items-center h-28">
116+
Enterprise Support
117+
</div>
116118
)}
117-
<div className="help__enterprise pl-8 pb-4-imp pt-4-imp dc__gap-12 flexbox dc__align-items-center h-28">
118-
Enterprise Support
119-
</div>
120119
</>
121120
)}
122121
</Fragment>

src/Shared/Components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
export * from './AboutDevtron'
1718
export * from './ActionMenu'
1819
export * from './ActivityIndicator'
1920
export * from './AnimatedDeployButton'

src/Shared/constants.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ export const DC_DELETE_SUBTITLES = {
538538

539539
export const EULA_LINK = 'https://devtron.ai/end-user-license-agreement-eula'
540540
export const CONTACT_SUPPORT_LINK = 'https://devtron.ai/enterprise-support'
541+
export const PRIVACY_POLICY_LINK = 'https://devtron.ai/privacy-policy'
542+
export const TERMS_OF_USE_LINK = 'https://devtron.ai/terms-of-use'
541543

542544
export const enum DeleteComponentsName {
543545
Cluster = 'cluster',

0 commit comments

Comments
 (0)