@@ -33,11 +33,7 @@ export default function License() {
3333 // eslint-disable-next-line react-hooks/exhaustive-deps
3434 } , [ ] ) ;
3535
36- const featureList = license ?. enabledFeatures ;
37- const features = license ?. features ;
38-
39- // if user seats is 0, it means that there is no user limit in the license
40- const userLimit = license ?. seats === 0 ? "Unlimited" : license ?. seats ;
36+ const userLimit = "Unlimited" ;
4137
4238 const [ licenseLevel , paid , statusMessage ] = license ? getSubscriptionLevel ( license ) : defaultMessage ( ) ;
4339
@@ -49,20 +45,6 @@ export default function License() {
4945 < span >
5046 { licenseLevel }
5147 { paid }
52- < div className = "mt-4 font-semibold text-sm" > Available features:</ div >
53- < div className = "flex flex-col items-start text-sm" >
54- { features &&
55- features . map ( ( feat : string ) => (
56- < span className = "inline-flex space-x-1" >
57- { featureList ?. includes ( feat ) ? (
58- < CheckSvg fill = "currentColor" className = "self-center mt-1" />
59- ) : (
60- < XSvg fill = "currentColor" className = "self-center h-2 mt-1" />
61- ) }
62- < span > { capitalizeInitials ( feat ) } </ span >
63- </ span >
64- ) ) }
65- </ div >
6648 </ span >
6749 </ Card >
6850 < SolidCard className = "w-72 h-64" >
@@ -71,18 +53,6 @@ export default function License() {
7153 < p className = "dark:text-gray-500 font-semibold" > Registered Users</ p >
7254 < span className = "dark:text-gray-300 text-lg" > { license ?. userCount || 0 } </ span >
7355 < span className = "dark:text-gray-500 text-gray-400 pt-1 text-lg" > / { userLimit } </ span >
74- < p className = "dark:text-gray-500 pt-2 font-semibold" > License Type</ p >
75- < h4 className = "dark:text-gray-300 text-lg" > { capitalizeInitials ( license ?. type || "" ) } </ h4 >
76- < a
77- className = "gp-link flex flex-row mr-2 justify-end font-semibold space-x-2 mt-6"
78- href = "https://www.gitpod.io/self-hosted"
79- target = "_blank"
80- >
81- < span className = "text-sm" > Compare Plans</ span >
82- < div className = "self-end" >
83- < LinkSvg />
84- </ div >
85- </ a >
8656 </ span >
8757 </ SolidCard >
8858 </ div >
@@ -91,26 +61,8 @@ export default function License() {
9161 ) ;
9262}
9363
94- function capitalizeInitials ( str : string ) : string {
95- return str
96- . split ( "-" )
97- . map ( ( item ) => {
98- return item . charAt ( 0 ) . toUpperCase ( ) + item . slice ( 1 ) ;
99- } )
100- . join ( " " ) ;
101- }
102-
10364function getSubscriptionLevel ( license : LicenseInfo ) : ReactElement [ ] {
104- switch ( license . plan ) {
105- case "prod" :
106- case "trial" :
107- return professionalPlan ( license . userCount || 0 , license . seats , license . plan == "trial" , license . validUntil ) ;
108- case "community" :
109- return communityPlan ( license . userCount || 0 , license . seats , license . fallbackAllowed ) ;
110- default : {
111- return defaultMessage ( ) ;
112- }
113- }
65+ return professionalPlan ( license . userCount || 0 ) ;
11466}
11567
11668function licenseLevel ( level : string ) : ReactElement {
@@ -136,16 +88,9 @@ function defaultMessage(): ReactElement[] {
13688 return [ licenseLevel ( "Inactive" ) , additionalLicenseInfo ( "Free" ) , alertMessage ( ) ] ;
13789}
13890
139- function professionalPlan ( userCount : number , seats : number , trial : boolean , validUntil : string ) : ReactElement [ ] {
140- const alertMessage = ( aboveLimit : boolean ) => {
141- return aboveLimit ? (
142- < span className = "text-red-700 dark:text-red-400 flex font-semibold items-center" >
143- < div > You have exceeded the usage limit.</ div >
144- < div className = "flex justify-right my-4 mr-2 ml-4" >
145- < Alert className = "h-6 w-6" />
146- </ div >
147- </ span >
148- ) : (
91+ function professionalPlan ( userCount : number ) : ReactElement [ ] {
92+ const alertMessage = ( ) => {
93+ return (
14994 < span className = "text-green-600 dark:text-green-400 flex font-semibold items-center" >
15095 < div > You have an active professional license.</ div >
15196 < div className = "flex justify-right my-4 mr-2 ml-4" >
@@ -155,56 +100,5 @@ function professionalPlan(userCount: number, seats: number, trial: boolean, vali
155100 ) ;
156101 } ;
157102
158- // seats === 0 means unlimited number of users
159- const aboveLimit : boolean = seats === 0 ? false : userCount > seats ;
160-
161- const licenseTitle = ( ) => {
162- const expDate = new Date ( validUntil ) ;
163- if ( typeof expDate . getTime !== "function" ) {
164- return trial ? additionalLicenseInfo ( "Trial" ) : additionalLicenseInfo ( "Paid" ) ;
165- } else {
166- return additionalLicenseInfo (
167- "Expires on " +
168- expDate . toLocaleDateString ( "en-DB" , { year : "numeric" , month : "short" , day : "numeric" } ) ,
169- ) ;
170- }
171- } ;
172-
173- return [ licenseLevel ( "Professional" ) , licenseTitle ( ) , alertMessage ( aboveLimit ) ] ;
174- }
175-
176- function communityPlan ( userCount : number , seats : number , fallbackAllowed : boolean ) : ReactElement [ ] {
177- const alertMessage = ( aboveLimit : boolean ) => {
178- if ( aboveLimit ) {
179- return fallbackAllowed ? (
180- < div className = "text-gray-600 dark:text-gray-50 flex font-semibold items-center" >
181- < div > No active license. You are using community edition.</ div >
182- < div className = "my-4 mr-2 ml-4" >
183- < Success className = "h-8 w-8" />
184- </ div >
185- </ div >
186- ) : (
187- < span className = "text-red-700 dark:text-red-400 flex font-semibold items-center" >
188- < div > No active license. You have exceeded the usage limit.</ div >
189- < div className = "flex justify-right my-4 mr-2 ml-4" >
190- < Alert className = "h-8 w-8" />
191- </ div >
192- </ span >
193- ) ;
194- } else {
195- return (
196- < span className = "text-green-600 dark:text-green-400 flex font-semibold items-center" >
197- < div > You are using the free community edition.</ div >
198- < div className = "flex justify-right my-4 mr-2 ml-4" >
199- < Success fill = "green" className = "h-8 w-8" />
200- </ div >
201- </ span >
202- ) ;
203- }
204- } ;
205-
206- // seats === 0 means unlimited number of users
207- const aboveLimit : boolean = seats === 0 ? false : userCount > seats ;
208-
209- return [ licenseLevel ( "Community" ) , additionalLicenseInfo ( "Free" ) , alertMessage ( aboveLimit ) ] ;
103+ return [ licenseLevel ( "Professional" ) , additionalLicenseInfo ( "Paid" ) , alertMessage ( ) ] ;
210104}
0 commit comments