From 146f8622d5bac2edc6b09f57c173bd057dfbcfad Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 8 Jul 2022 00:17:26 -0400
Subject: restructured currentUserUtils to avoid having import cycles.

---
 src/client/views/webcam/DashWebRTCVideo.tsx | 88 ++++++++++++++---------------
 1 file changed, 43 insertions(+), 45 deletions(-)

(limited to 'src/client/views/webcam/DashWebRTCVideo.tsx')

diff --git a/src/client/views/webcam/DashWebRTCVideo.tsx b/src/client/views/webcam/DashWebRTCVideo.tsx
index 6c0c9b301..02e44a793 100644
--- a/src/client/views/webcam/DashWebRTCVideo.tsx
+++ b/src/client/views/webcam/DashWebRTCVideo.tsx
@@ -1,86 +1,84 @@
-import { faPhoneSlash, faSync } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { action, observable } from "mobx";
-import { observer } from "mobx-react";
-import { Doc } from "../../../fields/Doc";
-import { InkTool } from "../../../fields/InkField";
-import "../../views/nodes/WebBox.scss";
-import { DocumentDecorations } from "../DocumentDecorations";
-import { CollectionFreeFormDocumentViewProps } from "../nodes/CollectionFreeFormDocumentView";
-import { FieldView, FieldViewProps } from "../nodes/FieldView";
-import "./DashWebRTCVideo.scss";
-import { hangup, initialize, refreshVideos } from "./WebCamLogic";
-import React = require("react");
-import { CurrentUserUtils } from "../../util/CurrentUserUtils";
-import { IconLookup } from "@fortawesome/fontawesome-svg-core";
-
+import { IconLookup } from '@fortawesome/fontawesome-svg-core';
+import { faPhoneSlash, faSync } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { action, observable } from 'mobx';
+import { observer } from 'mobx-react';
+import { Doc } from '../../../fields/Doc';
+import { InkTool } from '../../../fields/InkField';
+import '../../views/nodes/WebBox.scss';
+import { DocumentDecorations } from '../DocumentDecorations';
+import { CollectionFreeFormDocumentViewProps } from '../nodes/CollectionFreeFormDocumentView';
+import { FieldView, FieldViewProps } from '../nodes/FieldView';
+import './DashWebRTCVideo.scss';
+import { hangup, initialize, refreshVideos } from './WebCamLogic';
+import React = require('react');
 
 /**
  * This models the component that will be rendered, that can be used as a doc that will reflect the video cams.
  */
 @observer
 export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentViewProps & FieldViewProps> {
-
     private roomText: HTMLInputElement | undefined;
     @observable remoteVideoAdded: boolean = false;
 
     @action
     changeUILook = () => {
         this.remoteVideoAdded = true;
-    }
+    };
 
     /**
-      * Function that submits the title entered by user on enter press.
-      */
+     * Function that submits the title entered by user on enter press.
+     */
     private onEnterKeyDown = (e: React.KeyboardEvent) => {
         if (e.keyCode === 13) {
             const submittedTitle = this.roomText!.value;
-            this.roomText!.value = "";
+            this.roomText!.value = '';
             this.roomText!.blur();
             initialize(submittedTitle, this.changeUILook);
         }
-    }
-
+    };
 
-    public static LayoutString(fieldKey: string) { return FieldView.LayoutString(DashWebRTCVideo, fieldKey); }
+    public static LayoutString(fieldKey: string) {
+        return FieldView.LayoutString(DashWebRTCVideo, fieldKey);
+    }
 
     @action
     onClickRefresh = () => {
         refreshVideos();
-    }
+    };
 
     onClickHangUp = () => {
         hangup();
-    }
+    };
 
     render() {
-        const content =
-            <div className="webcam-cont" style={{ width: "100%", height: "100%" }}>
+        const content = (
+            <div className="webcam-cont" style={{ width: '100%', height: '100%' }}>
                 <div className="webcam-header">DashWebRTC</div>
-                <input id="roomName" type="text" placeholder="Enter room name" ref={(e) => this.roomText = e!} onKeyDown={this.onEnterKeyDown} />
+                <input id="roomName" type="text" placeholder="Enter room name" ref={e => (this.roomText = e!)} onKeyDown={this.onEnterKeyDown} />
                 <div className="videoContainer">
-                    <video id="localVideo" className={"RTCVideo" + (this.remoteVideoAdded ? " side" : " main")} autoPlay playsInline muted ref={(e) => {
-                    }}></video>
-                    <video id="remoteVideo" className="RTCVideo main" autoPlay playsInline ref={(e) => {
-                    }}></video>
+                    <video id="localVideo" className={'RTCVideo' + (this.remoteVideoAdded ? ' side' : ' main')} autoPlay playsInline muted ref={e => {}}></video>
+                    <video id="remoteVideo" className="RTCVideo main" autoPlay playsInline ref={e => {}}></video>
                 </div>
                 <div className="buttonContainer">
-                    <div className="videoButtons" style={{ background: "red" }} onClick={this.onClickHangUp}><FontAwesomeIcon icon={faPhoneSlash as IconLookup} color="white" /></div>
-                    <div className="videoButtons" style={{ background: "green" }} onClick={this.onClickRefresh}><FontAwesomeIcon icon={faSync as IconLookup} color="white" /></div>
+                    <div className="videoButtons" style={{ background: 'red' }} onClick={this.onClickHangUp}>
+                        <FontAwesomeIcon icon={faPhoneSlash as IconLookup} color="white" />
+                    </div>
+                    <div className="videoButtons" style={{ background: 'green' }} onClick={this.onClickRefresh}>
+                        <FontAwesomeIcon icon={faSync as IconLookup} color="white" />
+                    </div>
                 </div>
-            </div >;
+            </div>
+        );
 
         const frozen = !this.props.isSelected() || DocumentDecorations.Instance.Interacting;
-        const classname = "webBox-cont" + (this.props.isSelected() && CurrentUserUtils.ActiveTool === InkTool.None && !DocumentDecorations.Instance.Interacting ? "-interactive" : "");
+        const classname = 'webBox-cont' + (this.props.isSelected() && Doc.ActiveTool === InkTool.None && !DocumentDecorations.Instance.Interacting ? '-interactive' : '');
 
         return (
             <>
-                <div className={classname}  >
-                    {content}
-                </div>
-                {!frozen ? (null) : <div className="webBox-overlay" />}
-            </>);
+                <div className={classname}>{content}</div>
+                {!frozen ? null : <div className="webBox-overlay" />}
+            </>
+        );
     }
-
-
-}
\ No newline at end of file
+}
-- 
cgit v1.2.3-70-g09d2

