diff --git a/components/ISCNTypeIcon.vue b/components/ISCNTypeIcon.vue index 5b79d74d..225edb15 100644 --- a/components/ISCNTypeIcon.vue +++ b/components/ISCNTypeIcon.vue @@ -20,7 +20,7 @@ export enum RecordType { @Component export default class ISCNTypeIcon extends Vue { - @Prop(String) readonly type!: String | undefined + @Prop({ default: 'CreativeWork' }) readonly type!: String | undefined get recordType() { switch (this.type) { diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue index e7502ddd..a7082abb 100644 --- a/components/IscnRegisterForm.vue +++ b/components/IscnRegisterForm.vue @@ -188,7 +188,7 @@ @@ -223,8 +223,38 @@ :placeholder="$t('IscnRegisterForm.placeholder.description')" /> + + + + + @@ -240,7 +270,7 @@ text-preset="h6" type="button" :text="author.name" - @click="editAuthor(index)" + @click="editAuthor({ type: 'stakeholder', index })" /> - + - - +
+
+
+
+ + + - @@ -379,7 +441,7 @@ {{ $t('IscnRegisterForm.error.buy') }} - + - - Promise + typeOptions = [ + 'Book', + 'Photo', + 'Image', + 'Creative', + ] + + licenseOptions = [ + 'Copyright. All rights reserved.', + 'CC BY 4.0', + ] + + fileTypeOptions=[ + 'epub', + 'pdf', + 'mp3', + 'jpg', + 'png', + ] + + author: Author = { + name: '', + url: [], + wallet: [], + likerId: '', + authorDescription: '', + } authors: Author[] = [] name: string = '' @@ -644,7 +733,7 @@ export default class IscnRegisterForm extends Vue { tags: string[] = [] sameAs: string[] = [] url: string = '' - license: string = '' + license: string = this.licenseOptions[0] authorName: string = '' authorUrl: string[] = [] authorWalletAddress: string[] = [] @@ -657,6 +746,7 @@ export default class IscnRegisterForm extends Vue { authorDescription: string = '' contentFingerprintInput: string = '' customContentFingerprints: string[] = [] + type: string = this.defaultType arweaveFeeTargetAddress: string = '' arweaveFee = new BigNumber(0) @@ -686,6 +776,9 @@ export default class IscnRegisterForm extends Vue { showUploadOnly = this.isUploadOnly + currentAuthorDialogType: AuthorDialogType = AuthorDialogType.stakeholder + sameAsList: any = [] + get tagsString(): string { return this.tags.join(',') } @@ -716,7 +809,7 @@ export default class IscnRegisterForm extends Vue { return this.exifInfo && this.exifInfo.ExifImageWidth } - get type() { + get defaultType() { if (this.isPhoto) return 'Photo' if (this.isImage) return 'Image' return 'CreativeWork' @@ -730,6 +823,29 @@ export default class IscnRegisterForm extends Vue { return this.$t('IscnRegisterForm.arweave.link', { arweaveId: this.uploadArweaveId }) } + get arweaveLinks() { + const arLinks = this.customContentFingerprints.filter((link) => + link.startsWith('ar://'), + ) + const array=[] + if (this.uploadArweaveId) { + array.push(this.formattedArweave) + } + if(arLinks.length){ + array.push(...arLinks) + } + return array + } + + get formattedSameAsList() { + return this.sameAsList.map((sameAs: { fileName: any; fileType: any; url: any }) => { + if (sameAs.fileName && sameAs.fileType) { + return `${sameAs.url}?name=${sameAs.fileName}.${sameAs.fileType}`; + } + return ''; + }); +} + get errorMsg() { switch (this.error) { case 'INSUFFICIENT_BALANCE': @@ -799,7 +915,7 @@ export default class IscnRegisterForm extends Vue { name: this.name, description: this.description, tagsString: this.tagsString, - sameAs: this.sameAs, + sameAs: this.formattedSameAsList, url: this.url, exifInfo: this.exif, license: this.license, @@ -807,6 +923,7 @@ export default class IscnRegisterForm extends Vue { arweaveId: this.uploadArweaveId || this.arweaveId, numbersProtocolAssetId: this.numbersProtocolAssetId, fileSHA256: this.fileSHA256, + author: this.author.name, authorNames: this.authorNames, authorUrls: this.authorUrls, authorWallets: this.authorWalletAddresses, @@ -874,8 +991,7 @@ export default class IscnRegisterForm extends Vue { this.name && this.description && this.name.length <= CharactersLimit.name && - this.description.length <= CharactersLimit.description && - this.license.length <= CharactersLimit.license + this.description.length <= CharactersLimit.description ) } @@ -889,6 +1005,15 @@ export default class IscnRegisterForm extends Vue { if (errormsg) this.isOpenWarningSnackbar = true } + @Watch('arweaveLinks') + setSameAsList() { + this.sameAsList = this.arweaveLinks.map((url) => ({ + url, + fileName: '', + fileType: this.fileTypeOptions[0], + })) + } + async mounted() { this.uploadStatus = 'loading' await this.estimateArweaveFee(); @@ -899,26 +1024,50 @@ export default class IscnRegisterForm extends Vue { addContentFingerprint() { this.customContentFingerprints.push(this.contentFingerprintInput) + this.contentFingerprintInput = '' } - handleOpenAuthorDialog() { - logTrackerEvent(this, 'ISCNCreate', 'OpenAuthorDialog', '', 1); + handleOpenAuthorDialog({ type }: { type: AuthorDialogType }) { this.checkedAuthorInfo = false this.isOpenAuthorDialog = true this.initAuthorInfo() + switch (type) { + case AuthorDialogType.author: + logTrackerEvent(this, 'ISCNCreate', 'OpenAuthorDialog', '', 1) + this.currentAuthorDialogType = AuthorDialogType.author + break + + case AuthorDialogType.stakeholder: + default: + logTrackerEvent(this, 'ISCNCreate', 'OpenStakeholderDialog', '', 1) + this.currentAuthorDialogType = AuthorDialogType.stakeholder + break + } } - editAuthor(index: number) { - logTrackerEvent(this, 'ISCNCreate', 'EditAuthor', index.toString(), 1); - const { name, wallet, url, likerId, authorDescription } = - this.authors[index] - this.authorName = name - this.authorWalletAddress = wallet - this.authorUrl = url - this.likerId = likerId - this.authorDescription = authorDescription - this.activeEditingAuthorIndex = index + editAuthor({ type = AuthorDialogType.stakeholder, index }: { type: AuthorDialogType; index: any }) { this.isOpenAuthorDialog = true + + if (type === AuthorDialogType.author) { + logTrackerEvent(this, 'ISCNCreate', 'EditAuthor', '', 1) + const { name, wallet, url, likerId, authorDescription } = this.author + this.authorName = name + this.authorWalletAddress = wallet + this.authorUrl = url + this.likerId = likerId + this.authorDescription = authorDescription + this.activeEditingAuthorIndex = this.authors.findIndex(author => author.name === name); + } else { + logTrackerEvent(this, 'ISCNCreate', 'EditStakeholder', index.toString(), 1) + const { name, wallet, url, likerId, authorDescription } = + this.authors[index] + this.authorName = name + this.authorWalletAddress = wallet + this.authorUrl = url + this.likerId = likerId + this.authorDescription = authorDescription + this.activeEditingAuthorIndex = index + } } dismissAuthorDialog() { @@ -959,6 +1108,9 @@ export default class IscnRegisterForm extends Vue { likerId: this.likerId, authorDescription: this.authorDescription, } + if (this.currentAuthorDialogType === AuthorDialogType.author) { + this.author = newAuthor + } if (this.activeEditingAuthorIndex >= 0) { this.authors.splice(this.activeEditingAuthorIndex, 1, newAuthor) } else { @@ -980,6 +1132,14 @@ export default class IscnRegisterForm extends Vue { this.authorName = value } + setType(value: string) { + this.type = value + } + + setLicense(value: string) { + this.license = value + } + async getLikerIdsAddresses(): Promise { try { this.likerIdsAddresses = await Promise.all( diff --git a/components/IscnUploadedInfo.vue b/components/IscnUploadedInfo.vue index f092888c..ae87d5c2 100644 --- a/components/IscnUploadedInfo.vue +++ b/components/IscnUploadedInfo.vue @@ -10,10 +10,19 @@ -