Skip to content

Commit 8f74c85

Browse files
committed
Link to team billing page in faucet button on free plan (#8429)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR adds a new condition to the `FaucetButton` component to handle cases where a paid plan is required to access the faucet. It provides a user-friendly message and a link to upgrade their plan. ### Detailed summary - Added a check for `canClaimFaucetQuery.data.type` being `"paid-plan-required"`. - Rendered a button linking to the billing page with a message about upgrading the plan. - Removed a TODO comment regarding upselling plans. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enhanced faucet button experience for premium plan scenarios. The button now provides a direct link to manage billing and subscription options when a plan upgrade is required, replacing the previous notification message with a more actionable interface. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 73c924b commit 8f74c85

File tree

1 file changed

+15
-4
lines changed
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client

1 file changed

+15
-4
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
33
import { Turnstile } from "@marsidev/react-turnstile";
44
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
55
import type { CanClaimResponseType } from "app/(app)/api/testnet-faucet/can-claim/CanClaimResponseType";
6+
import { ArrowUpRightIcon } from "lucide-react";
67
import Link from "next/link";
78
import { usePathname } from "next/navigation";
89
import { useForm } from "react-hook-form";
@@ -192,6 +193,20 @@ export function FaucetButton({
192193

193194
// Can not claim
194195
if (canClaimFaucetQuery.data && canClaimFaucetQuery.data.canClaim === false) {
196+
if (canClaimFaucetQuery.data.type === "paid-plan-required") {
197+
return (
198+
<Button
199+
asChild
200+
className="w-full gap-2 whitespace-pre-wrap h-auto min-h-10 text-center bg-background"
201+
variant="outline"
202+
>
203+
<Link href="/team/~/~/billing">
204+
Faucet is not available on Free plan. Upgrade your plan to continue
205+
<ArrowUpRightIcon className="size-4 shrink-0 text-muted-foreground" />
206+
</Link>
207+
</Button>
208+
);
209+
}
195210
return (
196211
<Button className="!opacity-100 w-full " disabled variant="outline">
197212
{canClaimFaucetQuery.data.type === "throttle" && (
@@ -203,10 +218,6 @@ export function FaucetButton({
203218

204219
{canClaimFaucetQuery.data.type === "unsupported-chain" &&
205220
"Faucet is empty right now"}
206-
207-
{/* TODO: add an upsell path here to subscribe to one of these plans */}
208-
{canClaimFaucetQuery.data.type === "paid-plan-required" &&
209-
"Faucet is only available on Starter, Growth, Scale and Pro plans."}
210221
</Button>
211222
);
212223
}

0 commit comments

Comments
 (0)