@@ -23,28 +23,42 @@ const teamPlanToBadgeVariant: Record<
2323 starter : "warning" ,
2424} ;
2525
26- export function getTeamPlanBadgeLabel ( plan : Team [ "billingPlan" ] ) {
26+ export function getTeamPlanBadgeLabel (
27+ plan : Team [ "billingPlan" ] ,
28+ isLegacyPlan : boolean ,
29+ ) {
2730 if ( plan === "growth_legacy" ) {
2831 return "Growth - Legacy" ;
2932 }
3033
34+ if ( isLegacyPlan ) {
35+ return `${ plan } - Legacy` ;
36+ }
37+
3138 return plan ;
3239}
3340
3441export function TeamPlanBadge ( props : {
3542 teamSlug : string ;
3643 plan : Team [ "billingPlan" ] ;
44+ isLegacyPlan : boolean ;
3745 className ?: string ;
3846 postfix ?: string ;
3947} ) {
4048 const router = useDashboardRouter ( ) ;
4149
4250 function handleNavigateToBilling ( e : React . MouseEvent | React . KeyboardEvent ) {
51+ e . stopPropagation ( ) ;
52+ e . preventDefault ( ) ;
53+
54+ if ( props . isLegacyPlan ) {
55+ router . push ( `/team/${ props . teamSlug } /~/billing` ) ;
56+ return ;
57+ }
58+
4359 if ( props . plan !== "free" ) {
4460 return ;
4561 }
46- e . stopPropagation ( ) ;
47- e . preventDefault ( ) ;
4862 router . push ( `/team/${ props . teamSlug } /~/billing?showPlans=true` ) ;
4963 }
5064
@@ -57,11 +71,13 @@ export function TeamPlanBadge(props: {
5771 handleNavigateToBilling ( e ) ;
5872 }
5973 } }
60- role = { props . plan === "free" ? "button" : undefined }
61- tabIndex = { props . plan === "free" ? 0 : undefined }
62- variant = { teamPlanToBadgeVariant [ props . plan ] }
74+ role = { props . plan === "free" || props . isLegacyPlan ? "button" : undefined }
75+ tabIndex = { props . plan === "free" || props . isLegacyPlan ? 0 : undefined }
76+ variant = {
77+ props . isLegacyPlan ? "warning" : teamPlanToBadgeVariant [ props . plan ]
78+ }
6379 >
64- { `${ getTeamPlanBadgeLabel ( props . plan ) } ${ props . postfix || "" } ` }
80+ { `${ getTeamPlanBadgeLabel ( props . plan , props . isLegacyPlan ) } ${ props . postfix || "" } ` }
6581 </ Badge >
6682 ) ;
6783}
0 commit comments