-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
548 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
import { DottedSeparator } from "@/components/dotted-separator"; | ||
import { Info } from "@/components/info"; | ||
import { Pricing } from "@/components/pricing"; | ||
|
||
export default function Page() { | ||
return <div>Pricing</div>; | ||
return ( | ||
<div className="space-y-12 max-w-screen-lg mx-auto"> | ||
<Pricing /> | ||
<DottedSeparator /> | ||
<Info /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export function DottedSeparator() { | ||
return <div className="bg-dotted h-[60px] w-full" />; | ||
return <div className="bg-dotted h-[45px] w-full" />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Slider } from "@/components/ui/slider"; | ||
import NumberFlow from "@number-flow/react"; | ||
|
||
export function PricingSlider({ | ||
value, | ||
setValue, | ||
}: { value: number[]; setValue: (value: number[]) => void }) { | ||
const getKeysForPrice = (price: number) => { | ||
if (price <= 49) return 2000; | ||
|
||
const tiers = Math.floor((price - 49) / 49); | ||
|
||
if (getKeysForPrice(49 + (tiers - 1) * 49) <= 50000) { | ||
return 2000 + tiers * 4000; | ||
} | ||
|
||
const tiersTo50k = 12; | ||
const remainingTiers = tiers - tiersTo50k; | ||
return 50000 + remainingTiers * 8000; | ||
}; | ||
|
||
const getMaxPrice = () => { | ||
let price = 49; | ||
while (getKeysForPrice(price) < 250000) { | ||
price += 49; | ||
} | ||
return price; | ||
}; | ||
|
||
const maxPrice = getMaxPrice(); | ||
|
||
return ( | ||
<div className="mt-8"> | ||
<div className="relative mb-6"> | ||
<div | ||
className="absolute -top-12 left-0 transform -translate-x-1/2 bg-background font-medium text-primary text-[11px] px-3 py-1 rounded-full border border-border text-center whitespace-nowrap" | ||
style={{ left: `${(value[0] / maxPrice) * 100}%` }} | ||
> | ||
{Math.floor(getKeysForPrice(value[0]) / 1000)}k keys | ||
</div> | ||
<Slider | ||
value={value} | ||
onValueChange={(newValue) => | ||
setValue(newValue.map((v) => Math.max(49, v))) | ||
} | ||
step={49} | ||
min={0} | ||
max={maxPrice} | ||
/> | ||
</div> | ||
<NumberFlow | ||
value={value[0]} | ||
defaultValue={49} | ||
className="font-mono text-2xl" | ||
locales="en-US" | ||
format={{ | ||
style: "currency", | ||
currency: "USD", | ||
trailingZeroDisplay: "stripIfInteger", | ||
}} | ||
suffix="/mon" | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
"use client"; | ||
|
||
import { useI18n } from "@/locales/client"; | ||
import Link from "next/link"; | ||
import { useState } from "react"; | ||
import { MdCheck } from "react-icons/md"; | ||
import { PricingSlider } from "./pricing-slider"; | ||
import { OutlinedButton } from "./ui/outlined-button"; | ||
|
||
export function Pricing() { | ||
const t = useI18n(); | ||
const [value, setValue] = useState([49]); | ||
|
||
return ( | ||
<div className="space-y-12 pt-12 md:pt-28"> | ||
<h1 className="text-3xl">{t("pricing.title")}</h1> | ||
<div className="border border-primary"> | ||
<div className="grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-primary"> | ||
<div className="p-12 relative"> | ||
<div className="absolute -top-4 left-6 bg-background px-4 py-1"> | ||
<h3 className="text-sm font-medium uppercase"> | ||
{t("pricing.free.title")} | ||
</h3> | ||
</div> | ||
<ul className="space-y-2"> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.free.features.unlimited_projects")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.free.features.fine_tuning")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.free.features.overrides")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.free.features.analytics")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.free.features.context_memory")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.free.features.community_support")}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div className="p-12 relative"> | ||
<div className="absolute -top-4 left-6 bg-background px-4 py-1"> | ||
<h3 className="text-sm font-medium uppercase"> | ||
{t("pricing.pro.title")} | ||
</h3> | ||
</div> | ||
<ul className="space-y-2"> | ||
<li className="flex items-center gap-2 text-sm text-secondary mb-4"> | ||
<span>{t("pricing.pro.includes_free")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.pro.features.github_action")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.pro.features.latest_features")}</span> | ||
</li> | ||
<li className="flex items-center gap-2 text-sm text-secondary"> | ||
<MdCheck className="w-4 h-4 text-primary" /> | ||
<span>{t("pricing.pro.features.priority_support")}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div className="grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-primary border-t border-primary"> | ||
<div className="p-12 pt-20"> | ||
<span className="text-sm text-secondary"> | ||
{t("pricing.free.keys_limit")} | ||
</span> | ||
<h3 className="text-xl font-medium mb-6 mt-2"> | ||
{t("pricing.free.price")} | ||
</h3> | ||
|
||
<div className="mt-4"> | ||
<Link href="/login?plan=free"> | ||
<OutlinedButton variant="secondary"> | ||
{t("pricing.cta")} | ||
</OutlinedButton> | ||
</Link> | ||
</div> | ||
</div> | ||
|
||
<div className="p-12 pt-12"> | ||
<PricingSlider value={value} setValue={setValue} /> | ||
|
||
<div className="mt-4"> | ||
<Link href={`/login?plan=pro&tier=${value[0]}`}> | ||
<OutlinedButton>{t("pricing.cta")}</OutlinedButton> | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use client"; | ||
|
||
import * as SliderPrimitive from "@radix-ui/react-slider"; | ||
import * as React from "react"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
const Slider = React.forwardRef< | ||
React.ElementRef<typeof SliderPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> | ||
>(({ className, ...props }, ref) => ( | ||
<SliderPrimitive.Root | ||
ref={ref} | ||
className={cn( | ||
"relative flex w-full touch-none select-none items-center", | ||
className, | ||
)} | ||
{...props} | ||
> | ||
<SliderPrimitive.Track className="relative h-2 w-full grow bg-secondary"> | ||
<SliderPrimitive.Range className="absolute h-full bg-primary" /> | ||
</SliderPrimitive.Track> | ||
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50" /> | ||
</SliderPrimitive.Root> | ||
)); | ||
Slider.displayName = SliderPrimitive.Root.displayName; | ||
|
||
export { Slider }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.