import { chakra, Tooltip, Text, HStack, Menu, MenuButton, Button, MenuItem, MenuList, } from '@chakra-ui/react' import { ChevronDownIcon } from 'assets/icons/ChevronDownIcon' import { HelpCircleIcon } from 'assets/icons/HelpCircleIcon' import { NextChakraLink } from 'components/common/nextChakraAdapters/NextChakraLink' import { Plan } from 'db' import React, { useEffect, useState } from 'react' import { chatsLimit, computePrice, formatPrice, parseNumberWithCommas, storageLimit, } from 'utils' import { PricingCard } from './PricingCard' import { ActionButton } from './PricingCard/ActionButton' export const StarterPlanCard = () => { const [price, setPrice] = useState('39$') const [selectedChatsLimitIndex, setSelectedChatsLimitIndex] = useState(0) const [selectedStorageLimitIndex, setSelectedStorageLimitIndex] = useState(0) useEffect(() => { setPrice( formatPrice( computePrice( Plan.STARTER, selectedChatsLimitIndex ?? 0, selectedStorageLimitIndex ?? 0 ) ?? NaN ) ) }, [selectedChatsLimitIndex, selectedStorageLimitIndex]) return ( 2 seats included , } size="sm" variant="outline" isLoading={selectedChatsLimitIndex === undefined} colorScheme="orange" > {selectedChatsLimitIndex !== undefined ? parseNumberWithCommas( chatsLimit.STARTER.totalIncluded + chatsLimit.STARTER.increaseStep.amount * selectedChatsLimitIndex ) : undefined} {selectedChatsLimitIndex !== 0 && ( setSelectedChatsLimitIndex(0)}> {parseNumberWithCommas(chatsLimit.STARTER.totalIncluded)} )} {selectedChatsLimitIndex !== 1 && ( setSelectedChatsLimitIndex(1)}> {parseNumberWithCommas( chatsLimit.STARTER.totalIncluded + chatsLimit.STARTER.increaseStep.amount )} )} {selectedChatsLimitIndex !== 2 && ( setSelectedChatsLimitIndex(2)}> {parseNumberWithCommas( chatsLimit.STARTER.totalIncluded + chatsLimit.STARTER.increaseStep.amount * 2 )} )} {selectedChatsLimitIndex !== 3 && ( setSelectedChatsLimitIndex(3)}> {parseNumberWithCommas( chatsLimit.STARTER.totalIncluded + chatsLimit.STARTER.increaseStep.amount * 3 )} )} {selectedChatsLimitIndex !== 4 && ( setSelectedChatsLimitIndex(4)}> {parseNumberWithCommas( chatsLimit.STARTER.totalIncluded + chatsLimit.STARTER.increaseStep.amount * 4 )} )} {' '} chats/mo , } size="sm" variant="outline" isLoading={selectedStorageLimitIndex === undefined} colorScheme="orange" > {selectedStorageLimitIndex !== undefined ? parseNumberWithCommas( storageLimit.STARTER.totalIncluded + storageLimit.STARTER.increaseStep.amount * selectedStorageLimitIndex ) : undefined} {selectedStorageLimitIndex !== 0 && ( setSelectedStorageLimitIndex(0)}> {parseNumberWithCommas( storageLimit.STARTER.totalIncluded )} )} {selectedStorageLimitIndex !== 1 && ( setSelectedStorageLimitIndex(1)}> {parseNumberWithCommas( storageLimit.STARTER.totalIncluded + storageLimit.STARTER.increaseStep.amount )} )} {selectedStorageLimitIndex !== 2 && ( setSelectedStorageLimitIndex(2)}> {parseNumberWithCommas( storageLimit.STARTER.totalIncluded + storageLimit.STARTER.increaseStep.amount * 2 )} )} {selectedStorageLimitIndex !== 3 && ( setSelectedStorageLimitIndex(3)}> {parseNumberWithCommas( storageLimit.STARTER.totalIncluded + storageLimit.STARTER.increaseStep.amount * 3 )} )} {selectedStorageLimitIndex !== 4 && ( setSelectedStorageLimitIndex(4)}> {parseNumberWithCommas( storageLimit.STARTER.totalIncluded + storageLimit.STARTER.increaseStep.amount * 4 )} )} {' '} GB of storage , 'Branding removed', 'Collect files from users', 'Create folders', ], }} borderWidth="1px" borderColor="orange.200" button={ Subscribe now } /> ) }