Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: show checkout page instead of dialog from plans page

Abdullah Atta571f3242e258
diff --git a/apps/web/src/navigation/index.ts b/apps/web/src/navigation/index.ts
index db7995901..f8d4377ee 100644
--- a/apps/web/src/navigation/index.ts
+++ b/apps/web/src/navigation/index.ts
@@ -116,8 +116,8 @@ export function extendHomeRoute(route: string) {
return `${getHomeRoute()}${route}`;
}
-export function hardNavigate(route: string) {
- window.open(makeURL(route, getCurrentHash()), "_self");
+export function hardNavigate(route: string, search?: string) {
+ window.open(makeURL(route, getCurrentHash(), search), "_self");
}
export function makeURL(route: string, hash?: string, search?: string) {
diff --git a/apps/web/src/views/plans.tsx b/apps/web/src/views/plans.tsx
index 470a13148..5f66cf766 100644
--- a/apps/web/src/views/plans.tsx
+++ b/apps/web/src/views/plans.tsx
@@ -25,8 +25,6 @@ import {
} from "../dialogs/buy-dialog/plan-list";
import { FlexScrollContainer } from "../components/scroll-container";
import { Button, Flex, Text } from "@theme-ui/components";
-import { useCheckoutStore } from "../dialogs/buy-dialog/store";
-import { BuyDialog } from "../dialogs/buy-dialog";
import { useStore as useUserStore } from "../stores/user-store";
import { useEffect } from "react";
import { getQueryParams, hardNavigate } from "../navigation";
@@ -34,7 +32,6 @@ import { Close } from "../components/icons";
import { isUserSubscribed } from "../hooks/use-is-user-premium";
function Plans() {
- const selectPlan = useCheckoutStore((state) => state.selectPlan);
const user = useUserStore((store) => store.user);
useEffect(() => {
@@ -101,14 +98,10 @@ function Plans() {
</Flex>
<PlansList
onPlanSelected={(plan) => {
- selectPlan(plan);
- BuyDialog.show({
- onShowPlans: () => BuyDialog.close(),
- onCheckoutComplete: () => {
- BuyDialog.close();
- openURL("/");
- }
- }).catch(console.error);
+ const url = new URLSearchParams({
+ plan: Buffer.from(JSON.stringify(plan)).toString("base64")
+ });
+ hardNavigate(`/checkout`, url.toString());
}}
selectedPlan={SubscriptionPlan.FREE}
/>