diff options
Diffstat (limited to 'src/mobile/MobileInterface.tsx')
| -rw-r--r-- | src/mobile/MobileInterface.tsx | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx index 9b28d066c..5c89d7612 100644 --- a/src/mobile/MobileInterface.tsx +++ b/src/mobile/MobileInterface.tsx @@ -7,7 +7,7 @@ import { observer } from 'mobx-react'; import * as ReactDOM from "react-dom"; import * as rp from 'request-promise'; import { CurrentUserUtils } from '../client/util/CurrentUserUtils'; -import { FieldValue, Cast, StrCast } from '../fields/Types'; +import { FieldValue, Cast, StrCast, BoolCast } from '../fields/Types'; import { Doc, DocListCast, Opt } from '../fields/Doc'; import { Docs } from '../client/documents/Documents'; import { CollectionView } from '../client/views/collections/CollectionView'; @@ -34,20 +34,21 @@ import RichTextMenu from '../client/views/nodes/formattedText/RichTextMenu'; import { MainView } from '../client/views/MainView'; import SettingsManager from '../client/util/SettingsManager'; import { Uploader } from "./ImageUpload"; -import { Upload } from '../server/SharedMediaTypes'; import { createTypePredicateNodeWithModifier } from 'typescript'; import { AudioBox } from '../client/views/nodes/AudioBox'; import { List } from '../fields/List'; +import { ScriptField, ComputedField } from '../fields/ScriptField'; library.add(faLongArrowAltLeft); library.add(faHome); @observer -export class MobileInterface extends React.Component { +export default class MobileInterface extends React.Component { @observable static Instance: MobileInterface; @computed private get userDoc() { return Doc.UserDoc(); } @computed private get mainContainer() { return this.userDoc ? FieldValue(Cast(this.userDoc.activeMobile, Doc)) : CurrentUserUtils.GuestMobile; } @computed private get activeContainer() { return this.userDoc ? FieldValue(Cast(this.userDoc.activeMobile, Doc)) : CurrentUserUtils.GuestMobile; } + private get darkScheme() { return BoolCast(Cast(this.userDoc?.activeWorkspace, Doc, null)?.darkScheme); } // @observable private currentView: "main" | "ink" | "upload" = "main"; @observable private mainDoc: any = CurrentUserUtils.setupMobileMenu(this.userDoc); @observable private renderView?: () => JSX.Element; @@ -63,6 +64,7 @@ export class MobileInterface extends React.Component { private _menu: Doc = this.mainDoc; private _open: boolean = false; private _library: Doc = Cast(this.userDoc.myWorkspaces, Doc) as Doc; + private _ink: boolean = false; constructor(props: Readonly<{}>) { super(props); @@ -89,14 +91,13 @@ export class MobileInterface extends React.Component { } onSwitchInking = () => { - InkingControl.Instance.switchTool(InkTool.Pen); - MobileInterface.Instance.drawingInk = true; + if (!this._ink) { + InkingControl.Instance.switchTool(InkTool.Pen); + MobileInterface.Instance.drawingInk = true; - DocServer.Mobile.dispatchOverlayTrigger({ - enableOverlay: true, - width: window.innerWidth, - height: window.innerHeight - }); + } else { + MobileInterface.Instance.drawingInk = false; + } } onSwitchUpload = async () => { @@ -214,25 +215,34 @@ export class MobileInterface extends React.Component { this.switchCurrentView((userDoc: Doc) => doc); this._child = doc; } - - // let sidebar = document.getElementById("sidebar") as HTMLElement; - // sidebar.classList.toggle('active'); } createPathname = () => { - let pathname = ""; + let pathname = "workspaces"; this._parents.map((doc: Doc, index: any) => { if (doc === this.mainDoc) { - pathname = pathname + doc.title; + pathname = pathname; + } else if (doc.title === "mobile audio" || doc.title === "Presentation") { + pathname = pathname + } else if (doc.type !== "collection") { + pathname = pathname } else { pathname = pathname + " > " + doc.title; } }); if (this._activeDoc === this.mainDoc) { - pathname = pathname + this._activeDoc.title; + pathname = pathname; } else { pathname = pathname + " > " + this._activeDoc.title; } + + if (this._activeDoc.title === "mobile audio") { + pathname = this._activeDoc.title; + } + + if (this._activeDoc.title === "Presentation") { + pathname = this._activeDoc.title; + } return pathname; } @@ -301,6 +311,9 @@ export class MobileInterface extends React.Component { <div className="item" key="settings" onClick={() => SettingsManager.Instance.open()}> Settings </div> + <div className="item" key="ink" onClick={() => this.onSwitchInking()}> + Ink + </div> </div> </div> <div> @@ -333,6 +346,9 @@ export class MobileInterface extends React.Component { <div> {buttons} </div> + <div className="item" key="ink" onClick={() => CurrentUserUtils.setupDockedButtons(this.userDoc)}> + Ink + </div> <div className="item" key="home" onClick={this.returnHome}> Home </div> @@ -344,7 +360,7 @@ export class MobileInterface extends React.Component { recordAudio = async () => { // upload to server with known URL - + this._parents.push(this._activeDoc); const audioDoc = Cast(Docs.Create.AudioDocument(nullAudio, { _width: 200, _height: 100, title: "mobile audio" }), Doc) as Doc; if (audioDoc) { console.log("audioClicked: " + audioDoc.title); @@ -363,6 +379,7 @@ export class MobileInterface extends React.Component { } openDefaultPresentation = () => { + this._parents.push(this._activeDoc); const presentation = Cast(Doc.UserDoc().activePresentation, Doc) as Doc; if (presentation) { @@ -493,6 +510,7 @@ export class MobileInterface extends React.Component { e.stopPropagation(); } + render() { // const content = this.currentView === "main" ? this.mainContent : // this.currentView === "ink" ? this.inkContent : @@ -505,19 +523,19 @@ export class MobileInterface extends React.Component { </GestureOverlay> */} {/* <GestureOverlay> */} <SettingsManager /> - {this.displayWorkspaces()} + <GestureOverlay> + {this.displayWorkspaces()} + </GestureOverlay> + {this.renderDefaultContent()} {/* </GestureOverlay> */} {/* <DictationOverlay /> <SharingManager /> <GoogleAuthenticationManager /> */} {/* <DocumentDecorations /> */} - <div> - {this.renderDefaultContent()} - </div> {/* <PreviewCursor /> */} {/* <ContextMenu /> */} - {/* <RadialMenu /> - <RichTextMenu /> */} + <RadialMenu /> + {/* <RichTextMenu /> */} {/* <PDFMenu /> <MarqueeOptionsMenu /> <OverlayView /> */} |
