Skip to content

Commit

Permalink
updated pricing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutlope committed Mar 23, 2023
1 parent 3ad7baa commit f64af79
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
28 changes: 19 additions & 9 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import Image from "next/image";
import Link from "next/link";

export default function Header({ photo }: { photo?: string }) {
export default function Header({
photo,
email,
}: {
photo?: string;
email?: string;
}) {
return (
<header className="flex flex-col xs:flex-row justify-between items-center w-full mt-3 border-b pb-7 sm:px-4 px-2 border-gray-500 gap-2">
<Link href="/dream" className="flex space-x-2">
Expand All @@ -16,7 +22,7 @@ export default function Header({ photo }: { photo?: string }) {
roomGPT.io
</h1>
</Link>
{photo ? (
{email ? (
<div className="flex items-center space-x-4">
<Link
href="/dashboard"
Expand All @@ -33,13 +39,17 @@ export default function Header({ photo }: { photo?: string }) {
New
</div>
</Link>
<Image
alt="Profile picture"
src={photo}
className="w-10 rounded-full"
width={32}
height={28}
/>
{photo ? (
<Image
alt="Profile picture"
src={photo}
className="w-10 rounded-full"
width={32}
height={28}
/>
) : (
<div className="w-10 h-10 rounded-full bg-white" />
)}
</div>
) : (
<Link
Expand Down
10 changes: 7 additions & 3 deletions pages/api/stripe-webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,21 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => {

// @ts-ignore
switch (paymentIntent.amount_subtotal) {
case 500:
case 1000:
creditAmount = 20;
break;
case 1900:
case 3000:
creditAmount = 80;
creditAmount = 100;
break;
case 3500:
case 5000:
creditAmount = 160;
creditAmount = 250;
break;
case 7000:
case 10000:
creditAmount = 400;
creditAmount = 750;
break;
}
await prisma.user.update({
Expand Down
7 changes: 1 addition & 6 deletions pages/buy-credits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ export default function Pricing() {
const { data } = useSWR("/api/remaining", fetcher);

return (
<div className="flex mx-auto max-w-6xl overflow-visible flex-col items-center justify-center py-2 min-h-screen">
<div className="flex mx-auto max-w-7xl overflow-visible flex-col items-center justify-center py-2 min-h-screen">
<Head>
<title>RoomGPT Pricing</title>
</Head>
<Script src="https://js.stripe.com/v3/pricing-table.js" />
<Header photo={session?.user?.image || undefined} />
<main className="flex flex-1 w-full flex-col items-center justify-center text-center px-4 mt-12 sm:mb-0 mb-8">
<div className="border border-gray-700 rounded-2xl py-2 px-4 text-gray-400 text-sm my-6 duration-300 ease-in-out hover:text-gray-300 transition">
Use coupon{" "}
<span className="font-semibold text-gray-200">ROOMGPT50</span> for
half off the prices below - only for this week!
</div>
<div className="mx-auto max-w-7xl px-6 lg:px-8">
<div className="mx-auto max-w-4xl text-center">
<p className="mt-2 text-4xl font-bold tracking-tight text-white sm:text-5xl">
Expand Down
13 changes: 9 additions & 4 deletions pages/dream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,21 @@ const Home: NextPage = () => {
<Head>
<title>RoomGPT</title>
</Head>
<Header photo={session?.user?.image || undefined} />
<Header
photo={session?.user?.image || undefined}
email={session?.user?.email || undefined}
/>
<main className="flex flex-1 w-full flex-col items-center justify-center text-center px-4 mt-4 sm:mb-0 mb-8">
{status === "authenticated" ? (
<Link
href="/buy-credits"
className="border border-gray-700 rounded-2xl py-2 px-4 text-gray-400 text-sm my-6 duration-300 ease-in-out hover:text-gray-300 transition"
>
Use coupon{" "}
<span className="font-semibold text-gray-200">ROOMGPT50</span> for
50% off credits - only for this week!
<span className="font-semibold text-gray-200">
Pricing is now available.
</span>{" "}
Click <span className="font-semibold text-gray-200">here</span> to
buy credits, discounted only for this week!
</Link>
) : (
<a
Expand Down

1 comment on commit f64af79

@vercel
Copy link

@vercel vercel bot commented on f64af79 Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.