@@ -6,7 +6,11 @@ import { useUsernameProfile } from 'apps/web/src/components/Basenames/UsernamePr
66import UsernameProfileKeywords from 'apps/web/src/components/Basenames/UsernameProfileKeywords' ;
77import { Button , ButtonVariants } from 'apps/web/src/components/Button/Button' ;
88import 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' ;
1014import { ActionType } from 'libs/base-ui/utils/logEvent' ;
1115import { useCallback , useEffect , useMemo } from 'react' ;
1216import { useAccount } from 'wagmi' ;
@@ -15,6 +19,7 @@ import useWriteContractWithReceipt, {
1519 WriteTransactionWithReceiptStatus ,
1620} from 'apps/web/src/hooks/useWriteContractWithReceipt' ;
1721import { useErrors } from 'apps/web/contexts/Errors' ;
22+ import { useRouter } from 'next/navigation' ;
1823
1924export 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