aboutsummaryrefslogtreecommitdiff
path: root/src/mobile/MobileInterface.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/mobile/MobileInterface.tsx')
-rw-r--r--src/mobile/MobileInterface.tsx20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx
index a1719c015..0bc950a71 100644
--- a/src/mobile/MobileInterface.tsx
+++ b/src/mobile/MobileInterface.tsx
@@ -11,6 +11,7 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, observable, reaction } from 'mobx';
import { observer } from 'mobx-react';
+import { trace } from 'mobx';
import * as rp from 'request-promise';
import { Doc, DocListCast } from '../fields/Doc';
import { CurrentUserUtils } from '../client/util/CurrentUserUtils';
@@ -115,12 +116,14 @@ export class MobileInterface extends React.Component {
/**
* Method called when 'Library' button is pressed on the home screen
*/
- switchToLibrary = () => {
+ switchToLibrary = async () => {
this._parents.push(this._activeDoc);
this.switchCurrentView((userDoc: Doc) => this._library);
this._activeDoc = this._library;
this._homeMenu = false;
- this.sidebarActive = true;
+ this.toggleSidebar();
+ //setTimeout(this.toggleSidebar, 300);
+
}
openWorkspaces = () => {
@@ -128,6 +131,7 @@ export class MobileInterface extends React.Component {
this.switchCurrentView((userDoc: Doc) => this._library);
this._activeDoc = this._library;
this._homeMenu = false;
+ this.sidebarActive = true;
}
/**
@@ -242,7 +246,13 @@ export class MobileInterface extends React.Component {
@undoBatch
handleClick = async (doc: Doc) => {
const children = DocListCast(doc.data);
- if (doc.type !== "collection" && this.sidebarActive) this.openFromSidebar(doc);
+ if (doc.type !== "collection" && this.sidebarActive) {
+ this._parents.push(this._activeDoc);
+ this._activeDoc = doc;
+ this.switchCurrentView((userDoc: Doc) => doc);
+ this._homeMenu = false;
+ this.toggleSidebar();
+ }
else if (doc.type === "collection" && children.length === 0) this.openFromSidebar(doc);
else {
this._parents.push(this._activeDoc);
@@ -407,6 +417,7 @@ export class MobileInterface extends React.Component {
<span></span>
<span></span>
</div>
+ <div className={`background ${this.sidebarActive ? "active" : ""}`} onClick={this.toggleSidebar}></div>
</div>
{this.renderPathbar()}
<div className={`sidebar ${this.sidebarActive ? "active" : ""}`}>
@@ -435,6 +446,8 @@ export class MobileInterface extends React.Component {
}
</div>
</div>
+ <div className={`blanket ${this.sidebarActive ? "active" : ""}`} onClick={this.toggleSidebar}>
+ </div>
</div>
);
}
@@ -846,3 +859,4 @@ Scripting.addGlobal(function openMobileSettings() { return SettingsManager.Insta
Scripting.addGlobal(function openWorkspaces() { return MobileInterface.Instance.openWorkspaces(); });
Scripting.addGlobal(function uploadImageMobile() { return MobileInterface.Instance.toggleUpload(); });
Scripting.addGlobal(function switchToMobileUploads() { return MobileInterface.Instance.switchToMobileUploads(); });
+Scripting.addGlobal(function switchToLibrary() { return MobileInterface.Instance.switchToLibrary(); }); \ No newline at end of file