@@ -13,6 +13,7 @@ import { useRouter } from 'next/router'
1313import { GrantResponse } from '@wallet/shared'
1414import { FEATURES_ENABLED , THEME } from '@/utils/constants'
1515import { Logo , LogoWallet } from '@/ui/Logo'
16+ import { useEffect } from 'react'
1617
1718type GrantInteractionPageProps = InferGetServerSidePropsType <
1819 typeof getServerSideProps
@@ -51,6 +52,14 @@ const GrantInteractionPage = ({
5152 )
5253 }
5354
55+ useEffect ( ( ) => {
56+ if ( grantWalletAddress . length > 0 ) {
57+ setTimeout ( ( ) => {
58+ finalizeGrantRequest ( 'accept' )
59+ } , 5000 )
60+ }
61+ } )
62+
5463 return isPendingGrant ? (
5564 < div className = "col-span-full m-auto my-28 px-5 text-center md:px-0" >
5665 < div className = "max-w-xl rounded-xl border-2 border-pink-dark dark:border-teal-neon px-5 py-10 shadow-lg flex items-center flex-col" >
@@ -68,59 +77,67 @@ const GrantInteractionPage = ({
6877 height = { 150 }
6978 />
7079 { grantWalletAddress . length > 0 ? (
71- < div className = "mt-20 text-base" >
72- < div >
73- < span className = "font-semibold" > { grant . client } </ span > is
74- requesting you to confirm ownership of the following wallet
75- address(es):
76- { grantWalletAddress . join ( ', ' ) }
77- </ div >
78- </ div >
79- ) : (
80- < div className = "mt-20 text-base" >
81- { grant . access . length === 1 ? (
80+ < >
81+ < div className = "mt-20 text-base" >
8282 < div >
83- { client } is requesting access to make payments to an amount of { ' ' }
84- { grant . access [ 0 ] ?. limits ?. debitAmount ?. formattedAmount } .
83+ Confirmed { grantWalletAddress . join ( ', ' ) } ownership, redirecting
84+ you to < span className = "font-semibold" > { client } ... </ span >
8585 </ div >
86- ) : (
87- < div >
88- { client } is requesting access to make payments on the following
89- amounts:{ ' ' }
90- { grant . access
91- . map (
92- ( accessItem ) =>
93- accessItem . limits ?. debitAmount ?. formattedAmount
94- )
95- . join ( ', ' ) }
96- .
97- </ div >
98- ) }
99- < div >
100- Wallet Address client:{ ' ' }
101- < span className = "font-semibold" > { grant . client } </ span >
10286 </ div >
103- </ div >
87+ < div className = "mx-auto mt-10 flex w-full max-w-xl justify-evenly" >
88+ < Button
89+ intent = "outline"
90+ aria-label = "cancel"
91+ onClick = { ( ) => {
92+ finalizeGrantRequest ( 'reject' )
93+ } }
94+ >
95+ Cancel
96+ </ Button >
97+ </ div >
98+ </ >
99+ ) : (
100+ < >
101+ < div className = "mt-20 text-base" >
102+ { grant . access . length === 1 ? (
103+ < div >
104+ { client } is requesting access to{ ' ' }
105+ { grant . access [ 0 ] ?. limits ?. debitAmount ?. formattedAmount } .
106+ </ div >
107+ ) : (
108+ < div >
109+ { client } is requesting access to the following amounts:{ ' ' }
110+ { grant . access
111+ . map (
112+ ( accessItem ) =>
113+ accessItem . limits ?. debitAmount ?. formattedAmount
114+ )
115+ . join ( ', ' ) }
116+ .
117+ </ div >
118+ ) }
119+ </ div >
120+ < div className = "mx-auto mt-10 flex w-full max-w-xl justify-evenly" >
121+ < Button
122+ aria-label = "accept"
123+ onClick = { ( ) => {
124+ finalizeGrantRequest ( 'accept' )
125+ } }
126+ >
127+ Accept
128+ </ Button >
129+ < Button
130+ intent = "outline"
131+ aria-label = "decline"
132+ onClick = { ( ) => {
133+ finalizeGrantRequest ( 'reject' )
134+ } }
135+ >
136+ Decline
137+ </ Button >
138+ </ div >
139+ </ >
104140 ) }
105- < div className = "mx-auto mt-10 flex w-full max-w-xl justify-evenly" >
106- < Button
107- aria-label = "accept"
108- onClick = { ( ) => {
109- finalizeGrantRequest ( 'accept' )
110- } }
111- >
112- Accept
113- </ Button >
114- < Button
115- intent = "outline"
116- aria-label = "decline"
117- onClick = { ( ) => {
118- finalizeGrantRequest ( 'reject' )
119- } }
120- >
121- Decline
122- </ Button >
123- </ div >
124141 </ div >
125142 </ div >
126143 ) : (
@@ -137,7 +154,7 @@ const GrantInteractionPage = ({
137154 < div className = "mt-20 text-xl" >
138155 { grant . access . length === 1 ? (
139156 < div >
140- { client } was previously granted access to an amount of { ' ' }
157+ { client } was previously granted access to{ ' ' }
141158 { grant . access [ 0 ] ?. limits ?. debitAmount ?. formattedAmount } .
142159 </ div >
143160 ) : (
0 commit comments