Skip to content

Commit

Permalink
🚸 Display only epub & pdf in sameAs
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Nov 6, 2023
1 parent 45766a0 commit 931abdb
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions components/SameAsFieldList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export default class WalletFieldList extends Vue {
filetype: SAME_AS_FILE_TYPES[0],
}]
fileTypeToFind = [
'epub',
'pdf',
]
// eslint-disable-next-line class-methods-use-this
get sameAsFiletypeOptions() {
return SAME_AS_FILE_TYPES
Expand Down Expand Up @@ -123,17 +128,20 @@ export default class WalletFieldList extends Vue {
originFileName: list.originFileName,
}))
} else if (this.formatUrlOptions.length) {
this.sameAsList = this.formatUrlOptions.map((url, index) =>{
const originFile = this.fileRecords.find((file) => (url.includes(file.arweaveId)))
const formattedFileType = this.formatFileType(originFile?.fileType);
return{
url,
id: `${url}-${index}`,
filename: this.formatName,
filetype: formattedFileType || SAME_AS_FILE_TYPES[0],
originFileName: originFile?.fileName || '',
}
})
this.sameAsList = this.fileRecords
.filter((file) => this.fileTypeToFind.includes(this.formatFileType(file.fileType)))
.map((file, index) => {
const url = this.formatUrlOptions.find((ar) => ar.includes(file.arweaveId));
const formattedFileType = this.formatFileType(file.fileType);
return {
url: url || '',
id: `${url}-${index}`,
filename: this.formatName,
filetype: formattedFileType || SAME_AS_FILE_TYPES[0],
originFileName: file.fileName || '',
};
});
} else {
this.sameAsList = [{
url: '',
Expand Down

0 comments on commit 931abdb

Please sign in to comment.