2
0
Files
bot/apps/builder/components/account/BillingSection.tsx

32 lines
984 B
TypeScript
Raw Normal View History

2021-12-27 15:59:32 +01:00
import { Stack, Heading, HStack, Button, Text } from '@chakra-ui/react'
import { NextChakraLink } from 'components/nextChakra/NextChakraLink'
import { useUser } from 'contexts/UserContext'
2021-12-28 11:13:09 +01:00
import { Plan } from 'db'
2021-12-27 15:59:32 +01:00
import React from 'react'
import { SubscriptionTag } from './SubscriptionTag'
export const BillingSection = () => {
const { user } = useUser()
return (
<Stack direction="row" spacing="10" justifyContent={'space-between'}>
<Heading as="h2" fontSize="xl">
Billing
</Heading>
<Stack spacing="6" w="400px">
<HStack>
<Text>Your subscription</Text>
<SubscriptionTag plan={user?.plan} />
</HStack>
{user?.stripeId && (
2021-12-28 11:13:09 +01:00
<Button as={NextChakraLink} href="/api/stripe/customer-portal">
Manage my subscription
2021-12-27 15:59:32 +01:00
</Button>
)}
2021-12-28 11:13:09 +01:00
{user?.plan === Plan.FREE && (
<Button colorScheme="blue">Upgrade</Button>
)}
2021-12-27 15:59:32 +01:00
</Stack>
</Stack>
)
}