feat: upgrade cta (#1655)
This commit is contained in:
@@ -19,6 +19,7 @@ import { EditorEventSource } from '@/Types/EditorEventSource'
|
|||||||
import QuickSettingsButton from './QuickSettingsButton'
|
import QuickSettingsButton from './QuickSettingsButton'
|
||||||
import AccountMenuButton from './AccountMenuButton'
|
import AccountMenuButton from './AccountMenuButton'
|
||||||
import StyledTooltip from '../StyledTooltip/StyledTooltip'
|
import StyledTooltip from '../StyledTooltip/StyledTooltip'
|
||||||
|
import UpgradeNow from './UpgradeNow'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
@@ -382,6 +383,10 @@ class Footer extends PureComponent<Props, State> {
|
|||||||
quickSettingsMenuController={this.viewControllerManager.quickSettingsMenuController}
|
quickSettingsMenuController={this.viewControllerManager.quickSettingsMenuController}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<UpgradeNow
|
||||||
|
application={this.application}
|
||||||
|
featuresController={this.viewControllerManager.featuresController}
|
||||||
|
/>
|
||||||
{this.state.showBetaWarning && (
|
{this.state.showBetaWarning && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className="relative z-footer-bar-item ml-3 flex select-none items-center border-l border-solid border-border pl-3">
|
<div className="relative z-footer-bar-item ml-3 flex select-none items-center border-l border-solid border-border pl-3">
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { WebApplication } from '@/Application/Application'
|
||||||
|
import { FeaturesController } from '@/Controllers/FeaturesController'
|
||||||
|
import { observer } from 'mobx-react-lite'
|
||||||
|
import { loadPurchaseFlowUrl } from '../PurchaseFlow/PurchaseFlowFunctions'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
application: WebApplication
|
||||||
|
featuresController: FeaturesController
|
||||||
|
}
|
||||||
|
|
||||||
|
const UpgradeNow = ({ application, featuresController }: Props) => {
|
||||||
|
const shouldShowCTA = !featuresController.hasFolders
|
||||||
|
const hasAccount = application.hasAccount()
|
||||||
|
|
||||||
|
const openPlansPage = () => {
|
||||||
|
if (!window.plansUrl) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (application.isNativeMobileWeb()) {
|
||||||
|
application.mobileDevice.openUrl(window.plansUrl)
|
||||||
|
} else {
|
||||||
|
window.location.assign(window.plansUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return shouldShowCTA ? (
|
||||||
|
<div className="flex h-full items-center px-2">
|
||||||
|
<button
|
||||||
|
className="rounded bg-info py-0.5 px-1.5 text-xs font-bold uppercase text-info-contrast hover:brightness-125"
|
||||||
|
onClick={() => {
|
||||||
|
if (hasAccount) {
|
||||||
|
void loadPurchaseFlowUrl(application)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
openPlansPage()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Upgrade now
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
export default observer(UpgradeNow)
|
||||||
@@ -12,6 +12,7 @@ import { classNames } from '@/Utils/ConcatenateClassNames'
|
|||||||
import Icon from '../Icon/Icon'
|
import Icon from '../Icon/Icon'
|
||||||
import { useResponsiveAppPane } from '../ResponsivePane/ResponsivePaneProvider'
|
import { useResponsiveAppPane } from '../ResponsivePane/ResponsivePaneProvider'
|
||||||
import { isIOS } from '@/Utils'
|
import { isIOS } from '@/Utils'
|
||||||
|
import UpgradeNow from '../Footer/UpgradeNow'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
@@ -86,7 +87,7 @@ const Navigation: FunctionComponent<Props> = ({ application }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center border-t border-border px-3.5 pt-2.5 md:hidden">
|
<div className="flex items-center border-t border-border px-3.5 pt-2.5 md:hidden">
|
||||||
<button
|
<button
|
||||||
className="flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-full border border-solid border-border bg-default text-neutral hover:bg-contrast focus:bg-contrast"
|
className="mr-auto flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-full border border-solid border-border bg-default text-neutral hover:bg-contrast focus:bg-contrast"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
toggleAppPane(AppPaneId.Items)
|
toggleAppPane(AppPaneId.Items)
|
||||||
}}
|
}}
|
||||||
@@ -95,8 +96,9 @@ const Navigation: FunctionComponent<Props> = ({ application }) => {
|
|||||||
>
|
>
|
||||||
<Icon type="chevron-left" />
|
<Icon type="chevron-left" />
|
||||||
</button>
|
</button>
|
||||||
|
<UpgradeNow application={application} featuresController={viewControllerManager.featuresController} />
|
||||||
<button
|
<button
|
||||||
className="ml-auto flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-full border border-solid border-border bg-default text-neutral hover:bg-contrast focus:bg-contrast"
|
className="ml-2.5 flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-full border border-solid border-border bg-default text-neutral hover:bg-contrast focus:bg-contrast"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
viewControllerManager.accountMenuController.toggleShow()
|
viewControllerManager.accountMenuController.toggleShow()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -20,7 +20,14 @@ export const loadPurchaseFlowUrl = async (application: WebApplication): Promise<
|
|||||||
const period = params.get('period') ? `&period=${params.get('period')}` : ''
|
const period = params.get('period') ? `&period=${params.get('period')}` : ''
|
||||||
const plan = params.get('plan') ? `&plan=${params.get('plan')}` : ''
|
const plan = params.get('plan') ? `&plan=${params.get('plan')}` : ''
|
||||||
if (url) {
|
if (url) {
|
||||||
window.location.assign(`${url}${period}${plan}`)
|
const finalUrl = `${url}${period}${plan}`
|
||||||
|
|
||||||
|
if (application.isNativeMobileWeb()) {
|
||||||
|
application.mobileDevice.openUrl(finalUrl)
|
||||||
|
} else {
|
||||||
|
window.location.assign(finalUrl)
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user