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.

show savings + 12x usage upfront

Steven Tey82b509bd78c4
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx
index 46c6fffdc3..5cf870fdda 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page.tsx
@@ -8,6 +8,7 @@ import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
import { usePartnersUpgradeModal } from "@/ui/partners/partners-upgrade-modal";
import { UpgradePlanButton } from "@/ui/workspaces/upgrade-plan-button";
import {
+ Badge,
ChartLine,
Check,
CircleQuestion,
@@ -18,6 +19,7 @@ import {
Icon,
Plug2,
ToggleGroup,
+ useMediaQuery,
Users2,
} from "@dub/ui";
import {
@@ -121,6 +123,8 @@ export default function WorkspaceBillingUpgradePage() {
[recommendedPlan],
);
+ const { isMobile } = useMediaQuery();
+
return (
<PageContent
title={
@@ -140,12 +144,20 @@ export default function WorkspaceBillingUpgradePage() {
<ToggleGroup
options={[
{ label: "Monthly", value: "monthly" },
- { label: "Yearly (Save 17%)", value: "yearly" },
+ {
+ label: "Yearly",
+ badge: (
+ <Badge variant="blueGradient" className="py-0 text-xs">
+ {isMobile ? "10% off" : "10% discount + 12x usage upfront"}
+ </Badge>
+ ),
+ value: "yearly",
+ },
]}
selected={period}
selectAction={(option) => setPeriod(option as "monthly" | "yearly")}
className="rounded-lg border-neutral-300 bg-neutral-100 p-0.5"
- optionClassName="text-xs text-neutral-800 data-[selected=true]:text-neutral-800 px-3 sm:px-5 py-2 leading-none"
+ optionClassName="text-xs normal-case text-neutral-800 data-[selected=true]:text-neutral-800 px-3 h-8 leading-none"
indicatorClassName="bg-white border-neutral-200 rounded-md"
/>
</div>
diff --git a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
index 8028504cc9..f3f1e833b4 100644
--- a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
+++ b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
@@ -5,11 +5,10 @@ import { UpgradePlanButton } from "@/ui/workspaces/upgrade-plan-button";
import {
Badge,
Button,
- CalendarRefresh,
Check,
DubProductIcon,
PLAN_FEATURE_ICONS,
- Switch,
+ ToggleGroup,
Tooltip,
} from "@dub/ui";
import {
@@ -42,7 +41,26 @@ export function PlanSelector({ product }: { product: OnboardingProduct }) {
});
return (
- <div className="[container-type:inline-size]">
+ <div className="flex flex-col items-center gap-4 [container-type:inline-size]">
+ <ToggleGroup
+ options={[
+ { label: "Monthly", value: "monthly" },
+ {
+ label: "Yearly",
+ badge: (
+ <Badge variant="blueGradient" className="py-0 text-xs">
+ 10% discount + 12x usage upfront
+ </Badge>
+ ),
+ value: "yearly",
+ },
+ ]}
+ selected={period}
+ selectAction={(option) => setPeriod(option as "monthly" | "yearly")}
+ className="w-fit rounded-lg border-neutral-300 bg-neutral-100 p-0.5"
+ optionClassName="text-xs normal-case text-neutral-800 data-[selected=true]:text-neutral-800 px-3 h-8 leading-none"
+ indicatorClassName="bg-white border-neutral-200 rounded-md"
+ />
<div className="overflow-hidden max-lg:rounded-lg">
<div
className={cn(
@@ -113,44 +131,11 @@ export function PlanSelector({ product }: { product: OnboardingProduct }) {
<span className="text-sm text-neutral-400">
{" "}
per month
+ {period === "yearly" && ", billed yearly"}
</span>
</>
)}
</div>
- {plan.name === "Enterprise" ? (
- <div className="mt-4 flex items-center gap-1.5 text-neutral-400">
- <CalendarRefresh className="size-4 shrink-0" />
- <span className="text-sm font-medium">
- Tailored pricing terms
- </span>
- </div>
- ) : (
- <label className="mt-4 flex items-center gap-1.5">
- <Switch
- checked={period === "yearly"}
- fn={(checked) =>
- setPeriod(checked ? "yearly" : "monthly")
- }
- trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20 w-7 h-4"
- thumbDimensions="size-3"
- thumbTranslate="translate-x-3"
- />
- <div className="flex items-center gap-1 text-sm font-medium text-neutral-600">
- <span>Billed yearly</span>
- <Badge
- variant="outline"
- size="sm"
- className={cn(
- "animate-in fade-in-0 slide-in-from-right-2 duration-150",
- period === "monthly" &&
- "-translate-x-2 opacity-0",
- )}
- >
- Save 17%
- </Badge>
- </div>
- </label>
- )}
</div>
<p className="min-h-10 text-sm text-neutral-600">
diff --git a/apps/web/ui/modals/manage-usage-modal.tsx b/apps/web/ui/modals/manage-usage-modal.tsx
index a54a83c8d3..f0a357cea5 100644
--- a/apps/web/ui/modals/manage-usage-modal.tsx
+++ b/apps/web/ui/modals/manage-usage-modal.tsx
@@ -1,7 +1,14 @@
import { clientAccessCheck } from "@/lib/client-access-check";
import { isEligibleForTrial } from "@/lib/stripe/is-eligible-for-trial";
import useWorkspace from "@/lib/swr/use-workspace";
-import { CursorRays, Hyperlink, Modal, Slider, ToggleGroup } from "@dub/ui";
+import {
+ Badge,
+ CursorRays,
+ Hyperlink,
+ Modal,
+ Slider,
+ ToggleGroup,
+} from "@dub/ui";
import {
DUB_TRIAL_PERIOD_DAYS,
ENTERPRISE_PLAN,
@@ -126,7 +133,12 @@ function ManageUsageModalContent({ type }: ManageUsageModalProps) {
{ value: "monthly", label: "Monthly" },
{
value: "yearly",
- label: "Yearly (Save 17%)",
+ label: "Yearly",
+ badge: (
+ <Badge variant="blueGradient" className="py-0 text-xs">
+ 10% discount + 12x usage upfront
+ </Badge>
+ ),
},
]}
className="flex overflow-hidden rounded-lg bg-transparent p-0.5"