@@ -73,6 +73,7 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
73
73
74
74
const [ destinationId , setDestinationId ] = React . useState < filterAutoCompleteType | null > ( { id : 'enderchest' } ) ;
75
75
76
+ const changeNamespaceRef = useRef ( ) ;
76
77
const [ namespaceId , setNamespaceId ] = React . useState < string > ( 'gui' ) ;
77
78
const handleChangeNamespace = ( event : React . ChangeEvent < HTMLInputElement > ) => {
78
79
setNamespaceId ( event . target . value )
@@ -143,14 +144,18 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
143
144
144
145
145
146
async function generate ( ) {
146
- if ( namespaceId == '' ) setNamespaceId ( 'trappedchest' )
147
- console . log ( process . env . NEXT_PUBLIC_URL )
147
+
148
+ //@ts -ignore
149
+ let namespaceIdNew = changeNamespaceRef ?. current ?. value || ''
150
+ if ( namespaceIdNew == '' ) namespaceIdNew = 'trappedchest' ;
151
+
152
+ //console.log(process.env.NEXT_PUBLIC_URL)
148
153
const res = await fetch ( `${ process . env . NEXT_PUBLIC_URL } /api/trappedchest` , {
149
154
method : "POST" ,
150
- body : JSON . stringify ( { data : guiData , namespace : namespaceId , version : '1.19' } )
155
+ body : JSON . stringify ( { data : guiData , namespace : namespaceIdNew , version : '1.19.4 ' } )
151
156
} )
152
157
const data = await res . arrayBuffer ( )
153
- fileDownload ( data , namespaceId + '.zip' ) ;
158
+ fileDownload ( data , namespaceIdNew + '.zip' ) ;
154
159
}
155
160
156
161
return (
@@ -350,7 +355,7 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
350
355
351
356
< TextField variant = "standard" id = "outlined-number" label = "Count"
352
357
inputRef = { textCountRef }
353
- value = { count }
358
+ defaultValue = { count }
354
359
sx = { { mr : 1 } }
355
360
inputProps = { { inputMode : 'numeric' , pattern : '[0-9]*' } }
356
361
/>
@@ -508,7 +513,7 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
508
513
< Typography variant = 'h3' > DataPack</ Typography >
509
514
< Box component = "form" sx = { { '& > :not(style)' : { m : 1 } , } } >
510
515
511
- < TextField variant = "standard" id = "outlined-text" label = "Namespace" type = "text" onChange = { handleChangeNamespace } value = { namespaceId } />
516
+ < TextField variant = "standard" id = "outlined-text" label = "Namespace" type = "text" inputRef = { changeNamespaceRef } defaultValue = { namespaceId } />
512
517
513
518
< Box />
514
519
< Autocomplete
0 commit comments