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.

default to monthly

Steven Tey28484883779b
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page-client.tsx
index 60ce06b91d..722ac69abf 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/upgrade/page-client.tsx
@@ -42,7 +42,7 @@ export function WorkspaceBillingUpgradePageClient() {
const { slug, plan: currentPlan, stripeId, payoutsLimit } = useWorkspace();
const [mobilePlanIndex, setMobilePlanIndex] = useState(0);
- const [period, setPeriod] = useState<"monthly" | "yearly">("yearly");
+ const [period, setPeriod] = useState<"monthly" | "yearly">("monthly");
return (
<div>
@@ -63,10 +63,10 @@ export function WorkspaceBillingUpgradePageClient() {
<ToggleGroup
options={[
{ label: "Monthly", value: "monthly" },
- { label: "Yearly", value: "yearly" },
+ { label: "Yearly (2 months free)", value: "yearly" },
]}
selected={period}
- selectAction={(option) => setPeriod(option as "monthly" | "yearly")}
+ selectAction={(option) => setPeriod(option as "monthly" | "monthly")}
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"
indicatorClassName="bg-white border-neutral-200 rounded-md"
@@ -123,30 +123,29 @@ export function WorkspaceBillingUpgradePageClient() {
<h3 className="py-1 text-base font-semibold leading-none text-neutral-800">
{plan.name}
</h3>
- <div>
- <div className="relative mt-0.5 flex items-center gap-1">
- {plan.name === "Enterprise" ? (
- <span className="text-sm font-medium text-neutral-900">
- Custom
+ <div className="relative mt-0.5 flex items-center gap-1">
+ {plan.name === "Enterprise" ? (
+ <span className="text-sm font-medium text-neutral-900">
+ Custom
+ </span>
+ ) : (
+ <>
+ <NumberFlow
+ value={plan.price[period]!}
+ className="text-sm font-medium tabular-nums text-neutral-700"
+ format={{
+ style: "currency",
+ currency: "USD",
+ minimumFractionDigits: 0,
+ }}
+ continuous
+ />
+ <span className="text-sm font-medium text-neutral-400">
+ per month
+ {period === "yearly" && ", billed yearly"}
</span>
- ) : (
- <>
- <NumberFlow
- value={plan.price[period]!}
- className="text-sm font-medium tabular-nums text-neutral-700"
- format={{
- style: "currency",
- currency: "USD",
- minimumFractionDigits: 0,
- }}
- continuous
- />
- <span className="text-sm font-medium text-neutral-400">
- per month
- </span>
- </>
- )}
- </div>
+ </>
+ )}
</div>
</div>
<div className="flex gap-3">
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 314e1546d3..fb959112a1 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
@@ -12,7 +12,7 @@ import { CSSProperties, useState } from "react";
export const PLAN_SELECTOR_PLANS = [PRO_PLAN, BUSINESS_PLAN, ADVANCED_PLAN];
export function PlanSelector() {
- const [period, setPeriod] = useState<"monthly" | "yearly">("yearly");
+ const [period, setPeriod] = useState<"monthly" | "yearly">("monthly");
const [mobilePlanIndex, setMobilePlanIndex] = useState(0);
const searchParams = useSearchParams();
diff --git a/apps/web/ui/partners/partners-upgrade-modal.tsx b/apps/web/ui/partners/partners-upgrade-modal.tsx
index e9c6fe3708..79411baded 100644
--- a/apps/web/ui/partners/partners-upgrade-modal.tsx
+++ b/apps/web/ui/partners/partners-upgrade-modal.tsx
@@ -35,7 +35,7 @@ export function PartnersUpgradeModal({
}: PartnersUpgradeModalProps) {
const plan = PLANS.find(({ name }) => name === planName)!;
- const [isAnnual, setIsAnnual] = useState(true);
+ const [period, setPeriod] = useState<"monthly" | "yearly">("monthly");
const features = useMemo(
() => [
@@ -77,6 +77,12 @@ export function PartnersUpgradeModal({
{
id: "groups",
text: `${plan.limits.groups} partner groups`,
+ tooltip: {
+ title:
+ "Learn how you can create partner groups to segment partners by rewards, discounts, performance, location, and more.",
+ cta: "Learn more.",
+ href: "https://dub.co/help/article/partner-groups",
+ },
},
{
id: "api",
@@ -158,14 +164,16 @@ export function PartnersUpgradeModal({
<span
className={cn(
"text-xs font-semibold text-neutral-500 transition-colors",
- isAnnual && "text-neutral-600",
+ period === "yearly" && "text-neutral-600",
)}
>
Yearly
</span>
<Switch
- checked={isAnnual}
- fn={setIsAnnual}
+ checked={period === "yearly"}
+ fn={() =>
+ setPeriod(period === "yearly" ? "monthly" : "yearly")
+ }
trackDimensions="radix-state-checked:bg-black focus-visible:ring-black/20 w-7 h-4"
thumbDimensions="size-3"
thumbTranslate="translate-x-3"
@@ -177,7 +185,7 @@ export function PartnersUpgradeModal({
<div className="text-content-default mt-0.5 text-base font-medium tabular-nums">
{plan.name !== "Enterprise" ? (
<NumberFlow
- value={plan.price[isAnnual ? "yearly" : "monthly"]!}
+ value={plan.price[period]!}
format={{
style: "currency",
currency: "USD",
@@ -191,7 +199,7 @@ export function PartnersUpgradeModal({
</div>
{plan.name !== "Enterprise" && (
<span className="text-content-muted text-sm font-medium">
- per month{isAnnual && ", billed yearly"}
+ per month{period === "yearly" && ", billed yearly"}
</span>
)}
@@ -217,7 +225,7 @@ export function PartnersUpgradeModal({
{plan.name !== "Enterprise" ? (
<UpgradePlanButton
plan={plan.name.toLowerCase()}
- period={isAnnual ? "yearly" : "monthly"}
+ period={period}
text={`Continue with ${plan.name}`}
variant="primary"
/>