Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

add pricing page

Marc Seitzce1e8edc3232
diff --git a/components/settings/pricing.tsx b/components/settings/pricing.tsx
deleted file mode 100644
index a7a3e102..00000000
--- a/components/settings/pricing.tsx
+++ /dev/null
@@ -1,122 +0,0 @@
-import React from "react";
-import Link from "next/link";
-
-interface Tier {
- id: number;
- title: string;
- priceMonthly: string;
- description: string;
- features: string[];
-}
-
-const tiers: Tier[] = [
- {
- id: 1,
- title: "Free",
- priceMonthly: "$0/mo",
- description: "Enjoy free access",
- features: [
- "PDF up to 30 mb",
- "Unlimited links",
- "Analytics for each page",
- "Feedback on each page",
- "Email Notifications on views",
- ],
- },
- {
- id: 2,
- title: "Pro",
- priceMonthly: "$29/mo",
- description: "Use all freemium features+ ",
- features: [
- "Team members",
- "Custom domains",
- "Unlimited documents",
- "Large file uploads",
- "Full customization",
- ],
- },
- {
- id: 3,
- title: "Contact us",
- priceMonthly: "Custom",
- description: "Get more perfect plan for you",
- features: [
- "Priority Support",
- "Full customization",
- "Separate Hosting",
- "Custom features request",
- "Personal Onboarding",
- ],
- },
-];
-
-export default function PricingComponent() {
- return (
- <div className="min-h-screen bg-white dark:bg-gray-900 text-black dark:text-white py-20">
- <div className="container mx-auto px-4">
- <div className="mx-auto max-w-2xl text-center lg:max-w-4xl"></div>
-
- <div className="mx-auto mt-6 grid max-w-5xl grid-cols-1 gap-6 items-center sm:grid-cols-3 sm:gap-4">
- {tiers.map((tier) => (
- <div
- key={tier.id}
- className="rounded-3xl p-8 ring-1 ring-gray-900/10 dark:ring-gray-200/10 sm:p-10 bg-white dark:bg-gray-800"
- >
- <h2 className="text-xl font-bold mb-4">{tier.title}</h2>
- <div className="text-3xl font-bold mb-4">{tier.priceMonthly}</div>
- <div className="text-gray-900 dark:text-gray-400 mb-6">
- {tier.description}
- </div>
- {tier.features.map((feature) => (
- <div key={feature} className="flex items-center mb-2">
- <svg
- className="h-5 w-5 text-green-500 dark:text-green-300 mr-2"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="2"
- d="M5 13l4 4L19 7"
- ></path>
- </svg>
- {feature}
- </div>
- ))}
- <div className="mt-6 flex items-center justify-center gap-x-6">
- {tier.id === 1 && (
- <Link
- href="/login"
- className="rounded-md bg-white px-3.5 py-2.5 text-sm font-semibold text-black shadow-sm border-2 border-gray-700 hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:text-black dark:bg-white"
- >
- Start for free
- </Link>
- )}
- {tier.id === 2 && (
- <Link
- href="/login"
- className="rounded-md bg-black px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-gray-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:text-black dark:bg-white "
- >
- Start for free
- </Link>
- )}
- {tier.id === 3 && (
- <Link
- href="/login"
- className="rounded-md bg-black px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-gray-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:text-black dark:bg-white"
- >
- Contact us
- </Link>
- )}
- </div>
- </div>
- ))}
- </div>
- </div>
- </div>
- );
-}
diff --git a/pages/pricing.tsx b/pages/pricing.tsx
index e6fb4b7b..6f1f85d7 100644
--- a/pages/pricing.tsx
+++ b/pages/pricing.tsx
@@ -1,4 +1,3 @@
-// pages/pricing.js
import Footer from "@/components/web/footer";
import Navbar from "@/components/web/navbar";
import Link from "next/link";
@@ -74,22 +73,19 @@ export default function Pricing() {
</Head>
<Navbar />
- <div className="min-h-screen bg-white dark:bg-gray-900 text-black dark:text-white py-20">
+ <div className="min-h-screen bg-white text-black py-20">
<Head>
<title>Pricing Page</title>
</Head>
<div className="container mx-auto px-4">
<div className="mx-auto max-w-2xl text-center lg:max-w-4xl">
- {/* <h2 className="text-base font-semibold leading-7 text-black dark:text-white">
- Feature comparison
- </h2> */}
- <p className="mt-16 text-4xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-5xl">
- Pricing Page
+ <p className="mt-16 text-4xl font-bold tracking-tight text-gray-900 sm:text-5xl">
+ Pricing
</p>
</div>
- <p className="mx-auto mt-6 max-w-2xl text-center text-lg leading-8 text-gray-500 dark:text-gray-400">
+ <p className="mx-auto mt-6 max-w-2xl text-center text-lg leading-8 text-gray-500 ">
Share your Pitch Deck, Sales Deck and oher documents and monitor
results on any suitable for you plan. You always can start open
source
@@ -99,13 +95,13 @@ export default function Pricing() {
{tiers.map((tier) => (
<div
key={tier.id}
- className="rounded-3xl p-8 ring-1 ring-gray-900/10 dark:ring-gray-200/10 sm:p-10"
+ className="rounded-3xl p-8 ring-1 ring-gray-900/10 sm:p-10"
>
<h2 className="text-xl font-bold mb-4">{tier.title}</h2>
<div className="text-3xl font-bold mb-4">
{tier.priceMonthly}
</div>
- <div className="text-gray-900 dark:text-gray-400 mb-6">
+ <div className="text-gray-900 mb-6">
{tier.description}
</div>
{tier.features.map((feature) => (
@@ -130,7 +126,7 @@ export default function Pricing() {
<div className="mt-6 flex items-center justify-center gap-x-6">
{tier.id === 1 && (
<Link
- href="/login"
+ href="/login?next=/settings/billing"
className="rounded-md bg-white px-3.5 py-2.5 text-sm font-semibold text-black shadow-sm border-2 border-gray-700 hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
>
Start for free
diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx
index 2316b06f..ac73e3b7 100644
--- a/pages/settings/billing.tsx
+++ b/pages/settings/billing.tsx
@@ -4,11 +4,22 @@ import Navbar from "@/components/settings/navbar";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { useBilling } from "@/lib/swr/use-billing";
-import { formattedDate, getFirstAndLastDay } from "@/lib/utils";
+import { cn, formattedDate, getFirstAndLastDay } from "@/lib/utils";
import { useRouter } from "next/router";
import { useEffect, useMemo, useState } from "react";
import { toast } from "sonner";
-import Pricing from "@/components/settings/pricing";
+
+
+interface Tier {
+ id: number;
+ title: string;
+ priceMonthly: string;
+ currentPlan: boolean;
+ isTrial?: boolean;
+ description: string;
+ features: string[];
+}
+
export default function Billing() {
const router = useRouter();
@@ -28,6 +39,52 @@ export default function Billing() {
}
}, [router.query.success]);
+ const tiers: Tier[] = [
+ {
+ id: 1,
+ title: "Free",
+ priceMonthly: "$0/mo",
+ description: "Enjoy free access",
+ currentPlan: plan && plan == "free" ? true : false,
+ features: [
+ "PDF up to 30 mb",
+ "Unlimited links",
+ "Analytics for each page",
+ "Feedback on each page",
+ "Email Notifications on views",
+ ],
+ },
+ {
+ id: 2,
+ title: "Pro",
+ priceMonthly: "$29/mo",
+ description: "Use all freemium features+ ",
+ currentPlan: plan && plan == "pro" ? true : false,
+ isTrial: plan && plan == "trial" ? true : false,
+ features: [
+ "Team members",
+ "Custom domains",
+ "Unlimited documents",
+ "Large file uploads",
+ "Full customization",
+ ],
+ },
+ {
+ id: 3,
+ title: "Contact us",
+ priceMonthly: "Custom",
+ description: "Get more perfect plan for you",
+ currentPlan: false,
+ features: [
+ "Priority Support",
+ "Full customization",
+ "Separate Hosting",
+ "Custom features request",
+ "Personal Onboarding",
+ ],
+ },
+ ];
+
return (
<AppLayout>
<Navbar current="Billing" />
@@ -43,9 +100,125 @@ export default function Billing() {
</p>
</div>
</div>
- <Pricing />
<div>
+ <div className="grid grid-cols-1 gap-6 items-center sm:grid-cols-3 sm:gap-4">
+ {tiers.map((tier) => (
+ <div
+ key={tier.id}
+ className={cn(
+ `rounded-3xl p-8 sm:p-10 bg-white dark:bg-gray-800`,
+ tier.currentPlan || tier.isTrial
+ ? "ring-2 ring-primary"
+ : "ring-1 ring-gray-900/10 dark:ring-gray-200/10"
+ )}
+ >
+ <h2 className="text-xl font-bold mb-4 inline-flex items-center gap-x-2">
+ {tier.title}{" "}
+ {tier.currentPlan ? (
+ <Badge className="rounded-none">Current Plan</Badge>
+ ) : null}
+ {tier.isTrial ? (
+ <Badge className="rounded-none">Trial</Badge>
+ ) : null}
+ </h2>
+ <div className="text-3xl font-bold mb-4">
+ {tier.priceMonthly}
+ </div>
+ <div className="text-gray-900 dark:text-gray-400 mb-6">
+ {tier.description}
+ </div>
+ {tier.features.map((feature) => (
+ <div key={feature} className="flex items-center mb-2">
+ <svg
+ className="h-5 w-5 text-green-500 dark:text-green-300 mr-2"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ d="M5 13l4 4L19 7"
+ ></path>
+ </svg>
+ {feature}
+ </div>
+ ))}
+ <div className="mt-6 flex items-center justify-center gap-x-6">
+ {tier.id === 1 &&
+ (plan ? (
+ tier.currentPlan ? (
+ <UpgradePlanModal>
+ <Button type="button">
+ Upgrade to Pro
+ </Button>
+ </UpgradePlanModal>
+ ) : (
+ <Button
+ type="button"
+ variant="ghost"
+ className="border border-gray-700"
+ disabled
+ >
+ Change plan
+ </Button>
+ )
+ ) : (
+ <div className="h-10 w-24 animate-pulse rounded-md bg-border" />
+ ))}
+ {tier.id === 2 &&
+ (plan ? (
+ tier.currentPlan ? (
+ <Button
+ onClick={() => {
+ setClicked(true);
+ fetch(`/api/billing/manage`, {
+ method: "POST",
+ })
+ .then(async (res) => {
+ const url = await res.json();
+ router.push(url);
+ })
+ .catch((err) => {
+ alert(err);
+ setClicked(false);
+ });
+ }}
+ loading={clicked}
+ >
+ Manage Subscription
+ </Button>
+ ) : (
+ <UpgradePlanModal>
+ <Button type="button">
+ {tier.isTrial
+ ? "Upgrade to remain on Pro"
+ : "Upgrade to Pro"}
+ </Button>
+ </UpgradePlanModal>
+ )
+ ) : (
+ <div className="h-10 w-24 animate-pulse rounded-md bg-border" />
+ ))}
+ {tier.id === 3 && (
+ <Button
+ type="button"
+ variant="ghost"
+ className="border border-gray-700"
+ >
+ Contact us
+ </Button>
+ )}
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* <div>
<div className="rounded-lg border border-border bg-secondary">
<div className="flex flex-col space-y-3 p-10">
<h2 className="text-xl font-medium">Plan &amp; Usage</h2>
@@ -73,7 +246,7 @@ export default function Billing() {
</div>
<div className="border-b border-gray-200 dark:border-gray-700" />
<div className="grid grid-cols-1 divide-y divide-gray-200 dark:divide-gray-700 sm:grid-cols-2 sm:divide-x sm:divide-y-0">
- {/* <div className="p-10">
+ <div className="p-10">
<div className="flex items-center space-x-2">
<h3 className="font-medium">Total Documents</h3>
</div>
@@ -123,8 +296,8 @@ export default function Billing() {
</div>
</div>
)}
- </div> */}
- {/* <div className="p-10">
+ </div>
+ <div className="p-10">
<div className="flex items-center space-x-2">
<h3 className="font-medium">Number of Links</h3>
<InfoTooltip content="Number of short links in your project." />
@@ -142,7 +315,7 @@ export default function Billing() {
<Divider className="h-8 w-8 text-gray-500" />
<Infinity className="h-8 w-8 text-gray-500" />
</div>
- </div> */}
+ </div>
</div>
<div className="border-b border-gray-200 dark:border-gray-700" />
@@ -189,7 +362,7 @@ export default function Billing() {
</div>
</div>
</div>
- </div>
+ </div> */}
</div>
</AppLayout>
);
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index dec5c34f..22054389 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -1,7 +1,6 @@
datasource db {
provider = "postgresql"
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
- // url = env("POSTGRES_PRISMA_URL_NON_POOLING") // uses a direct connection
directUrl = env("POSTGRES_PRISMA_URL_NON_POOLING") // uses a direct connection
shadowDatabaseUrl = env("POSTGRES_PRISMA_SHADOW_URL") // used for migrations
}