Skip to content

Commit e4521cf

Browse files
Merge pull request #659 from devtron-labs/feat/license-ga
feat: license ga
2 parents f47e21a + af0caf2 commit e4521cf

File tree

9 files changed

+24
-13
lines changed

9 files changed

+24
-13
lines changed

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.9.8-beta-8",
3+
"version": "1.9.8-beta-9",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const ClipboardButton = ({
3636
copyToClipboardPromise,
3737
rootClassName = '',
3838
iconSize = 16,
39+
onClick,
3940
}: ClipboardProps) => {
4041
const [copied, setCopied] = useState<boolean>(false)
4142
const setCopiedFalseTimeoutRef = useRef<ReturnType<typeof setTimeout>>(-1)
@@ -69,6 +70,7 @@ export const ClipboardButton = ({
6970
stopPropagation(e)
7071
}
7172

73+
onClick?.()
7274
await handleAwaitCopyToClipboardPromise(true)
7375
}
7476

@@ -97,6 +99,7 @@ export const ClipboardButton = ({
9799
<button
98100
type="button"
99101
className={`dc__outline-none-imp p-0 flex dc__transparent--unstyled dc__no-border ${rootClassName}`}
102+
aria-label={`Copy ${content}`}
100103
onClick={handleCopyContent}
101104
>
102105
<Tooltip content={copiedTippyText} alwaysShowTippyOnHover visible={copied}>

src/Common/ClipboardButton/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export default interface ClipboardProps {
2121
copyToClipboardPromise?: Promise<void>
2222
rootClassName?: string
2323
iconSize?: number
24+
onClick?: () => void
2425
}

src/Shared/Components/DevtronLicenseCard/DevtronLicenseCard.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ClipboardButton, getTTLInHumanReadableFormat } from '@Common/index'
44
import { ReactComponent as ICChatSupport } from '@IconsV2/ic-chat-circle-dots.svg'
55
import { getThemeOppositeThemeClass } from '@Shared/Providers/ThemeProvider/utils'
66
import {
7+
AppThemeType,
78
CONTACT_SUPPORT_LINK,
89
DevtronLicenseCardProps,
910
ENTERPRISE_SUPPORT_LINK,
@@ -26,11 +27,13 @@ export const DevtronLicenseCard = ({
2627
isTrial,
2728
ttl,
2829
appTheme,
30+
onCopyButtonClick,
2931
}: DevtronLicenseCardProps) => {
3032
const { bgColor, textColor } = getLicenseColorsAccordingToStatus(licenseStatus)
3133
const remainingTime = getTTLInHumanReadableFormat(ttl)
3234
const remainingTimeString = ttl < 0 ? `Expired ${remainingTime} ago` : `${remainingTime} remaining`
3335
const isLicenseValid = licenseStatus !== LicenseStatus.EXPIRED
36+
const isThemeDark = appTheme === AppThemeType.dark
3437

3538
const cardRef = useRef<HTMLDivElement>(null)
3639

@@ -69,12 +72,10 @@ export const DevtronLicenseCard = ({
6972
)
7073
const sheenPosition = useTransform(diagonalMovement, [-5, 5], [-100, 200])
7174

72-
const sheenOpacity = useTransform(sheenPosition, [-100, 50, 200], [0, 0.05, 0])
73-
const sheenGradient = useMotionTemplate`linear-gradient(
74-
55deg,
75-
transparent,
76-
rgba(255 255 255 / ${sheenOpacity}) ${sheenPosition}%,
77-
transparent)`
75+
const sheenOpacity = useTransform(sheenPosition, [-100, 50, 200], [0, isThemeDark ? 0.25 : 0.1, 0])
76+
const sheenGradient = isThemeDark
77+
? useMotionTemplate`linear-gradient(55deg, transparent, rgba(122, 127, 131, ${sheenOpacity}) ${sheenPosition}%, transparent)`
78+
: useMotionTemplate`linear-gradient(55deg, transparent, rgba(255, 255, 255, ${sheenOpacity}) ${sheenPosition}%, transparent)`
7879

7980
return (
8081
<div className="flexbox-col p-8 br-16" style={{ backgroundColor: bgColor }}>
@@ -104,9 +105,9 @@ export const DevtronLicenseCard = ({
104105
<span>&bull;&bull;&bull;&bull;</span>
105106
<span>{licenseSuffix || licenseKey?.slice(-8)}</span>
106107
</div>
107-
{licenseKey && <ClipboardButton content={licenseKey} />}
108+
{licenseKey && <ClipboardButton content={licenseKey} onClick={onCopyButtonClick} />}
108109
</div>
109-
<div className="flexbox dc__align-items-center dc__gap-4 flex-wrap">
110+
<div className="flexbox dc__align-items-center dc__gap-4 flex-wrap fs-12">
110111
<span className="font-ibm-plex-mono cn-9">{expiryDate}</span>
111112
<span className="cn-9">·</span>
112113
<span style={{ color: textColor }}>{remainingTimeString}</span>

src/Shared/Components/DevtronLicenseCard/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ export type DevtronLicenseCardProps = {
1616
} & (
1717
| {
1818
licenseKey: string
19+
onCopyButtonClick?: () => void
1920
licenseSuffix?: never
2021
}
2122
| {
2223
licenseKey?: never
24+
onCopyButtonClick?: never
2325
licenseSuffix: string
2426
}
2527
)

src/Shared/Components/DevtronLicenseCard/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const parseDevtronLicenseDTOIntoLicenseCardData = <isCentralDashboard ext
3838
licenseDTO || {}
3939

4040
return {
41-
enterpriseName: organisationMetadata?.name || '',
41+
enterpriseName: organisationMetadata?.name || 'Devtron Enterprise',
4242
expiryDate: expiry ? moment(expiry).format(DATE_TIME_FORMATS['DD/MM/YYYY']) : '',
4343
ttl,
4444
licenseStatus: getDevtronLicenseStatus({ ttl, reminderThreshold }),

src/Shared/Components/Header/HelpNav.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ const HelpNav = ({
9090
}
9191

9292
const handleOpenLicenseDialog = () => {
93+
ReactGA.event({
94+
category: 'help-nav__about-devtron',
95+
action: 'ABOUT_DEVTRON_CLICKED',
96+
})
9397
handleOpenLicenseInfoDialog()
9498
}
9599

src/Shared/Helpers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,14 +1087,14 @@ export const getCentralAPIHealthObjectFromLocalStorage = (): CentralAPILocalConf
10871087
return {
10881088
lastUpdatedDate: lastUpdatedDate || '',
10891089
updateCount: updateCount || 0,
1090-
isConnected: isConnected || null,
1090+
isConnected: isConnected || false,
10911091
}
10921092
} catch {
10931093
localStorage.removeItem(CENTRAL_API_LOCAL_STORAGE_KEY)
10941094
return {
10951095
lastUpdatedDate: '',
10961096
updateCount: 0,
1097-
isConnected: null,
1097+
isConnected: false,
10981098
}
10991099
}
11001100
}

src/Shared/constants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ export const DC_DELETE_SUBTITLES = {
521521
}
522522

523523
export const EULA_LINK = 'https://devtron.ai/end-user-license-agreement-eula'
524-
export const CONTACT_SUPPORT_LINK = 'https://share.hsforms.com/1Yp3bvPAaRCaHUEH5vtMjEQ4368n'
524+
export const CONTACT_SUPPORT_LINK = 'https://devtron.ai/enterprise-support'
525525

526526
export const enum DeleteComponentsName {
527527
Cluster = 'cluster',

0 commit comments

Comments
 (0)