feat: allow plan adjustment via hash

This commit is contained in:
thecodrr
2021-06-28 20:44:58 +05:00
parent f2cd73c87a
commit dc9935eefa
3 changed files with 7 additions and 3 deletions

View File

@@ -90,9 +90,10 @@ export function showAddNotebookDialog() {
));
}
export function showBuyDialog(couponCode) {
export function showBuyDialog(plan, couponCode) {
return showDialog((Dialogs, perform) => (
<Dialogs.BuyDialog
plan={plan}
couponCode={couponCode}
onCancel={() => perform(false)}
/>

View File

@@ -114,7 +114,7 @@ function BuyDialog(props) {
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState();
const [prices, setPrices] = useState();
const [plan, setPlan] = useState("monthly");
const [plan, setPlan] = useState(props.plan || "monthly");
const isLoggedIn = useUserStore((store) => store.isLoggedIn);
const user = useUserStore((store) => store.user);

View File

@@ -111,7 +111,10 @@ const hashroutes = {
showBuyDialog();
},
"/buy/:code": ({ code }) => {
showBuyDialog(code);
showBuyDialog("monthly", code);
},
"/buy/:plan/:code": ({ plan, code }) => {
showBuyDialog(plan, code);
},
};