Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TAS-559] ✨ Enable update ISCN #429

Merged
merged 14 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions components/IscnUploadForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<Card class="p-[32px]" :has-padding="false">
<!-- header -->
<IscnFormHeader :step="step" :total-step="4" />
<IscnFormHeader v-if="mode === 'register'" :step="step" :total-step="4" />
<!-- guide text -->
<Label
:text="$t('UploadForm.guide.selectFile')"
Expand Down Expand Up @@ -134,7 +134,7 @@
</div>
</div>
<div v-else class="flex gap-[8px] justify-end mt-[12px] text-medium-gray">
<Button preset="outline" @click="onSkipUpload"
<Button v-if="mode === 'register'" preset="outline" @click="onSkipUpload"
>{{ $t('UploadForm.button.skip') }}
</Button>
<Button
Expand Down Expand Up @@ -199,7 +199,7 @@
/>
</Dialog>
</Card>
<AttentionsLedger />
<AttentionsLedger v-if="mode === 'register'" />
<Snackbar
v-model="isSizeExceeded"
:text="$t('UploadForm.warning',{ size: Math.round(uploadSizeLimit / (1024*1024)) })"
Expand Down Expand Up @@ -246,9 +246,15 @@
const walletModule = namespace('wallet')
type UploadStatus = '' | 'loading' | 'signing' | 'uploading';

const MODE = {
REGISTER: 'register',
EDIT: 'edit',
}

@Component
export default class UploadForm extends Vue {
@Prop(Number) readonly step: number | undefined
@Prop({ default: MODE.REGISTER }) readonly mode: string | undefined

@walletModule.Getter('getSigner') signer!: OfflineSigner | null
@walletModule.Action('initIfNecessary') initIfNecessary!: () => Promise<any>
Expand Down Expand Up @@ -541,7 +547,7 @@
}
this.epubMetadataList.push(epubMetadata)
} catch (err) {
console.error(err)

Check warning on line 550 in components/IscnUploadForm.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Unexpected console statement
}
}

Expand Down
6 changes: 3 additions & 3 deletions components/SameAsFieldList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default class WalletFieldList extends Vue {
}

get filteredUrlOptions() {
return this.urlOptions.filter(url => url.startsWith('ar://'))
return this.urlOptions?.filter(url => url.startsWith('ar://'))
}

mounted() {
Expand All @@ -129,7 +129,7 @@ export default class WalletFieldList extends Vue {
}))
} else if (this.filteredUrlOptions.length) {
this.sameAsList = this.fileRecords
.filter((file) => this.fileTypeToFind.includes(this.formatFileType(file.fileType)) && file.arweaveId)
?.filter((file) => this.fileTypeToFind.includes(this.formatFileType(file.fileType)) && file.arweaveId)
.map((file, index) => {
const url = this.filteredUrlOptions.find((ar) => ar.includes(file.arweaveId));
const formattedFileType = this.formatFileType(file.fileType);
Expand Down Expand Up @@ -168,7 +168,7 @@ export default class WalletFieldList extends Vue {

deleteEmptyField() {
if (this.sameAsList.length > 1) {
this.sameAsList = this.sameAsList.filter(
this.sameAsList = this.sameAsList?.filter(
(items: any) => items.filename && items.url,
)
}
Expand Down
6 changes: 6 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"iscn.meta.card.preview": "File Preview",
"iscn.meta.card.title": "File Info",
"iscn.meta.content.fingerprints": "Content Fingerprints",
"iscn.meta.content.sameAs": "SameAs",
"iscn.meta.creator.name.placeholder": "Creator Name",
"iscn.meta.creator.name": "Creator Name",
"iscn.meta.creator.url.placeholder": "https://",
Expand Down Expand Up @@ -179,6 +180,10 @@
"IscnCardPage.button.landscape": "Landscape",
"IscnCardPage.button.portrait": "Portrait",
"IscnCardPage.button.print": "Print",
"IscnEditInfo.title": "Edit ISCN Info",
"IscnEditInfo.reUpload": "Re-upload files to update links",
"IscnEditInfo.updating": "Updating ISCN...",
"IscnEditInfo.button.confirm": "Update ISCN",
"IscnRegisterForm.arweave.link": "ar://{arweaveId}",
"IscnRegisterForm.button.back": "Back",
"IscnRegisterForm.button.confirm": "Confirm",
Expand Down Expand Up @@ -209,6 +214,7 @@
"IscnRegisterForm.guide.uploadOnly": "Upload only mode without ISCN",
"IscnRegisterForm.guide.review": "Review and edit metadata",
"IscnRegisterForm.ipfs.link": "ipfs://{hash}",
"IscnRegisterForm.fileSHA256.link": "hash://sha256/{hash}",
"IscnRegisterForm.label.author": "Author",
"IscnRegisterForm.label.stakeholder": "Stakeholders",
"IscnRegisterForm.label.description": "Description",
Expand Down
Loading
Loading