✨ Add usage-based new pricing plans
This commit is contained in:
committed by
Baptiste Arnaud
parent
6a1eaea700
commit
898367a33b
@ -15,14 +15,12 @@ import {
|
||||
import { ChevronLeftIcon } from 'assets/icons'
|
||||
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
import { Plan } from 'db'
|
||||
import { InputBlockType } from 'models'
|
||||
import { useRouter } from 'next/router'
|
||||
import { timeSince } from 'services/utils'
|
||||
import { isFreePlan } from 'services/workspace'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { UpgradeModal } from '../modals/UpgradeModal'
|
||||
import { LimitReached } from '../modals/UpgradeModal/UpgradeModal'
|
||||
import { LimitReached, ChangePlanModal } from '../modals/ChangePlanModal'
|
||||
|
||||
export const PublishButton = (props: ButtonProps) => {
|
||||
const { workspace } = useWorkspace()
|
||||
@ -50,8 +48,7 @@ export const PublishButton = (props: ButtonProps) => {
|
||||
|
||||
return (
|
||||
<HStack spacing="1px">
|
||||
<UpgradeModal
|
||||
plan={Plan.PRO}
|
||||
<ChangePlanModal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
type={LimitReached.FILE_INPUT}
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { Button, ButtonProps, useDisclosure } from '@chakra-ui/react'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
import { Plan } from 'db'
|
||||
import React from 'react'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { UpgradeModal } from '../modals/UpgradeModal'
|
||||
import { LimitReached } from '../modals/UpgradeModal/UpgradeModal'
|
||||
import { ChangePlanModal } from '../modals/ChangePlanModal'
|
||||
import { LimitReached } from '../modals/ChangePlanModal'
|
||||
|
||||
type Props = { plan?: Plan; type?: LimitReached } & ButtonProps
|
||||
type Props = { type?: LimitReached } & ButtonProps
|
||||
|
||||
export const UpgradeButton = ({ type, plan = Plan.PRO, ...props }: Props) => {
|
||||
export const UpgradeButton = ({ type, ...props }: Props) => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure()
|
||||
const { workspace } = useWorkspace()
|
||||
return (
|
||||
@ -19,7 +18,7 @@ export const UpgradeButton = ({ type, plan = Plan.PRO, ...props }: Props) => {
|
||||
onClick={onOpen}
|
||||
>
|
||||
{props.children ?? 'Upgrade'}
|
||||
<UpgradeModal isOpen={isOpen} onClose={onClose} type={type} plan={plan} />
|
||||
<ChangePlanModal isOpen={isOpen} onClose={onClose} type={type} />
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ export const UploadButton = ({
|
||||
},
|
||||
],
|
||||
})
|
||||
if (urls.length) onFileUploaded(urls[0])
|
||||
if (urls.length && urls[0]) onFileUploaded(urls[0])
|
||||
setIsUploading(false)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user