Skip to content

Commit dce0275

Browse files
committed
chore: update version to 1.9.8-beta-9 and add onClick prop to ClipboardButton and DevtronLicenseCard components
1 parent d9dbbe1 commit dce0275

File tree

6 files changed

+13
-2
lines changed

6 files changed

+13
-2
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const DevtronLicenseCard = ({
2626
isTrial,
2727
ttl,
2828
appTheme,
29+
onCopyButtonClick,
2930
}: DevtronLicenseCardProps) => {
3031
const { bgColor, textColor } = getLicenseColorsAccordingToStatus(licenseStatus)
3132
const remainingTime = getTTLInHumanReadableFormat(ttl)
@@ -104,7 +105,7 @@ 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>
109110
<div className="flexbox dc__align-items-center dc__gap-4 flex-wrap">
110111
<span className="font-ibm-plex-mono cn-9">{expiryDate}</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/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

0 commit comments

Comments
 (0)