Skip to content

Commit c455504

Browse files
authored
Merge pull request #91 from mansurskTarento/marketplace-provider-ui
Marketplace provider UI
2 parents e5a1bd6 + 2bcd5b2 commit c455504

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/provider-details/provider-details.component.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,23 @@ export class ProviderDetailsComponent implements OnInit, OnChanges {
199199
const fileName = event.name.replace(/[^A-Za-z0-9_.]/g, '')
200200
if (this.thumbnailFile) {
201201
if (fileName.toLowerCase().endsWith('.svg') || fileName.toLowerCase().endsWith('.png')) {
202-
const reader = new FileReader()
203-
reader.onload = (e: any) => {
204-
const img = new Image()
205-
img.onload = () => {
206-
this.cropImage(img)
202+
const fileSizeInKB = this.thumbnailFile.size / 1000
203+
const minSizeKB = 300
204+
const maxSizeMB = 2
205+
const maxSizeKB = maxSizeMB * 1000
206+
if (fileSizeInKB >= minSizeKB && fileSizeInKB <= maxSizeKB) {
207+
const reader = new FileReader()
208+
reader.onload = (e: any) => {
209+
const img = new Image()
210+
img.onload = () => {
211+
this.cropImage(img)
212+
}
213+
img.src = e.target.result
207214
}
208-
img.src = e.target.result
215+
reader.readAsDataURL(this.thumbnailFile)
216+
} else {
217+
this.showSnackBar('Please upload image sized between 300 KB and 2 MB')
209218
}
210-
reader.readAsDataURL(this.thumbnailFile)
211219
} else {
212220
this.showSnackBar('Please upload svg or png image')
213221
}
@@ -411,6 +419,8 @@ export class ProviderDetailsComponent implements OnInit, OnChanges {
411419
this.showSnackBar(errmsg)
412420
},
413421
})
422+
} else {
423+
this.showSnackBar('Please fill all the mandator fields with proper data')
414424
}
415425
}
416426

@@ -447,6 +457,8 @@ export class ProviderDetailsComponent implements OnInit, OnChanges {
447457
this.showSnackBar(errmsg)
448458
},
449459
})
460+
} else {
461+
this.showSnackBar('Please fill all the mandator fields with proper data')
450462
}
451463
}
452464

0 commit comments

Comments
 (0)