From 5055d9104daf248bfdd8e8feceb57727f61e881a Mon Sep 17 00:00:00 2001 From: SHADOW-LIGHTS <108618163+SHADOW-LIGHTS@users.noreply.github.com> Date: Sat, 21 Sep 2024 23:20:51 +0530 Subject: [PATCH 01/16] created top-up-interface --- app/(default)/layout.tsx | 2 + app/blog/[slug]/page.tsx | 2 + app/blog/page.tsx | 2 + app/faq/page.tsx | 2 + app/layout.tsx | 2 - components/about.tsx | 2 + components/buy-credits-modal.tsx | 139 + components/dashboard.tsx | 12 +- components/dashboard/subscription-card.tsx | 4 + components/pricing.tsx | 2 + components/ui/alert-dialog.tsx | 2 +- components/ui/slider.tsx | 4 +- package-lock.json | 14401 ------------------- package.json | 5 +- yarn.lock | 2305 +-- 15 files changed, 1328 insertions(+), 15558 deletions(-) create mode 100644 components/buy-credits-modal.tsx delete mode 100644 package-lock.json diff --git a/app/(default)/layout.tsx b/app/(default)/layout.tsx index 67902dc12..7fcbcf89a 100644 --- a/app/(default)/layout.tsx +++ b/app/(default)/layout.tsx @@ -6,6 +6,7 @@ import AOS from "aos"; import "aos/dist/aos.css"; import PageIllustration from "@/components/page-illustration"; +import Footer from "@/components/footer"; export default function DefaultLayout({ children, @@ -27,6 +28,7 @@ export default function DefaultLayout({ {children} + > ); } diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx index d208b0dd0..9918429d4 100644 --- a/app/blog/[slug]/page.tsx +++ b/app/blog/[slug]/page.tsx @@ -3,6 +3,7 @@ import { format, parseISO } from "date-fns"; import Image from "next/image"; import { notFound } from "next/navigation"; import { posts } from "@/lib/blog/postData"; +import Footer from "@/components/footer"; export const generateStaticParams = async () => posts.map((post) => ({ slug: post.url.split("/").pop() })); @@ -83,6 +84,7 @@ const PostLayout = ({ params }: { params: { slug: string } }) => { dangerouslySetInnerHTML={{ __html: post.content }} /> + ))} + ); } diff --git a/app/faq/page.tsx b/app/faq/page.tsx index a57b27eab..b7a6ef5b9 100644 --- a/app/faq/page.tsx +++ b/app/faq/page.tsx @@ -8,6 +8,7 @@ import Link from "next/link"; import { constructMetadata } from "@/lib/utils"; import { Metadata } from "next/types"; import { FAQItem } from "@/types/faqItems"; +import Footer from "@/components/footer"; export const metadata: Metadata = constructMetadata({ title: "FAQ", @@ -76,6 +77,7 @@ const FAQ: React.FC = () => { + > ); }; diff --git a/app/layout.tsx b/app/layout.tsx index e23f18f07..ec21c7699 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -9,7 +9,6 @@ import dynamic from "next/dynamic"; import { Analytics } from "@vercel/analytics/react"; import { SpeedInsights } from "@vercel/speed-insights/next"; import { ThemeProvider } from "next-themes"; -import Footer from "@/components/footer"; const PostHogPageView = dynamic(() => import("./PostHogPageView"), { ssr: false, @@ -36,7 +35,6 @@ export default function RootLayout({
+ ${option.amount} +
+ ${(option.amount / option.requests).toFixed(3)}/request +
+ {option.requests} +
+ requests +
- ${option.amount} -
- ${(option.amount / option.requests).toFixed(3)}/request -
+ {option.feature} +
- {option.requests} -
- requests +
+ {option.requests} requests
+ Your PearAI Credits usage depend on your prompt + input and output sizes. +
PearAI Credits
- - {loading ? ( - "-" - ) : ( - - {usage?.percent_credit_used != null - ? `${Math.min(usage.percent_credit_used, 100)}%` - : "Cannot find used percentage. Please contact PearAI support."} - - )} - + {loading ? ( + "-" + ) : ( + + {usage?.percent_credit_used != null + ? `${Math.min(usage.percent_credit_used, 100)}%` + : "Usage info not found. Contact PearAI support"} + + )}
- Make sure PearAI is{" "} - - installed. - {" "} +
Topup Credits
Topup credits do not expire.
+ {loading + ? "-" + : `${usage.remaining_topup_credits} remaining`} +
Current Plan
+
{capitalizeInital(subscription.pricing_tier)}
- Make sure PearAI is{" "} - - installed. - {" "} - Use this button to open the app and login directly. -
Credits refill monthly
+ Top-up credit does not expire and is utilized only + after the monthly quota is reached. +
+ {loading + ? "-" + : `$${usage.remaining_topup_credits} remaining`} +
{loading ? "-" - : `${usage.remaining_topup_credits} remaining`} + : `$${usage.remaining_topup_credits} remaining`}
{loading ? "-" - : `$${usage.remaining_topup_credits} remaining`} + : `$${Math.floor(usage.remaining_topup_credits * 100) / 100} remaining`}
- {option.requests} requests + ≈ {option.requests} requests