From 112cc6b5b76b225ad1f7379e7a6f14a572c9b3ab Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Mon, 30 Oct 2023 20:01:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Separate=20upload=20only=20mode?= =?UTF-8?q?=20and=20register=20ISCN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnRegisterForm.vue | 237 ++------------------- components/IscnUploadForm.vue | 357 +++++++++++++++++++++++++++++++- components/SameAsFieldList.vue | 1 - locales/en.json | 2 +- pages/new/index.vue | 36 ++-- 5 files changed, 383 insertions(+), 250 deletions(-) diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue index 233d17f9..e707cfdb 100644 --- a/components/IscnRegisterForm.vue +++ b/components/IscnRegisterForm.vue @@ -8,12 +8,7 @@ - - @@ -463,12 +432,6 @@ 'gap-[12px]', ]" > - @@ -146,6 +165,72 @@ :all-exif="displayExifInfo" /> + + + +
{{ signDialogMessage }}
+
{{ signDialogError }}
+ + +
+ + + +
{{ signDialogMessage }}
+
{{ signDialogError }}
+ + +
+ + {{ errorMsg }} + + {{ $t('IscnRegisterForm.error.buy') }} + + diff --git a/components/SameAsFieldList.vue b/components/SameAsFieldList.vue index aeedeaf3..ce882d65 100644 --- a/components/SameAsFieldList.vue +++ b/components/SameAsFieldList.vue @@ -33,7 +33,6 @@
diff --git a/locales/en.json b/locales/en.json index 50e5bc5f..8eed747d 100644 --- a/locales/en.json +++ b/locales/en.json @@ -182,7 +182,7 @@ "IscnRegisterForm.button.signing": "Waiting for signature", "IscnRegisterForm.button.success": "Success", "IscnRegisterForm.button.upload": "Upload", - "IscnRegisterForm.button.uploading": "Uploading", + "IscnRegisterForm.button.uploading": "Uploading files to Arweave....", "IscnRegisterForm.button.uploadOnly": "Switch to upload only mode", "IscnRegisterForm.button.whitelist": "Apply for Whitelist", "IscnRegisterForm.error.arweave": "Oops. Unable to upload to Arweave. Please try again later.", diff --git a/pages/new/index.vue b/pages/new/index.vue index f592ea60..c72946b7 100644 --- a/pages/new/index.vue +++ b/pages/new/index.vue @@ -32,19 +32,19 @@ v-if="state === 'init'" :step="step" @submit="onSubmitUpload" + @arweaveUploaded="onArweaveIdUpload" + @handleSubmit="isSubmit = true" /> @@ -118,8 +118,8 @@ export default class NewIndexPage extends Vue { state = 'init' urlIpfsHash = this.$route.query.ipfs_hash || '' - arweaveId = this.$route.query.arweave_id || '' - isUploadOnly = this.$route.query.upload_only === '1' + urlArweaveId = this.$route.query.arweave_id || '' + uploadArweaveList: any[] = [] fileSHA256 = '' fileData = '' fileType = '' @@ -167,17 +167,17 @@ export default class NewIndexPage extends Vue { } async mounted() { - if ((this.urlIpfsHash || this.arweaveId) && this.shouldSkipToMintNFT) { + if ((this.urlIpfsHash || this.urlArweaveId) && this.shouldSkipToMintNFT) { this.state = 'iscn'; let url; - if (this.arweaveId) url = `https://arweave.net/${this.arweaveId}`; + if (this.urlArweaveId) url = `https://arweave.net/${this.urlArweaveId}`; else if (this.urlIpfsHash) url = `https://ipfs.io/ipfs/${this.urlIpfsHash}`; if (url) { const { data, headers } = await this.$axios.get(url, { responseType: 'blob' }) this.urlFileRecords = [{ fileBlob: data as Blob, ipfsHash: this.urlIpfsHash, - arweaveId: this.arweaveId, + arweaveId: this.urlArweaveId, isFileImage: headers['content-type'].startsWith('image'), fileType: headers['content-type'], fileSize: headers['content-length'], @@ -187,16 +187,24 @@ export default class NewIndexPage extends Vue { } } - onSubmitUpload(fileRecords: any[] | []) { + onSubmitUpload({ + fileRecords, + arweaveIds, + }: { + fileRecords: any[] | [] + arweaveIds: any[] | [] + }) { if (fileRecords && fileRecords.length) { this.uploadFileRecords = [...fileRecords] } + if (arweaveIds && arweaveIds.length) { + this.uploadArweaveList = [...arweaveIds] + } this.state = 'iscn' - logTrackerEvent(this, 'ISCNCreate', 'ISCNConfirmFile', '', 1); + logTrackerEvent(this, 'ISCNCreate', 'ISCNConfirmFile', '', 1) } - onArweaveIdUpdate({ arweaveId }: { arweaveId: string }) { - this.arweaveId = arweaveId + onArweaveIdUpload({ arweaveId }: { arweaveId: string }) { logTrackerEvent(this, 'ISCNCreate', 'ISCNFileUploadToARSuccess', arweaveId, 1); } @@ -233,7 +241,7 @@ export default class NewIndexPage extends Vue { handleCreateAnotherButtonClick() { this.state = 'init' this.urlIpfsHash = '' - this.arweaveId = '' + this.urlArweaveId = '' this.fileSHA256 = '' this.fileData = '' this.fileType = ''