Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update rewards-upgrade-modal.tsx

Tim Wilsond74812b9ba71
diff --git a/apps/web/ui/partners/rewards/rewards-upgrade-modal.tsx b/apps/web/ui/partners/rewards/rewards-upgrade-modal.tsx
index 6ef8b3c5a4..1b53ae4564 100644
--- a/apps/web/ui/partners/rewards/rewards-upgrade-modal.tsx
+++ b/apps/web/ui/partners/rewards/rewards-upgrade-modal.tsx
@@ -1,5 +1,16 @@
-import { Grid, Modal } from "@dub/ui";
-import { Dispatch, SetStateAction, useState } from "react";
+import { UpgradePlanButton } from "@/ui/workspaces/upgrade-plan-button";
+import {
+ Button,
+ Check,
+ Grid,
+ Modal,
+ SimpleTooltipContent,
+ Switch,
+ Tooltip,
+} from "@dub/ui";
+import { cn, nFormatter, PLANS } from "@dub/utils";
+import NumberFlow from "@number-flow/react";
+import { Dispatch, SetStateAction, useMemo, useState } from "react";
export function RewardsUpgradeModal({
showRewardsUpgradeModal,
@@ -8,13 +19,71 @@ export function RewardsUpgradeModal({
showRewardsUpgradeModal: boolean;
setShowRewardsUpgradeModal: Dispatch<SetStateAction<boolean>>;
}) {
+ const plan = PLANS.find(({ name }) => name === "Advanced")!;
+
+ const [isAnnual, setIsAnnual] = useState(true);
+
+ const features = useMemo(
+ () => [
+ {
+ id: "payouts",
+ text: `$${nFormatter(plan.limits.payouts / 100)} partner payouts/mo`,
+ tooltip: {
+ title:
+ "Send payouts to your partners with 1-click (or automate it completely) – all across the world.",
+ cta: "Learn more.",
+ href: "https://dub.co/help/article/partner-payouts",
+ },
+ },
+ {
+ id: "flexiblerewards",
+ text: "Advanced reward structures",
+ tooltip: {
+ title:
+ "Create dynamic click, lead, or sale-based rewards with country and product-specific modifiers.",
+ cta: "Learn more.",
+ href: "https://dub.co/help/article/partner-rewards",
+ },
+ },
+ {
+ id: "whitelabel",
+ text: "White-labeling support",
+ tooltip: {
+ title:
+ "Embed a white-labeled referral dashboard directly in your app in just a few lines of code.",
+ cta: "Learn more.",
+ href: "https://dub.co/docs/partners/white-labeling",
+ },
+ },
+ {
+ id: "email",
+ text: "Email campaigns (beta)",
+ },
+ {
+ id: "api",
+ text: "Partners API",
+ tooltip: {
+ title:
+ "Leverage our partners API to build a bespoke, white-labeled referral program that lives within your app.",
+ cta: "Learn more.",
+ href: "https://dub.co/docs/api-reference/endpoint/create-a-partner",
+ },
+ },
+ {
+ id: "slack",
+ text: "Priority Slack support",
+ },
+ ],
+ [plan],
+ );
+
return (
<Modal
showModal={showRewardsUpgradeModal}
setShowModal={setShowRewardsUpgradeModal}
>
- <div className="relative p-8">
- <div className="absolute inset-y-0 left-1/2 w-[640px] -translate-x-1/2 [mask-image:linear-gradient(black,transparent)]">
+ <div className="scrollbar-hide relative max-h-[calc(100dvh-50px)] overflow-y-auto p-4 sm:p-8">
+ <div className="pointer-events-none absolute inset-y-0 left-1/2 hidden w-[640px] -translate-x-1/2 [mask-image:linear-gradient(black,transparent_280px)] sm:block">
<Grid cellSize={35} patternOffset={[-29, -10]} />
</div>
@@ -25,12 +94,83 @@ export function RewardsUpgradeModal({
<h2 className="text-content-emphasis text-lg font-semibold">
Get even more from your partner program
</h2>
- <p className="text-content-default text-sm">
+ <p className="text-content-subtle text-sm">
When you upgrade to Advanced, you&rsquo;ll get access higher payout
limits, flexible reward logic, white-labeling support, and much
more.
</p>
</div>
+
+ <div className="border-default relative mt-6 flex flex-col rounded-xl border bg-white p-6">
+ <div className="flex items-center justify-between">
+ <span className="text-content-emphasis text-xl font-semibold">
+ {plan.name}
+ </span>
+ <label className="flex items-center gap-1.5">
+ <span
+ className={cn(
+ "text-xs font-semibold text-neutral-500 transition-colors",
+ isAnnual && "text-neutral-600",
+ )}
+ >
+ Yearly
+ </span>
+ <Switch
+ checked={isAnnual}
+ fn={setIsAnnual}
+ trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20 w-7 h-4"
+ thumbDimensions="size-3"
+ thumbTranslate="translate-x-3"
+ />
+ </label>
+ </div>
+
+ <NumberFlow
+ value={plan.price[isAnnual ? "yearly" : "monthly"]!}
+ className="text-content-default mt-0.5 text-base font-medium tabular-nums"
+ format={{
+ style: "currency",
+ currency: "USD",
+ minimumFractionDigits: 0,
+ }}
+ continuous
+ />
+ <span className="text-content-muted text-sm font-medium">
+ per month{isAnnual && ", billed yearly"}
+ </span>
+
+ <div className="mt-6 flex flex-col gap-2 text-sm">
+ {features.map(({ id, text, tooltip }) => (
+ <li key={id} className="flex items-center gap-2 text-neutral-600">
+ <Check className="size-2.5 shrink-0 [&_*]:stroke-2" />
+ {tooltip ? (
+ <Tooltip content={<SimpleTooltipContent {...tooltip} />}>
+ <span className="cursor-help underline decoration-dotted underline-offset-2">
+ {text}
+ </span>
+ </Tooltip>
+ ) : (
+ <p>{text}</p>
+ )}
+ </li>
+ ))}
+ </div>
+ </div>
+
+ <div className="relative mt-6 flex flex-col gap-3">
+ <UpgradePlanButton
+ plan={plan.name.toLowerCase()}
+ period={isAnnual ? "yearly" : "monthly"}
+ text={`Continue with ${plan.name}`}
+ variant="primary"
+ className=""
+ />
+ <Button
+ text="Maybe later"
+ variant="secondary"
+ onClick={() => setShowRewardsUpgradeModal(false)}
+ />
+ </div>
</div>
</Modal>
);