Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 0d779dc

Browse files
authored
[BA-1890] Add CTAs to renewal flow (#2476)
* Add CTAs to renewal flow * ks
1 parent 1529d8d commit 0d779dc

2 files changed

Lines changed: 47 additions & 5 deletions

File tree

apps/web/src/components/Basenames/ManageNames/NameDisplay.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import {
1919
useRemoveNameFromUI,
2020
} from 'apps/web/src/components/Basenames/ManageNames/hooks';
2121
import Link from 'apps/web/src/components/Link';
22+
import { isBasenameRenewalsKilled } from 'apps/web/src/utils/usernames';
23+
import { useRouter } from 'next/navigation';
24+
import { ActionType } from 'libs/base-ui/utils/logEvent';
25+
import { useAnalytics } from 'apps/web/contexts/Analytics';
2226

2327
const transitionClasses = 'transition-all duration-700 ease-in-out';
2428

@@ -50,6 +54,8 @@ export default function NameDisplay({
5054
expiresAt,
5155
refetchNames,
5256
}: NameDisplayProps) {
57+
const router = useRouter();
58+
const { logEventWithContext } = useAnalytics();
5359
const expirationText = formatDistanceToNow(parseISO(expiresAt), { addSuffix: true });
5460
const name = domain.split('.')[0];
5561

@@ -66,6 +72,17 @@ export default function NameDisplay({
6672
const openRenewalModal = useCallback(() => setIsRenewalModalOpen(true), []);
6773
const closeRenewalModal = useCallback(() => setIsRenewalModalOpen(false), []);
6874

75+
const handleExtendRegistration = useCallback(() => {
76+
logEventWithContext('extend_registration_button_clicked', ActionType.click, {
77+
context: 'manage_names',
78+
});
79+
if (isBasenameRenewalsKilled) {
80+
openRenewalModal();
81+
} else {
82+
router.push(`/name/${domain}/renew`);
83+
}
84+
}, [logEventWithContext, openRenewalModal, domain, router]);
85+
6986
return (
7087
<li key={tokenId} className={pillNameClasses}>
7188
<div className="flex items-center justify-between">
@@ -107,7 +124,7 @@ export default function NameDisplay({
107124
</span>
108125
</DropdownItem>
109126
) : null}
110-
<DropdownItem onClick={openRenewalModal}>
127+
<DropdownItem onClick={handleExtendRegistration}>
111128
<span className="flex flex-row items-center gap-2">
112129
<Icon name="convert" color="currentColor" width="1rem" height="1rem" /> Extend
113130
registration

apps/web/src/components/Basenames/UsernameProfileSidebar/index.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { useUsernameProfile } from 'apps/web/src/components/Basenames/UsernamePr
66
import UsernameProfileKeywords from 'apps/web/src/components/Basenames/UsernameProfileKeywords';
77
import { Button, ButtonVariants } from 'apps/web/src/components/Button/Button';
88
import useReadBaseEnsTextRecords from 'apps/web/src/hooks/useReadBaseEnsTextRecords';
9-
import { buildBasenameReclaimContract, UsernameTextRecordKeys } from 'apps/web/src/utils/usernames';
9+
import {
10+
buildBasenameReclaimContract,
11+
isBasenameRenewalsKilled,
12+
UsernameTextRecordKeys,
13+
} from 'apps/web/src/utils/usernames';
1014
import { ActionType } from 'libs/base-ui/utils/logEvent';
1115
import { useCallback, useEffect, useMemo } from 'react';
1216
import { useAccount } from 'wagmi';
@@ -15,6 +19,7 @@ import useWriteContractWithReceipt, {
1519
WriteTransactionWithReceiptStatus,
1620
} from 'apps/web/src/hooks/useWriteContractWithReceipt';
1721
import { useErrors } from 'apps/web/contexts/Errors';
22+
import { useRouter } from 'next/navigation';
1823

1924
export default function UsernameProfileSidebar() {
2025
const {
@@ -31,6 +36,7 @@ export default function UsernameProfileSidebar() {
3136
const { basenameChain } = useBasenameChain(profileUsername);
3237
const { logError } = useErrors();
3338
const { logEventWithContext } = useAnalytics();
39+
const router = useRouter();
3440

3541
const toggleSettings = useCallback(() => {
3642
if (!currentWalletIsProfileEditor) return;
@@ -43,6 +49,13 @@ export default function UsernameProfileSidebar() {
4349
showProfileSettings,
4450
]);
4551

52+
const handleExtendRegistration = useCallback(() => {
53+
logEventWithContext('extend_registration_button_clicked', ActionType.click, {
54+
context: 'profile_sidebar',
55+
});
56+
router.push(`/name/${profileUsername}/renew`);
57+
}, [logEventWithContext, profileUsername, router]);
58+
4659
const { existingTextRecords } = useReadBaseEnsTextRecords({
4760
username: profileUsername,
4861
});
@@ -90,9 +103,21 @@ export default function UsernameProfileSidebar() {
90103
address={profileAddress}
91104
/>
92105
{currentWalletIsProfileEditor && (
93-
<Button variant={ButtonVariants.Gray} rounded fullWidth onClick={toggleSettings}>
94-
{showProfileSettings ? 'Back to Profile' : 'Manage Profile'}
95-
</Button>
106+
<div className="flex flex-col gap-2">
107+
<Button variant={ButtonVariants.Gray} rounded fullWidth onClick={toggleSettings}>
108+
{showProfileSettings ? 'Back to Profile' : 'Manage Profile'}
109+
</Button>
110+
{!isBasenameRenewalsKilled && (
111+
<Button
112+
variant={ButtonVariants.Gray}
113+
rounded
114+
fullWidth
115+
onClick={handleExtendRegistration}
116+
>
117+
Extend Registration
118+
</Button>
119+
)}
120+
</div>
96121
)}
97122
{currentWalletNeedsToReclaimProfile && (
98123
<Button

0 commit comments

Comments
 (0)