allow file choice for gift, plus other UI fixes

This commit is contained in:
2024-05-12 17:55:54 -06:00
parent 6c28828c0a
commit 7d6b210ee1
7 changed files with 164 additions and 60 deletions

View File

@@ -29,7 +29,6 @@
<div v-if="crop">
<VuePictureCropper
:boxStyle="{
height: window80(),
backgroundColor: '#f8f8f8',
margin: 'auto',
}"
@@ -39,6 +38,7 @@
dragMode: 'crop',
aspectRatio: 9 / 9,
}"
class="max-h-[90vh] max-w-[90vw] object-contain"
/>
<!-- This gives a round cropper.
:presetMode="{
@@ -48,7 +48,10 @@
</div>
<div v-else>
<div class="flex justify-center">
<img :src="createBlobURL(blob)" class="mt-2 rounded" />
<img
:src="createBlobURL(blob)"
class="mt-2 rounded max-h-[90vh] max-w-[90vw] object-contain"
/>
</div>
</div>
<div class="absolute bottom-[1rem] left-[1rem] px-2 py-1">
@@ -135,7 +138,7 @@ export default class PhotoDialog extends Vue {
activeDeviceNumber = 0;
activeDid = "";
blob?: Blob;
claimType = "GiveAction";
claimType = "";
crop = false;
fileName?: string;
mirror = false;
@@ -169,14 +172,14 @@ export default class PhotoDialog extends Vue {
open(
setImageFn: (arg: string) => void,
claimType: string,
crop?: boolean,
claimType?: string,
blob?: Blob, // for image upload, just to use the cropping function
inputFileName?: string,
) {
this.visible = true;
this.claimType = claimType;
this.crop = !!crop;
this.claimType = claimType || "GiveAction";
const bottomNav = document.querySelector("#QuickNav") as HTMLElement;
if (bottomNav) {
bottomNav.style.display = "none";
@@ -185,6 +188,7 @@ export default class PhotoDialog extends Vue {
if (blob) {
this.blob = blob;
this.fileName = inputFileName;
// doesn't make sense to retry the file upload; they can cancel if they picked the wrong one
this.showRetry = false;
} else {
this.blob = undefined;
@@ -366,8 +370,7 @@ export default class PhotoDialog extends Vue {
);
this.uploading = false;
this.visible = false;
this.blob = undefined;
this.close();
this.setImageCallback(response.data.url as string);
} catch (error) {
console.error("Error uploading the image", error);