do not allow video uploads on free tier
This commit is contained in:
parent
3d7fb0f449
commit
96498270e2
2 changed files with 8 additions and 5 deletions
|
|
@ -8,8 +8,10 @@ import { useRouter } from "next/router";
|
||||||
import { CheckIcon } from "@heroicons/react/20/solid";
|
import { CheckIcon } from "@heroicons/react/20/solid";
|
||||||
import Tooltip from "~/components/Tooltip";
|
import Tooltip from "~/components/Tooltip";
|
||||||
import { usePostHog } from "posthog-js/react";
|
import { usePostHog } from "posthog-js/react";
|
||||||
|
import recordVideoModalOpen from "~/atoms/recordVideoModalOpen";
|
||||||
|
|
||||||
export default function Paywall() {
|
export default function Paywall() {
|
||||||
|
const [recordModalOpen] = useAtom(recordVideoModalOpen);
|
||||||
const { mutateAsync: createCheckoutSession } =
|
const { mutateAsync: createCheckoutSession } =
|
||||||
api.stripe.createCheckoutSession.useMutation();
|
api.stripe.createCheckoutSession.useMutation();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -26,8 +28,12 @@ export default function Paywall() {
|
||||||
const handleCheckout = async () => {
|
const handleCheckout = async () => {
|
||||||
const { checkoutUrl } = await createCheckoutSession({ billedAnnually });
|
const { checkoutUrl } = await createCheckoutSession({ billedAnnually });
|
||||||
if (checkoutUrl) {
|
if (checkoutUrl) {
|
||||||
|
if (recordModalOpen) {
|
||||||
|
window.open(checkoutUrl, "_blank", "noreferrer,width=500,height=500");
|
||||||
|
} else {
|
||||||
void router.push(checkoutUrl);
|
void router.push(checkoutUrl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleBillingCycle = () => {
|
const toggleBillingCycle = () => {
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,7 @@ export const videoRouter = createTRPCRouter({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (session.user.stripeSubscriptionStatus !== "active") {
|
||||||
videos.length >= 10 &&
|
|
||||||
session.user.stripeSubscriptionStatus !== "active"
|
|
||||||
) {
|
|
||||||
posthog?.capture({
|
posthog?.capture({
|
||||||
distinctId: session.user.id,
|
distinctId: session.user.id,
|
||||||
event: "hit video upload limit",
|
event: "hit video upload limit",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue