Skip to content

Commit 817fe16

Browse files
committed
hide Scale tier in plan comparison via filtered tabs
1 parent 0e707ff commit 817fe16

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

src/lib/components/billing/planComparisonBox.svelte

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,35 @@
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>

0 commit comments

Comments
 (0)