Skip to content

Commit ea09b04

Browse files
committed
use tierToPlan function
1 parent 817fe16 commit ea09b04

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/lib/components/billing/planComparisonBox.svelte

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { BillingPlan } from '$lib/constants';
33
import { formatNum } from '$lib/helpers/string';
4-
import { plansInfo, tierFree, tierPro, tierScale, type Tier } from '$lib/stores/billing';
4+
import { plansInfo, tierToPlan, type Tier } from '$lib/stores/billing';
55
import { Card, Layout, Tabs, Typography } from '@appwrite.io/pink-svelte';
66
77
export let downgrade = false;
@@ -12,19 +12,6 @@
1212
1313
const allTiers: Tier[] = [BillingPlan.FREE, BillingPlan.PRO, BillingPlan.SCALE];
1414
$: 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-
}
2815
</script>
2916

3017
<Card.Base>
@@ -35,7 +22,7 @@
3522
{root}
3623
active={selectedTab === tier}
3724
on:click={() => (selectedTab = tier)}>
38-
{getTierName(tier)}
25+
{tierToPlan(tier).name}
3926
</Tabs.Item.Button>
4027
{/each}
4128
</Tabs.Root>

0 commit comments

Comments
 (0)