UX: add progress bar for uploading images

This commit is contained in:
Pieter Vander Vennet 2025-05-07 16:31:00 +02:00
parent bb33c43950
commit 221b572a1f
8 changed files with 45 additions and 18 deletions

View file

@ -252,6 +252,7 @@ export class PanoramaxUploader implements ImageUploader {
currentGps: [number, number],
author: string,
noblur: boolean = false,
progress?: UIEventSource<number>,
sequenceId?: string,
datetime?: string
): Promise<{
@ -319,15 +320,25 @@ export class PanoramaxUploader implements ImageUploader {
const sequence: { id: string; "stats:items": { count: number } } = (
await p.mySequences()
).find((s) => s.id === sequenceId)
const img = <ImageData>await p.addImage(blob, sequence, {
const options = {
lon,
lat,
datetime,
isBlurred: noblur,
onProgress: undefined,
exifOverride: {
Artist: author,
},
})
}
if (progress) {
options.onProgress = (e: ProgressEvent) => {
if (e.lengthComputable) {
const percentage = (e.loaded / e.total) * 100
progress.set(Math.round(percentage))
}
}
}
const img = <ImageData>await p.addImage(blob, sequence, options)
PanoramaxImageProvider.singleton.addKnownMeta(img)
return {
key: "panoramax",