@@ -25,6 +25,7 @@ import ReactMarkdown from "components/ReactMarkdown";
25
25
26
26
import FetchDisputeRequestInput , { DisputeRequest } from "./FetchDisputeRequestInput" ;
27
27
import FetchFromIDInput from "./FetchFromIdInput" ;
28
+ import CustomContextInputs from "./CustomContextInputs" ;
28
29
29
30
const Container = styled . div `
30
31
height: auto;
@@ -106,10 +107,6 @@ const UpperContainer = styled.div`
106
107
) }
107
108
` ;
108
109
109
- const StyledJSONEditor = styled ( JSONEditor ) `
110
- height: 300px;
111
- width: 100%;
112
- ` ;
113
110
const StyledForm = styled . form `
114
111
display: flex;
115
112
flex-direction: column;
@@ -155,7 +152,7 @@ const DisputeTemplateView = () => {
155
152
const [ disputeDetails , setDisputeDetails ] = useState < DisputeDetails | undefined > ( undefined ) ;
156
153
const [ disputeTemplateInput , setDisputeTemplateInput ] = useState < string > ( "" ) ;
157
154
const [ dataMappingsInput , setDataMappingsInput ] = useState < string > ( "" ) ;
158
- const [ customContextInput , setCustomContextInput ] = useState < string > ( "{}" ) ;
155
+ const [ customContext , setCustomContext ] = useState < Record < string , string > > ( ) ;
159
156
160
157
const [ params , setParams ] = useState < DisputeRequest > ( {
161
158
_arbitrable : "0x10f7A6f42Af606553883415bc8862643A6e63fdA" ,
@@ -184,12 +181,6 @@ const DisputeTemplateView = () => {
184
181
setLoading ( true ) ;
185
182
186
183
setTimeout ( ( ) => {
187
- let customContext = null ;
188
- try {
189
- customContext = JSON . parse ( customContextInput ) ;
190
- } catch ( error ) {
191
- console . log ( "Error parsing custom context" , error ) ;
192
- }
193
184
let initialContext = {
194
185
arbitrator : debouncedParams . _arbitrator ,
195
186
arbitrable : debouncedParams . _arbitrable ,
@@ -224,7 +215,7 @@ const DisputeTemplateView = () => {
224
215
if ( disputeTemplateInput || dataMappingsInput || debouncedParams ) {
225
216
scheduleFetchData ( ) ;
226
217
}
227
- } , [ disputeTemplateInput , dataMappingsInput , debouncedParams , customContextInput ] ) ;
218
+ } , [ disputeTemplateInput , dataMappingsInput , debouncedParams , customContext ] ) ;
228
219
229
220
return (
230
221
< >
@@ -291,18 +282,11 @@ const DisputeTemplateView = () => {
291
282
name = "_templateUri"
292
283
value = { params . _templateUri }
293
284
onChange = { handleFormUpdate }
294
- placeholder = "ipfs:/ /... (optional)"
285
+ placeholder = "/ipfs /... (optional)"
295
286
/>
296
287
</ StyledRow >
297
288
< StyledRow >
298
- < StyledP > { "Custom Context :" } </ StyledP >
299
- < StyledJSONEditor
300
- content = { { text : customContextInput } }
301
- mode = { Mode . text }
302
- onChange = { ( val : any ) => {
303
- setCustomContextInput ( val . text ) ;
304
- } }
305
- />
289
+ < CustomContextInputs dataMapping = { dataMappingsInput } setCustomContext = { setCustomContext } />
306
290
</ StyledRow >
307
291
</ StyledForm >
308
292
< div >
0 commit comments