File tree Expand file tree Collapse file tree
src/lib/components/billing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 let selectedTab: Tier = BillingPlan .FREE ;
1010
1111 $ : plan = $plansInfo .get (selectedTab );
12+
13+ const allTiers: Tier [] = [BillingPlan .FREE , BillingPlan .PRO , BillingPlan .SCALE ];
14+ $ : visibleTiers = allTiers .filter ((tier ) => tier !== BillingPlan .SCALE );
15+
16+ function getTierName(tier : Tier ): string {
17+ switch (tier ) {
18+ case BillingPlan .FREE :
19+ return tierFree .name ;
20+ case BillingPlan .PRO :
21+ return tierPro .name ;
22+ case BillingPlan .SCALE :
23+ return tierScale .name ;
24+ default :
25+ return ' ' ;
26+ }
27+ }
1228 </script >
1329
1430<Card .Base >
1531 <Layout .Stack >
1632 <Tabs .Root stretch let:root >
17- <Tabs .Item .Button
18- {root }
19- active ={selectedTab === BillingPlan .FREE }
20- on:click ={() => (selectedTab = BillingPlan .FREE )}>
21- {tierFree .name }
22- </Tabs .Item .Button >
23- <Tabs .Item .Button
24- {root }
25- active ={selectedTab === BillingPlan .PRO }
26- on:click ={() => (selectedTab = BillingPlan .PRO )}>
27- {tierPro .name }
28- </Tabs .Item .Button >
29- <Tabs .Item .Button
30- {root }
31- active ={selectedTab === BillingPlan .SCALE }
32- on:click ={() => (selectedTab = BillingPlan .SCALE )}>
33- {tierScale .name }
34- </Tabs .Item .Button >
33+ {#each visibleTiers as tier }
34+ <Tabs .Item .Button
35+ {root }
36+ active ={selectedTab === tier }
37+ on:click ={() => (selectedTab = tier )}>
38+ {getTierName (tier )}
39+ </Tabs .Item .Button >
40+ {/each }
3541 </Tabs .Root >
3642
3743 <Typography .Text variant ="m-600" >{plan .name } plan</Typography .Text >
You can’t perform that action at this time.
0 commit comments