@@ -42,6 +42,12 @@ export const RouteDiscovery: React.FC = () => {
4242 } ,
4343 } ) ;
4444
45+ const resetForm = ( ) => {
46+ setIsSubmitSuccess ( false ) ;
47+ setIsSubmitFailed ( false ) ;
48+ form . reset ( ) ;
49+ } ;
50+
4551 const trackEvent = useTrack ( ) ;
4652
4753 const submitDiscoveryMutation = useMutation ( {
@@ -121,6 +127,13 @@ export const RouteDiscovery: React.FC = () => {
121127 Thank you for your submission. If you still do not see your token listed
122128 after some time, please reach out to our team for support.
123129 </ p >
130+ < button
131+ type = "button"
132+ onClick = { resetForm }
133+ className = "rounded-md border border-green-500 bg-green-100 px-4 py-2 text-green-700 transition-colors hover:bg-green-200"
134+ >
135+ Submit Another Token
136+ </ button >
124137 </ div >
125138 ) ;
126139
@@ -134,6 +147,13 @@ export const RouteDiscovery: React.FC = () => {
134147 Please double check the network and token address. If issues persist,
135148 please reach out to our support team.
136149 </ p >
150+ < button
151+ type = "button"
152+ onClick = { resetForm }
153+ className = "rounded-md border border-red-500 bg-red-100 px-4 py-2 text-red-700 transition-colors hover:bg-red-200"
154+ >
155+ Try Again
156+ </ button >
137157 </ div >
138158 ) ;
139159
@@ -143,11 +163,17 @@ export const RouteDiscovery: React.FC = () => {
143163 < RouteDiscoveryCard
144164 bottomText = ""
145165 errorText = { form . getFieldState ( "tokenAddress" ) . error ?. message }
146- saveButton = { {
147- type : "submit" ,
148- disabled : ! form . formState . isDirty ,
149- isPending : submitDiscoveryMutation . isPending ,
150- } }
166+ saveButton = {
167+ // Only show the submit button in the default state
168+ ! isSubmitSuccess && ! isSubmitFail
169+ ? {
170+ type : "submit" ,
171+ disabled : ! form . formState . isDirty ,
172+ isPending : submitDiscoveryMutation . isPending ,
173+ variant : "primary" ,
174+ }
175+ : undefined // Hide the button when in success or error states
176+ }
151177 noPermissionText = { undefined }
152178 >
153179 < div >
0 commit comments