Files
bot/apps/builder/src/features/billing/components/ChangePlanModal.tsx
Baptiste Arnaud bed8b42a2e 🧑‍💻 Migrate to Tolgee (#976)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

### Summary by CodeRabbit

- Refactor: Transitioned to a new translation library (`@tolgee/react`)
across the application, enhancing the localization capabilities and
consistency.
- New Feature: Introduced a JSON configuration file for application
settings, improving customization and flexibility.
- Refactor: Updated SVG attribute naming convention in the
`WhatsAppLogo` component to align with React standards.
- Chore: Adjusted the `.gitignore` file and added a new line at the end.
- Documentation: Added instructions for setting up environment variables
for the Tolgee i18n contribution dev tool, improving the self-hosting
configuration guide.
- Style: Updated the `CollaborationMenuButton` to hide the
`PopoverContent` component by scaling it down to zero.
- Refactor: Simplified error handling logic for fetching and updating
typebots in `TypebotProvider.tsx`, improving code readability and
maintenance.
- Refactor: Removed the dependency on the `parseGroupTitle` function,
simplifying the code in several components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-10-27 09:23:50 +02:00

64 lines
1.4 KiB
TypeScript

import { AlertInfo } from '@/components/AlertInfo'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { useTranslate } from '@tolgee/react'
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalOverlay,
Stack,
Button,
HStack,
} from '@chakra-ui/react'
import { ChangePlanForm } from './ChangePlanForm'
export type ChangePlanModalProps = {
type?: string
isOpen: boolean
excludedPlans?: ('STARTER' | 'PRO')[]
onClose: () => void
}
export const ChangePlanModal = ({
onClose,
isOpen,
type,
excludedPlans,
}: ChangePlanModalProps) => {
const { t } = useTranslate()
const { workspace } = useWorkspace()
return (
<Modal
isOpen={isOpen}
onClose={onClose}
size={excludedPlans ? 'lg' : '2xl'}
>
<ModalOverlay />
<ModalContent>
<ModalBody as={Stack} spacing="6" pt="10">
{type && (
<AlertInfo>
{t('billing.upgradeLimitLabel', { type: type })}
</AlertInfo>
)}
{workspace && (
<ChangePlanForm
workspace={workspace}
excludedPlans={excludedPlans}
/>
)}
</ModalBody>
<ModalFooter>
<HStack>
<Button colorScheme="gray" onClick={onClose}>
{t('cancel')}
</Button>
</HStack>
</ModalFooter>
</ModalContent>
</Modal>
)
}