Skip to content

Commit 0412fe3

Browse files
committed
Enable plus button to redirect to subscription page when out of tokens
- Update PledgeBar plus button to redirect to /settings/subscription when user is out of tokens instead of being disabled - Update TokenAllocationModal plus button to use handleSubscribe() when out of tokens - Update subscription manage page plus button to redirect to main subscription page when out of tokens - Remove disabled state from plus buttons when out of tokens to allow subscription upgrades - Improve user experience by providing clear path to increase token allocation
1 parent 83d3407 commit 0412fe3

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

app/components/payments/PledgeBar.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,13 +683,15 @@ const PledgeBar = React.forwardRef<HTMLDivElement, PledgeBarProps>(({
683683
variant="outline"
684684
onClick={(e) => {
685685
e.stopPropagation();
686-
// Don't allow plus button when out of tokens
687-
if (!isOutOfTokens) {
686+
if (isOutOfTokens) {
687+
// Redirect to subscription page when out of tokens
688+
router.push('/settings/subscription');
689+
} else {
688690
handleTokenChange(incrementAmount);
689691
}
690692
}}
691-
className={`h-8 w-8 p-0 ${isOutOfTokens ? 'opacity-50' : ''} ${isRefreshing ? 'opacity-75' : ''}`}
692-
disabled={isOutOfTokens}
693+
className={`h-8 w-8 p-0 ${isRefreshing ? 'opacity-75' : ''}`}
694+
disabled={isRefreshing}
693695
>
694696
<Plus className="h-4 w-4" />
695697
</Button>

app/components/payments/TokenAllocationModal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,14 @@ export function TokenAllocationModal({
243243
className="h-10 w-10 p-0 flex-shrink-0"
244244
onClick={(e) => {
245245
e.stopPropagation();
246-
handleTokenChange(incrementAmount);
246+
if (availableTokens <= 0) {
247+
// Redirect to subscription page when out of tokens
248+
handleSubscribe();
249+
} else {
250+
handleTokenChange(incrementAmount);
251+
}
247252
}}
248-
disabled={availableTokens <= 0}
253+
disabled={false}
249254
>
250255
<Plus className="h-4 w-4" />
251256
</Button>

app/settings/subscription/manage/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,15 @@ export default function SubscriptionManagePage() {
381381
<Button
382382
size="sm"
383383
variant="outline"
384-
onClick={() => handleTokenAllocationChange(allocation.id, incrementAmount)}
385-
disabled={updatingAllocation === allocation.id || (tokenBalance?.availableTokens || 0) <= 0}
384+
onClick={() => {
385+
if ((tokenBalance?.availableTokens || 0) <= 0) {
386+
// Redirect to main subscription page to upgrade
387+
router.push('/settings/subscription');
388+
} else {
389+
handleTokenAllocationChange(allocation.id, incrementAmount);
390+
}
391+
}}
392+
disabled={updatingAllocation === allocation.id}
386393
className="h-8 w-8 p-0"
387394
>
388395
<Plus className="h-4 w-4" />

0 commit comments

Comments
 (0)