2022-02-12 12:54:16 +01:00
|
|
|
import {
|
|
|
|
|
Alert,
|
|
|
|
|
AlertIcon,
|
|
|
|
|
AlertProps,
|
|
|
|
|
Button,
|
|
|
|
|
HStack,
|
|
|
|
|
Text,
|
|
|
|
|
useDisclosure,
|
|
|
|
|
} from '@chakra-ui/react'
|
2022-01-25 18:19:37 +01:00
|
|
|
import React from 'react'
|
2023-09-25 17:20:42 +02:00
|
|
|
import {
|
|
|
|
|
ChangePlanModal,
|
|
|
|
|
ChangePlanModalProps,
|
|
|
|
|
} from '@/features/billing/components/ChangePlanModal'
|
2023-10-27 09:23:50 +02:00
|
|
|
import { useTranslate } from '@tolgee/react'
|
2023-04-06 17:31:23 +02:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
buttonLabel?: string
|
2023-09-25 17:20:42 +02:00
|
|
|
} & AlertProps &
|
|
|
|
|
Pick<ChangePlanModalProps, 'type' | 'excludedPlans'>
|
2022-01-25 18:19:37 +01:00
|
|
|
|
2022-11-15 09:35:48 +01:00
|
|
|
export const UnlockPlanAlertInfo = ({
|
2023-04-06 17:31:23 +02:00
|
|
|
buttonLabel,
|
2022-02-12 12:54:16 +01:00
|
|
|
type,
|
2023-09-25 17:20:42 +02:00
|
|
|
excludedPlans,
|
2022-09-17 16:37:33 +02:00
|
|
|
...props
|
2023-04-06 17:31:23 +02:00
|
|
|
}: Props) => {
|
2023-10-27 09:23:50 +02:00
|
|
|
const { t } = useTranslate()
|
2022-02-12 12:54:16 +01:00
|
|
|
const { isOpen, onOpen, onClose } = useDisclosure()
|
|
|
|
|
return (
|
|
|
|
|
<Alert
|
|
|
|
|
status="info"
|
|
|
|
|
rounded="md"
|
|
|
|
|
justifyContent="space-between"
|
2022-04-12 13:55:44 -05:00
|
|
|
flexShrink={0}
|
2022-09-17 16:37:33 +02:00
|
|
|
{...props}
|
2022-02-12 12:54:16 +01:00
|
|
|
>
|
|
|
|
|
<HStack>
|
|
|
|
|
<AlertIcon />
|
2023-09-27 14:22:51 +02:00
|
|
|
<Text>{props.children}</Text>
|
2022-02-12 12:54:16 +01:00
|
|
|
</HStack>
|
2022-09-17 16:37:33 +02:00
|
|
|
<Button
|
|
|
|
|
colorScheme={props.status === 'warning' ? 'orange' : 'blue'}
|
|
|
|
|
onClick={onOpen}
|
|
|
|
|
flexShrink={0}
|
|
|
|
|
ml="2"
|
|
|
|
|
>
|
2023-04-06 17:31:23 +02:00
|
|
|
{buttonLabel ?? t('billing.upgradeAlert.buttonDefaultLabel')}
|
2022-02-12 12:54:16 +01:00
|
|
|
</Button>
|
2023-09-25 17:20:42 +02:00
|
|
|
<ChangePlanModal
|
|
|
|
|
isOpen={isOpen}
|
|
|
|
|
onClose={onClose}
|
|
|
|
|
type={type}
|
|
|
|
|
excludedPlans={excludedPlans}
|
|
|
|
|
/>
|
2022-02-12 12:54:16 +01:00
|
|
|
</Alert>
|
|
|
|
|
)
|
|
|
|
|
}
|