@@ -34,6 +34,17 @@ import './licenseCard.scss'
3434
3535const DAMPEN_FACTOR = 50
3636
37+ const ContactSupportButton = ( ) => (
38+ < Button
39+ dataTestId = "contact-support"
40+ startIcon = { < ICChatSupport /> }
41+ text = "Contact support"
42+ variant = { ButtonVariantType . text }
43+ component = { ButtonComponentType . anchor }
44+ anchorProps = { { href : CONTACT_SUPPORT_LINK } }
45+ />
46+ )
47+
3748const LicenseCardSubText = ( {
3849 isFreemium,
3950 licenseStatus,
@@ -43,34 +54,29 @@ const LicenseCardSubText = ({
4354 return null
4455 }
4556
46- const isLicenseValid = licenseStatus !== LicenseStatus . EXPIRED && ! licenseStatusError
4757 const freemiumLimitReached = licenseStatusError ?. code === LicensingErrorCodes . ClusterLimitExceeded
4858
49- return licenseStatus !== LicenseStatus . ACTIVE ? (
50- < div className = "p-16 fs-13 lh-1-5 flexbox-col dc__gap-8" >
51- < div className = "flexbox dc__gap-8" >
52- { freemiumLimitReached ? (
53- < div className = "flexbox-col dc__gap-4 fs-13 fw-4 lh-20 cn-9" >
54- < span className = "fw-6" > Multiple Clusters Detected</ span >
55- < span >
56- Your account is connected to multiple clusters, which isn’t allowed on the freemium plan.
57- Upgrade to an Enterprise license or contact us.
58- </ span >
59- </ div >
60- ) : (
61- < span >
62- To renew your license mail us at
63- < a href = { `mailto:${ ENTERPRISE_SUPPORT_LINK } ` } > { ENTERPRISE_SUPPORT_LINK } </ a > or contact your
64- Devtron representative.
65- </ span >
66- ) }
67- < Icon
68- name = { isLicenseValid ? 'ic-timer' : 'ic-error' }
69- color = { isLicenseValid ? 'Y500' : 'R500' }
70- size = { 16 }
71- />
72- </ div >
73- { freemiumLimitReached && (
59+ if ( licenseStatus === LicenseStatus . ACTIVE && isFreemium ) {
60+ return (
61+ < div className = "p-16 fs-13 lh-1-5 flexbox-col dc__gap-8" >
62+ < div className = "flexbox dc__gap-8 dc__content-space fs-13 fw-4 lh-20 cn-9" >
63+ { freemiumLimitReached ? (
64+ < div className = "flexbox-col dc__gap-4" >
65+ < span className = "fw-6" > Multiple Clusters Detected</ span >
66+ < span >
67+ Your account is connected to multiple clusters, which isn’t allowed on the freemium
68+ plan. Upgrade to an Enterprise license or contact us.
69+ </ span >
70+ </ div >
71+ ) : (
72+ < span className = "fw-6" > Unlimited single cluster usage</ span >
73+ ) }
74+ < Icon
75+ name = { freemiumLimitReached ? 'ic-error' : 'ic-success' }
76+ color = { freemiumLimitReached ? 'R500' : 'G500' }
77+ size = { 20 }
78+ />
79+ </ div >
7480 < div className = "mail-support" >
7581 < Button
7682 dataTestId = "mail-support"
@@ -81,20 +87,28 @@ const LicenseCardSubText = ({
8187 anchorProps = { { href : `mailto:${ ENTERPRISE_SUPPORT_LINK } ` } }
8288 />
8389 </ div >
84- ) }
85- < Button
86- dataTestId = "contact-support"
87- startIcon = { < ICChatSupport /> }
88- text = "Contact support"
89- variant = { ButtonVariantType . text }
90- component = { ButtonComponentType . anchor }
91- anchorProps = { { href : CONTACT_SUPPORT_LINK } }
92- />
93- </ div >
94- ) : (
95- < div className = "flexbox p-16 cn-9 fw-6 fs-13 lh-1-5 dc__align-items-center dc__content-space" >
96- < span > Unlimited single cluster usage</ span >
97- < Icon name = "ic-success" size = { 20 } color = { null } />
90+ < ContactSupportButton />
91+ </ div >
92+ )
93+ }
94+
95+ const isLicenseExpired = licenseStatus === LicenseStatus . EXPIRED
96+
97+ return (
98+ < div className = "p-16 fs-13 lh-1-5 flexbox-col dc__gap-8" >
99+ < div className = "flexbox dc__gap-8 dc__content-space" >
100+ < span >
101+ To renew your license mail us at
102+ < a href = { `mailto:${ ENTERPRISE_SUPPORT_LINK } ` } > { ENTERPRISE_SUPPORT_LINK } </ a > or contact your Devtron
103+ representative.
104+ </ span >
105+ < Icon
106+ name = { isLicenseExpired ? 'ic-error' : 'ic-timer' }
107+ color = { isLicenseExpired ? 'R500' : 'Y500' }
108+ size = { 16 }
109+ />
110+ </ div >
111+ < ContactSupportButton />
98112 </ div >
99113 )
100114}
@@ -112,7 +126,7 @@ export const DevtronLicenseCard = ({
112126 handleCopySuccess,
113127 licenseStatusError,
114128} : DevtronLicenseCardProps ) => {
115- const { bgColor, textColor } = getLicenseColorsAccordingToStatus ( licenseStatus )
129+ const { bgColor, textColor } = getLicenseColorsAccordingToStatus ( { isFreemium , licenseStatus, licenseStatusError } )
116130 const remainingTime = getTTLInHumanReadableFormat ( ttl )
117131 const remainingTimeString = ttl < 0 ? `Expired ${ remainingTime } ago` : `${ remainingTime } remaining`
118132 const isThemeDark = appTheme === AppThemeType . dark
0 commit comments