@@ -24,6 +24,8 @@ import Property from "./Property";
2424import { PageWithAdminSubMenu } from "./PageWithAdminSubMenu" ;
2525import { BillingMode } from "@gitpod/gitpod-protocol/lib/billing-mode" ;
2626import { AttributionId } from "@gitpod/gitpod-protocol/lib/attribution" ;
27+ import CaretDown from "../icons/CaretDown.svg" ;
28+ import ContextMenu from "../components/ContextMenu" ;
2729
2830export default function UserDetail ( p : { user : User } ) {
2931 const [ activity , setActivity ] = useState ( false ) ;
@@ -147,7 +149,7 @@ export default function UserDetail(p: { user: User }) {
147149 >
148150 { isStudent === undefined ? "---" : isStudent ? "Enabled" : "Disabled" }
149151 </ Property > ,
150- < Property name = "BillingMode" > { billingMode ?. mode || "---" } </ Property > ,
152+ renderBillingModeProperty ( billingMode ) ,
151153 ] ;
152154
153155 switch ( billingMode ?. mode ) {
@@ -328,6 +330,36 @@ export default function UserDetail(p: { user: User }) {
328330 ) ;
329331}
330332
333+ function renderBillingModeProperty ( billingMode ?: BillingMode ) : JSX . Element {
334+ const text = billingMode ?. mode || "---" ;
335+
336+ let blockingTeamNames = [ ] ;
337+ if ( billingMode ?. mode === "chargebee" && ! ! billingMode . teamNames && ! billingMode . canUpgradeToUBB ) {
338+ const itemStyle = "text-gray-400 dark:text-gray-500 text-left font-normal" ;
339+ for ( const teamName of billingMode . teamNames ) {
340+ blockingTeamNames . push ( { title : teamName , customFontStyle : itemStyle } ) ;
341+ }
342+ }
343+ return (
344+ < Property name = "BillingMode" >
345+ < >
346+ { text }
347+ { blockingTeamNames . length > 0 && (
348+ < ContextMenu
349+ menuEntries = { blockingTeamNames }
350+ customClasses = "w-64 max-h-48 overflow-scroll mx-auto left-0 right-0"
351+ >
352+ < p className = "flex justify-left text-gitpod-red" >
353+ < span > UBP blocked by:</ span >
354+ < img className = "m-2" src = { CaretDown } />
355+ </ p >
356+ </ ContextMenu >
357+ ) }
358+ </ >
359+ </ Property >
360+ ) ;
361+ }
362+
331363function Label ( p : { text : string ; color : string } ) {
332364 return (
333365 < div className = { `ml-3 text-sm text-${ p . color } -600 truncate bg-${ p . color } -100 px-1.5 py-0.5 rounded-md my-auto` } >
0 commit comments