Skip to content

Commit ef85e86

Browse files
committed
Merge branch 'feat/about-devtron' of https://github.com/devtron-labs/devtron-fe-common-lib into feat/tab-group-animations
2 parents 29a038a + fb512c6 commit ef85e86

8 files changed

Lines changed: 133 additions & 19 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.12.0-pre-2",
3+
"version": "1.12.0-pre-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 = ({
8+
handleCloseLicenseInfoDialog,
9+
isFELibAvailable,
10+
}: {
11+
handleCloseLicenseInfoDialog: () => void
12+
isFELibAvailable: boolean
13+
}) => (
14+
<Backdrop onEscape={handleCloseLicenseInfoDialog}>
15+
<div className="flexbox-col w-400 br-12 bg__primary border__primary dc__m-auto mt-40">
16+
<div className="p-24">
17+
<AboutDevtronBody isFELibAvailable={isFELibAvailable} />
18+
</div>
19+
<div className="flex px-24 py-20 dc__content-end">
20+
<Button
21+
dataTestId="license-info-okay"
22+
text="Okay"
23+
size={ComponentSizeType.medium}
24+
onClick={handleCloseLicenseInfoDialog}
25+
/>
26+
</div>
27+
</div>
28+
</Backdrop>
29+
)
30+
31+
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)