chore: features modal animation
This commit is contained in:
@@ -1,17 +1,16 @@
|
|||||||
import AlertDialog from '../AlertDialog/AlertDialog'
|
|
||||||
import { FunctionComponent, useRef } from 'react'
|
import { FunctionComponent, useRef } from 'react'
|
||||||
import { WebApplication } from '@/Application/WebApplication'
|
import { WebApplication } from '@/Application/WebApplication'
|
||||||
import { PremiumFeatureModalType } from './PremiumFeatureModalType'
|
import { PremiumFeatureModalType } from './PremiumFeatureModalType'
|
||||||
import { FeatureName } from '@/Controllers/FeatureName'
|
import { FeatureName } from '@/Controllers/FeatureName'
|
||||||
import { SuccessPrompt } from './Subviews/SuccessPrompt'
|
import { SuccessPrompt } from './Subviews/SuccessPrompt'
|
||||||
import { UpgradePrompt } from './Subviews/UpgradePrompt'
|
import { UpgradePrompt } from './Subviews/UpgradePrompt'
|
||||||
|
import Modal from '../Modal/Modal'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
featureName?: FeatureName | string
|
featureName?: FeatureName | string
|
||||||
hasSubscription: boolean
|
hasSubscription: boolean
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
showModal: boolean
|
|
||||||
type: PremiumFeatureModalType
|
type: PremiumFeatureModalType
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,17 +19,12 @@ const PremiumFeaturesModal: FunctionComponent<Props> = ({
|
|||||||
featureName,
|
featureName,
|
||||||
hasSubscription,
|
hasSubscription,
|
||||||
onClose,
|
onClose,
|
||||||
showModal,
|
|
||||||
type = PremiumFeatureModalType.UpgradePrompt,
|
type = PremiumFeatureModalType.UpgradePrompt,
|
||||||
}) => {
|
}) => {
|
||||||
const ctaButtonRef = useRef<HTMLButtonElement>(null)
|
const ctaButtonRef = useRef<HTMLButtonElement>(null)
|
||||||
|
|
||||||
if (!showModal) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AlertDialog closeDialog={onClose} className="w-full max-w-[90vw] md:max-w-89">
|
<Modal close={onClose} title="Upgrade" className="px-6 py-5" customHeader={<></>}>
|
||||||
<div tabIndex={-1} className="sn-component">
|
<div tabIndex={-1} className="sn-component">
|
||||||
<div tabIndex={0}>
|
<div tabIndex={0}>
|
||||||
{type === PremiumFeatureModalType.UpgradePrompt && (
|
{type === PremiumFeatureModalType.UpgradePrompt && (
|
||||||
@@ -46,7 +40,7 @@ const PremiumFeaturesModal: FunctionComponent<Props> = ({
|
|||||||
{type === PremiumFeatureModalType.UpgradeSuccess && <SuccessPrompt ctaRef={ctaButtonRef} onClose={onClose} />}
|
{type === PremiumFeatureModalType.UpgradeSuccess && <SuccessPrompt ctaRef={ctaButtonRef} onClose={onClose} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</AlertDialog>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { WebApplication } from '@/Application/WebApplication'
|
|||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import { FunctionComponent, createContext, useCallback, useContext, ReactNode } from 'react'
|
import { FunctionComponent, createContext, useCallback, useContext, ReactNode } from 'react'
|
||||||
import PremiumFeaturesModal from '@/Components/PremiumFeaturesModal/PremiumFeaturesModal'
|
import PremiumFeaturesModal from '@/Components/PremiumFeaturesModal/PremiumFeaturesModal'
|
||||||
|
import ModalOverlay from '@/Components/Modal/ModalOverlay'
|
||||||
|
|
||||||
type PremiumModalContextData = {
|
type PremiumModalContextData = {
|
||||||
activate: (featureName: string) => void
|
activate: (featureName: string) => void
|
||||||
@@ -44,16 +45,19 @@ const PremiumModalProvider: FunctionComponent<Props> = observer(({ application,
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{application.featuresController.premiumAlertType != undefined && (
|
<ModalOverlay
|
||||||
|
isOpen={application.featuresController.premiumAlertType != undefined}
|
||||||
|
close={close}
|
||||||
|
className="w-full max-w-[90vw] md:max-w-89"
|
||||||
|
>
|
||||||
<PremiumFeaturesModal
|
<PremiumFeaturesModal
|
||||||
application={application}
|
application={application}
|
||||||
featureName={featureName}
|
featureName={featureName}
|
||||||
hasSubscription={hasSubscription}
|
hasSubscription={hasSubscription}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
showModal={application.featuresController.premiumAlertType != undefined}
|
type={application.featuresController.premiumAlertType!}
|
||||||
type={application.featuresController.premiumAlertType}
|
|
||||||
/>
|
/>
|
||||||
)}
|
</ModalOverlay>
|
||||||
<PremiumModalProvider_ value={{ activate }}>{children}</PremiumModalProvider_>
|
<PremiumModalProvider_ value={{ activate }}>{children}</PremiumModalProvider_>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user