From 939e18624af4252551f38c43335ee8ef0acd144c Mon Sep 17 00:00:00 2001 From: bobzel Date: Sun, 21 Apr 2024 19:03:49 -0400 Subject: more lint cleanup --- src/mobile/ImageUpload.tsx | 77 ++++++++++++++++++++---------------------- src/mobile/MobileInterface.tsx | 2 +- 2 files changed, 38 insertions(+), 41 deletions(-) (limited to 'src/mobile') diff --git a/src/mobile/ImageUpload.tsx b/src/mobile/ImageUpload.tsx index 4e9d85b6d..4fff2a8e7 100644 --- a/src/mobile/ImageUpload.tsx +++ b/src/mobile/ImageUpload.tsx @@ -27,7 +27,6 @@ const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace('px', '')); @observer export class Uploader extends React.Component { - @observable error: string = ''; @observable nm: string = 'Choose files'; // Text of 'Choose Files' button @observable process: string = ''; // Current status of upload @observable private dialogueBoxOpacity = 1; @@ -40,8 +39,8 @@ export class Uploader extends React.Component { await Docs.Prototypes.initialize(); const imgPrev = document.getElementById('img_preview'); this.setOpacity(1, '1'); // Slab 1 - if (imgPrev) { - const files: FileList | null = inputRef.current!.files; + if (imgPrev && inputRef.current) { + const { files } = inputRef.current; this.setOpacity(2, '1'); // Slab 2 if (files && files.length !== 0) { this.process = 'Uploading Files'; @@ -69,11 +68,11 @@ export class Uploader extends React.Component { doc = Docs.Create.ImageDocument(path, { _nativeWidth: defaultNativeImageDim, _width: 400, title: name }); } this.setOpacity(4, '1'); // Slab 4 - const res = await rp.get(ClientUtils.prepend('/getUserDocumentIds')); - if (!res) { + const docidsRes = await rp.get(ClientUtils.prepend('/getUserDocumentIds')); + if (!docidsRes) { throw new Error('No user id returned'); } - const field = await DocServer.GetRefField(JSON.parse(res).userDocumentId); + const field = await DocServer.GetRefField(JSON.parse(docidsRes).userDocumentId); let pending: Opt; if (field instanceof Doc) { pending = col; @@ -100,10 +99,40 @@ export class Uploader extends React.Component { setTimeout(this.clearUpload, 3000); } } catch (error) { - this.error = JSON.stringify(error); + console.log(JSON.stringify(error)); } }; + // Returns the upload interface for mobile + private get uploadInterface() { + return ( +
+
this.closeUpload()}> + +
+ + + +
+ Upload +
+ +
+
+
+
+
+
+
+
+
+

{this.process}

+
+ ); + } + // Updates label after a files is selected (so user knows a file is uploaded) inputLabel = async () => { const files: FileList | null = await inputRef.current!.files; @@ -112,9 +141,7 @@ export class Uploader extends React.Component { } else if (files && files.length > 1) { this.nm = files.length.toString() + ' files selected'; } - }; - - // Loops through load icons, and resets buttons + }; // Loops through load icons, and resets buttons @action clearUpload = () => { for (let i = 1; i < 8; i++) { @@ -139,36 +166,6 @@ export class Uploader extends React.Component { if (slab) slab.style.opacity = opacity; }; - // Returns the upload interface for mobile - private get uploadInterface() { - return ( -
-
this.closeUpload()}> - -
- - - -
- Upload -
- -
-
-
-
-
-
-
-
-
-

{this.process}

-
- ); - } - render() { return ; } diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx index 1d4c0adce..b355e70a7 100644 --- a/src/mobile/MobileInterface.tsx +++ b/src/mobile/MobileInterface.tsx @@ -857,7 +857,7 @@ ScriptingGlobals.add(function switchToMobilePresentation() { return MobileInterface.Instance.setupDefaultPresentation(); }, 'opens the presentation on Dash Mobile'); ScriptingGlobals.add(function openMobileSettings() { - return SettingsManager.Instance.open(); + return SettingsManager.Instance.openMgr(); }, 'opens settings on Dash Mobile'); // Other global functions for mobile -- cgit v1.2.3-70-g09d2