@@ -42,6 +42,12 @@ export const RouteDiscovery: React.FC = () => {
42
42
} ,
43
43
} ) ;
44
44
45
+ const resetForm = ( ) => {
46
+ setIsSubmitSuccess ( false ) ;
47
+ setIsSubmitFailed ( false ) ;
48
+ form . reset ( ) ;
49
+ } ;
50
+
45
51
const trackEvent = useTrack ( ) ;
46
52
47
53
const submitDiscoveryMutation = useMutation ( {
@@ -121,6 +127,13 @@ export const RouteDiscovery: React.FC = () => {
121
127
Thank you for your submission. If you still do not see your token listed
122
128
after some time, please reach out to our team for support.
123
129
</ 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 >
124
137
</ div >
125
138
) ;
126
139
@@ -134,6 +147,13 @@ export const RouteDiscovery: React.FC = () => {
134
147
Please double check the network and token address. If issues persist,
135
148
please reach out to our support team.
136
149
</ 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 >
137
157
</ div >
138
158
) ;
139
159
@@ -143,11 +163,17 @@ export const RouteDiscovery: React.FC = () => {
143
163
< RouteDiscoveryCard
144
164
bottomText = ""
145
165
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
+ }
151
177
noPermissionText = { undefined }
152
178
>
153
179
< div >
0 commit comments