Skip to content

Commit 16f1603

Browse files
committed
feat: add trial information in license card
1 parent 565184f commit 16f1603

File tree

2 files changed

+38
-25
lines changed

2 files changed

+38
-25
lines changed

src/Shared/Components/LicenseInfoDialog/LicenseInfoDialog.components.tsx

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ export type DevtronLicenseCardProps = {
2828
}
2929
)
3030

31-
export const getColorAccordingToStatus = (licenseStatus: LicenseStatus) => {
31+
export const getColorAccordingToStatus = (licenseStatus: LicenseStatus): { bgColor: string; textColor: string } => {
3232
switch (licenseStatus) {
3333
case LicenseStatus.ACTIVE:
34-
return 'var(--G100)'
34+
return { bgColor: 'var(--G100)', textColor: 'var(--G500)' }
3535
case LicenseStatus.REMINDER_THRESHOLD_REACHED:
36-
return 'var(--Y100)'
36+
return { bgColor: 'var(--Y100)', textColor: 'var(--Y700)' }
3737
default:
38-
return 'var(--R100)'
38+
return { bgColor: 'var(--R100)', textColor: 'var(--R500)' }
3939
}
4040
}
4141

@@ -49,31 +49,37 @@ export const DevtronLicenseCard = ({
4949
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5050
ttl,
5151
}: DevtronLicenseCardProps) => {
52-
const colorValue = getColorAccordingToStatus(licenseStatus)
52+
const { bgColor, textColor } = getColorAccordingToStatus(licenseStatus)
5353

5454
return (
55-
<div className="flexbox-col p-8 br-16" style={{ backgroundColor: colorValue }}>
56-
<div className="license-card flexbox-col dc__content-space br-12 p-20 h-200 bg__tertiary">
57-
<div className="flexbox dc__align-items-center dc__content-space">
58-
<span className="font-merriweather cn-9 fs-16 fw-7 lh-1-5">{enterpriseName}</span>
59-
<Icon name="ic-devtron" color="N900" size={24} />
60-
</div>
61-
<div className="flexbox-col dc__gap-4">
62-
<div className="flexbox dc__align-items-center dc__gap-6">
63-
<Icon name="ic-key" color={null} size={20} />
64-
<div className="flex dc__gap-4 cn-7 fs-16 fw-5 lh-1-5 font-ibm-plex-mono">
65-
<span>••••</span>
66-
<span>{licenseSuffix || licenseKey.slice(-8)}</span>
67-
</div>
68-
{licenseKey && <ClipboardButton content={licenseKey} />}
55+
<div className="flexbox-col p-8 br-16" style={{ backgroundColor: bgColor }}>
56+
<div className="license-card br-12 h-200 bg__tertiary">
57+
<div className="p-20 flexbox-col dc__content-space">
58+
<div className="flexbox dc__align-items-center dc__content-space">
59+
<span className="font-merriweather cn-9 fs-16 fw-7 lh-1-5">{enterpriseName}</span>
60+
<Icon name="ic-devtron" color="N900" size={24} />
6961
</div>
70-
<div className="flexbox dc__align-items-center dc__gap-4">
71-
<span>{expiryDate}</span>
72-
<span></span>
73-
<span style={{ color: colorValue }}>2 months remaining</span>
62+
<div className="flexbox-col dc__gap-4">
63+
<div className="flexbox dc__align-items-center dc__gap-6">
64+
<Icon name="ic-key" color={null} size={20} />
65+
<div className="flex dc__gap-4 cn-7 fs-16 fw-5 lh-1-5 font-ibm-plex-mono">
66+
<span>••••</span>
67+
<span>{licenseSuffix || licenseKey.slice(-8)}</span>
68+
</div>
69+
{licenseKey && <ClipboardButton content={licenseKey} />}
70+
</div>
71+
<div className="flexbox dc__align-items-center dc__gap-4">
72+
<span>{expiryDate}</span>
73+
<span></span>
74+
<span style={{ color: textColor }}>2 months remaining</span>
75+
</div>
7476
</div>
7577
</div>
76-
{isTrial && <div className="flexbox dc__align-items-center px-20 py-6">TRIAL LICENSE</div>}
78+
{isTrial && (
79+
<span className="trial-license-badge flexbox dc__align-items-center px-20 py-6 cn-9 fs-11 fw-5 lh-1-5">
80+
TRIAL LICENSE
81+
</span>
82+
)}
7783
</div>
7884
{licenseStatus !== LicenseStatus.ACTIVE && (
7985
<div className="p-16 flexbox-col dc__gap-8">
@@ -133,7 +139,7 @@ export const LicenseInfo = ({ handleUpdateLicenseClick }: { handleUpdateLicenseC
133139
ttl={100}
134140
licenseStatus={LicenseStatus.ACTIVE}
135141
isTrial
136-
expiryDate="2025-05-17"
142+
expiryDate="17/05/2025"
137143
/>
138144
<InstallationFingerprintInfo installationFingerprint="3ff0d8be-e7f2-4bf4-9c3f-70ec904b51f4" showHelpTip />
139145
<div className="border__primary--bottom h-1" />

src/Shared/Components/LicenseInfoDialog/licenseInfoDialog.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@
2323
0px 2px 6px 0px rgba(0, 0, 0, 0.04),
2424
0px 4px 12px 0px rgba(0, 0, 0, 0.1);
2525
}
26+
27+
.trial-license-badge {
28+
background-color: var(--bg-hover);
29+
letter-spacing: 0.55px;
30+
border-bottom-left-radius: 12px;
31+
border-bottom-right-radius: 12px;
32+
}

0 commit comments

Comments
 (0)