1- import { Alert , AlertDescription , AlertIcon , Box , Flex , Text } from '@redpanda-data/ui' ;
21import { Link } from 'components/redpanda-ui/components/typography' ;
32import { type FC , type ReactElement , useEffect , useState } from 'react' ;
43
@@ -27,6 +26,7 @@ import {
2726 type ListEnterpriseFeaturesResponse_Feature ,
2827} from '../../protogen/redpanda/api/console/v1alpha1/license_pb' ;
2928import { api } from '../../state/backend-api' ;
29+ import { Alert , AlertDescription } from '../redpanda-ui/components/alert' ;
3030
3131// biome-ignore lint/nursery/useMaxParams: Refactoring to options object would require updating all call sites
3232const getLicenseAlertContentForFeature = (
@@ -36,7 +36,7 @@ const getLicenseAlertContentForFeature = (
3636 bakedInTrial : boolean ,
3737 onRegisterModalOpen : ( ) => void
3838 // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex business logic
39- ) : { message : ReactElement ; status : 'warning ' | 'info' } | null => {
39+ ) : { message : ReactElement ; variant : 'destructive ' | 'info' } | null => {
4040 if ( license === undefined ) {
4141 return null ;
4242 }
@@ -47,23 +47,23 @@ const getLicenseAlertContentForFeature = (
4747 if ( bakedInTrial ) {
4848 return {
4949 message : (
50- < Box >
51- < Text > This is an enterprise feature. Register for an additional 30 days of enterprise features.</ Text >
52- < Flex gap = { 2 } my = { 2 } >
50+ < div >
51+ < p > This is an enterprise feature. Register for an additional 30 days of enterprise features.</ p >
52+ < div className = "my-2 flex gap-2" >
5353 < RegisterButton onRegisterModalOpen = { onRegisterModalOpen } />
54- </ Flex >
55- </ Box >
54+ </ div >
55+ </ div >
5656 ) ,
57- status : msToExpiration > WARNING_THRESHOLD_DAYS * MS_IN_DAY ? 'info' : 'warning ' ,
57+ variant : msToExpiration > WARNING_THRESHOLD_DAYS * MS_IN_DAY ? 'info' : 'destructive ' ,
5858 } ;
5959 }
6060 return {
6161 message : (
62- < Box >
63- < Text > This is an enterprise feature.</ Text >
64- </ Box >
62+ < div >
63+ < p > This is an enterprise feature.</ p >
64+ </ div >
6565 ) ,
66- status : msToExpiration > WARNING_THRESHOLD_DAYS * MS_IN_DAY ? 'info' : 'warning ' ,
66+ variant : msToExpiration > WARNING_THRESHOLD_DAYS * MS_IN_DAY ? 'info' : 'destructive ' ,
6767 } ;
6868 }
6969
@@ -76,22 +76,22 @@ const getLicenseAlertContentForFeature = (
7676 ) {
7777 return {
7878 message : (
79- < Box >
80- < Text > This is an enterprise feature, active until { getPrettyExpirationDate ( license ) } .</ Text >
81- < Flex gap = { 2 } my = { 2 } >
79+ < div >
80+ < p > This is an enterprise feature, active until { getPrettyExpirationDate ( license ) } .</ p >
81+ < div className = "my-2 flex gap-2" >
8282 < UploadLicenseButton />
8383 < UpgradeButton />
84- </ Flex >
85- </ Box >
84+ </ div >
85+ </ div >
8686 ) ,
87- status : 'info' ,
87+ variant : 'info' ,
8888 } ;
8989 }
9090 if ( msToExpiration > - 1 && msToExpiration < 15 * MS_IN_DAY && coreHasEnterpriseFeatures ( enterpriseFeaturesUsed ) ) {
9191 return {
9292 message : (
93- < Box >
94- < Text >
93+ < div >
94+ < p >
9595 Your Redpanda Enterprise trial is expiring in { getPrettyTimeToExpiration ( license ) } ; at that point, your{ ' ' }
9696 < Link href = { ENTERPRISE_FEATURES_DOCS_LINK } rel = "noopener noreferrer" target = "_blank" >
9797 enterprise features
@@ -101,14 +101,14 @@ const getLicenseAlertContentForFeature = (
101101 contact us
102102 </ Link >
103103 .
104- </ Text >
105- < Flex gap = { 2 } my = { 2 } >
104+ </ p >
105+ < div className = "my-2 flex gap-2" >
106106 < UploadLicenseButton />
107107 < UpgradeButton />
108- </ Flex >
109- </ Box >
108+ </ div >
109+ </ div >
110110 ) ,
111- status : 'warning ' ,
111+ variant : 'destructive ' ,
112112 } ;
113113 }
114114 } else {
@@ -117,37 +117,37 @@ const getLicenseAlertContentForFeature = (
117117 if ( license . type === License_Type . TRIAL ) {
118118 return {
119119 message : (
120- < Box >
121- < Text > This is an enterprise feature. Your trial is active until { getPrettyExpirationDate ( license ) } </ Text >
122- < Flex gap = { 2 } my = { 2 } >
120+ < div >
121+ < p > This is an enterprise feature. Your trial is active until { getPrettyExpirationDate ( license ) } </ p >
122+ < div className = "my-2 flex gap-2" >
123123 < UploadLicenseButton />
124124 < UpgradeButton />
125- </ Flex >
126- </ Box >
125+ </ div >
126+ </ div >
127127 ) ,
128- status : 'info' ,
128+ variant : 'info' ,
129129 } ;
130130 }
131131 return {
132132 message : (
133- < Box >
134- < Text >
133+ < div >
134+ < p >
135135 This is a Redpanda Enterprise feature. Try it with our{ ' ' }
136136 < Link href = { getEnterpriseCTALink ( 'tryEnterprise' ) } rel = "noopener noreferrer" target = "_blank" >
137137 Redpanda Enterprise Trial
138138 </ Link >
139139 .
140- </ Text >
141- </ Box >
140+ </ p >
141+ </ div >
142142 ) ,
143- status : 'info' ,
143+ variant : 'info' ,
144144 } ;
145145 }
146146 if ( msToExpiration > 0 && msToExpiration < 15 * MS_IN_DAY && license . type === License_Type . TRIAL ) {
147147 return {
148148 message : (
149- < Box >
150- < Text >
149+ < div >
150+ < p >
151151 Your Redpanda Enterprise trial is expiring in { getPrettyTimeToExpiration ( license ) } ; at that point, your{ ' ' }
152152 < Link href = { ENTERPRISE_FEATURES_DOCS_LINK } rel = "noopener noreferrer" target = "_blank" >
153153 enterprise features
@@ -157,14 +157,14 @@ const getLicenseAlertContentForFeature = (
157157 contact us
158158 </ Link >
159159 .
160- </ Text >
161- < Flex gap = { 2 } my = { 2 } >
160+ </ p >
161+ < div className = "my-2 flex gap-2" >
162162 < UploadLicenseButton />
163163 < UpgradeButton />
164- </ Flex >
165- </ Box >
164+ </ div >
165+ </ div >
166166 ) ,
167- status : 'warning ' ,
167+ variant : 'destructive ' ,
168168 } ;
169169 }
170170 }
@@ -220,16 +220,15 @@ export const FeatureLicenseNotification: FC<{ featureName: 'reassignPartitions'
220220 return null ;
221221 }
222222
223- const { message, status } = alertContent ;
223+ const { message, variant } = alertContent ;
224224
225225 return (
226- < Box >
227- < Alert mb = { 4 } status = { status } variant = "subtle" >
228- < AlertIcon />
226+ < >
227+ < Alert className = "mb-4" variant = { variant } >
229228 < AlertDescription > { message } </ AlertDescription >
230229 </ Alert >
231230
232231 < RegisterModal isOpen = { registerModalOpen } onClose = { ( ) => setIsRegisterModalOpen ( false ) } />
233- </ Box >
232+ </ >
234233 ) ;
235234} ;
0 commit comments