chore: show Super demo modal if user doesn't have subscription when switching editor to Super

This commit is contained in:
Aman Harwara
2023-12-22 16:40:42 +05:30
committed by GitHub
parent 485339be86
commit 29b7e989a6
26 changed files with 482 additions and 119 deletions

View File

@@ -154,6 +154,11 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
const handleMenuSelection = useCallback(
async (menuItem: EditorMenuItem) => {
if (!menuItem.isEntitled) {
if (menuItem.uiFeature.featureIdentifier === NativeFeatureIdentifier.TYPES.SuperEditor) {
premiumModal.showSuperDemo()
return
}
premiumModal.activate(menuItem.uiFeature.displayName)
return
}
@@ -249,7 +254,7 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
<>
<Menu className="pb-1 pt-0.5" a11yLabel="Change note type menu">
<MenuSection>
<div className="flex items-center justify-between pr-4 py-3 md:pt-0 md:pb-1">
<div className="flex items-center justify-between py-3 pr-4 md:pb-1 md:pt-0">
<div className="px-3">
<h2 className="text-base font-bold">Choose a note type</h2>
{unableToFindEditor && (

View File

@@ -9,6 +9,7 @@ import {
NoteMutator,
NoteType,
SNNote,
NativeFeatureIdentifier,
} from '@standardnotes/snjs'
import { useCallback, useMemo, useState } from 'react'
import Icon from '../Icon/Icon'
@@ -60,6 +61,11 @@ const ChangeEditorMultipleMenu = ({ application, notes, setDisableClickOutside }
const handleMenuSelection = useCallback(
async (itemToBeSelected: EditorMenuItem) => {
if (!itemToBeSelected.isEntitled) {
if (itemToBeSelected.uiFeature.featureIdentifier === NativeFeatureIdentifier.TYPES.SuperEditor) {
premiumModal.showSuperDemo()
return
}
premiumModal.activate(itemToBeSelected.uiFeature.displayName)
return
}