mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: show upgrade dialog from toast
This commit is contained in:
@@ -17,18 +17,21 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { FeatureId, FeatureResult } from "@notesnook/common";
|
||||
import { FeatureResult } from "@notesnook/common";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { BuyDialog } from "../dialogs/buy-dialog";
|
||||
import { UpgradeDialog } from "../dialogs/buy-dialog/upgrade-dialog";
|
||||
|
||||
export function showFeatureNotAllowedToast<TId extends FeatureId>(
|
||||
result: FeatureResult<TId> | undefined
|
||||
export function showFeatureNotAllowedToast(
|
||||
result: FeatureResult<any> | undefined
|
||||
) {
|
||||
if (!result) return;
|
||||
showToast("error", result.error, [
|
||||
{
|
||||
text: "Upgrade",
|
||||
onClick: () => BuyDialog.show({ plan: result.availableOn })
|
||||
onClick: () =>
|
||||
UpgradeDialog.show({
|
||||
feature: result
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user