Skip to content

Commit 0ccff9d

Browse files
committed
fix namespace name
and update gitignore
1 parent 9ec454e commit 0ccff9d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ yarn-error.log*
4343
.env
4444
datapacks/contributors.json
4545

46+
# archive
4647
Archive.zip
48+
.next.zip

pages/gui.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
7373

7474
const [destinationId, setDestinationId] = React.useState<filterAutoCompleteType | null>({ id: 'enderchest' });
7575

76+
const changeNamespaceRef = useRef();
7677
const [namespaceId, setNamespaceId] = React.useState<string>('gui');
7778
const handleChangeNamespace = (event: React.ChangeEvent<HTMLInputElement>) => {
7879
setNamespaceId(event.target.value)
@@ -143,14 +144,18 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
143144

144145

145146
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)
148153
const res = await fetch(`${process.env.NEXT_PUBLIC_URL}/api/trappedchest`, {
149154
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' })
151156
})
152157
const data = await res.arrayBuffer()
153-
fileDownload(data, namespaceId + '.zip');
158+
fileDownload(data, namespaceIdNew + '.zip');
154159
}
155160

156161
return (
@@ -350,7 +355,7 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
350355

351356
<TextField variant="standard" id="outlined-number" label="Count"
352357
inputRef={textCountRef}
353-
value={count}
358+
defaultValue={count}
354359
sx={{ mr: 1 }}
355360
inputProps={{ inputMode: 'numeric', pattern: '[0-9]*' }}
356361
/>
@@ -508,7 +513,7 @@ const Gui: NextPage<{ items: Array<string> }> = ({ items: itemsList }) => {
508513
<Typography variant='h3'>DataPack</Typography>
509514
<Box component="form" sx={{ '& > :not(style)': { m: 1 }, }}>
510515

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} />
512517

513518
<Box />
514519
<Autocomplete

0 commit comments

Comments
 (0)