diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 2 | ||||
-rw-r--r-- | src/client/util/CurrentUserUtils.ts | 2 | ||||
-rw-r--r-- | src/client/views/InkStrokeProperties.ts | 2 | ||||
-rw-r--r-- | src/client/views/MainView.tsx | 2 | ||||
-rw-r--r-- | src/client/views/PropertiesView.tsx | 10 | ||||
-rw-r--r-- | src/client/views/collections/CollectionStackedTimeline.tsx | 2 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 1 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx | 6 | ||||
-rw-r--r-- | src/client/views/nodes/MapBox/MapBox.tsx | 34 | ||||
-rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 10 | ||||
-rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 2 | ||||
-rw-r--r-- | src/fields/Doc.ts | 2 | ||||
-rw-r--r-- | src/server/ApiManagers/UserManager.ts | 10 | ||||
-rw-r--r-- | src/server/websocket.ts | 13 |
14 files changed, 59 insertions, 39 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 80c3f9168..df573a377 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -1426,7 +1426,7 @@ export namespace DocUtils { function ConvertDMSToDD(degrees: number, minutes: number, seconds: number, direction: string) { var dd = degrees + minutes / 60 + seconds / (60 * 60); - if (direction == "S" || direction == "W") { + if (direction === "S" || direction === "W") { dd = dd * -1; } // Don't do anything for N or E return dd; diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 90b43c415..a8b0da369 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -1164,7 +1164,7 @@ export class CurrentUserUtils { dontUndo: true, title, color: Colors.WHITE, - backgroundColor: "transparent", + backgroundColor: checkResult ? ComputedField.MakeFunction(checkResult) as any : "transparent", _dropAction: "alias", hidden: hidden ? ComputedField.MakeFunction(hidden) as any : undefined, _removeDropProperties: new List<string>(["dropAction", "_stayInCollection"]), diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts index cab4e1216..41cace1e3 100644 --- a/src/client/views/InkStrokeProperties.ts +++ b/src/client/views/InkStrokeProperties.ts @@ -251,7 +251,7 @@ export class InkStrokeProperties { samplesLeft.push(new Point(pt.x, pt.y)); } } - var { finalCtrls, error } = FitOneCurve(samplesLeft, { X: startDir.x, Y: startDir.y }, { X: endDir.x, Y: endDir.y }); + var { finalCtrls } = FitOneCurve(samplesLeft, { X: startDir.x, Y: startDir.y }, { X: endDir.x, Y: endDir.y }); for (var i = nearestSeg / 4; i < splicedPoints.length / 4; i++) { const bez = new Bezier(splicedPoints.slice(i * 4, i * 4 + 4).map(p => ({ x: p.X, y: p.Y }))); if (i === nearestSeg / 4) startDir = bez.derivative(nearestT); diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 9875b0fab..fc1c694a2 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -181,7 +181,7 @@ export class MainView extends React.Component { fa.faIndent, fa.faEyeDropper, fa.faPaintRoller, fa.faBars, fa.faBrush, fa.faShapes, fa.faEllipsisH, fa.faHandPaper, fa.faMap, fa.faUser, faHireAHelper as any, fa.faTrashRestore, fa.faUsers, fa.faWrench, fa.faCog, fa.faMap, fa.faBellSlash, fa.faExpandAlt, fa.faArchive, fa.faBezierCurve, fa.faCircle, far.faCircle as any, fa.faLongArrowAltRight, fa.faPenFancy, fa.faAngleDoubleRight, faBuffer as any, fa.faExpand, fa.faUndo, fa.faSlidersH, fa.faAngleDoubleLeft, fa.faAngleUp, - fa.faAngleDown, fa.faPlayCircle, fa.faClock, fa.faRocket, fa.faExchangeAlt, faBuffer as any, fa.faHashtag, fa.faAlignJustify, fa.faCheckSquare, fa.faListUl, + fa.faAngleDown, fa.faPlayCircle, fa.faClock, fa.faRocket, fa.faExchangeAlt, fa.faHashtag, fa.faAlignJustify, fa.faCheckSquare, fa.faListUl, fa.faWindowMinimize, fa.faWindowRestore, fa.faTextWidth, fa.faTextHeight, fa.faClosedCaptioning, fa.faInfoCircle, fa.faTag, fa.faSyncAlt, fa.faPhotoVideo, fa.faArrowAltCircleDown, fa.faArrowAltCircleUp, fa.faArrowAltCircleLeft, fa.faArrowAltCircleRight, fa.faStopCircle, fa.faCheckCircle, fa.faGripVertical, fa.faSortUp, fa.faSortDown, fa.faTable, fa.faTh, fa.faThList, fa.faProjectDiagram, fa.faSignature, fa.faColumns, fa.faChevronCircleUp, fa.faUpload, fa.faBorderAll, diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index f38341603..f53944805 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -1,6 +1,6 @@ import React = require("react"); +import { faAnchor, faArrowRight } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faAnchor, faArrowRight } from '@fortawesome/free-solid-svg-icons' import { Checkbox, Tooltip } from "@material-ui/core"; import { intersection } from "lodash"; import { action, autorun, computed, Lambda, observable } from "mobx"; @@ -17,6 +17,7 @@ import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, retu import { DocumentType } from "../documents/DocumentTypes"; import { CurrentUserUtils } from "../util/CurrentUserUtils"; import { DocumentManager } from "../util/DocumentManager"; +import { LinkManager } from "../util/LinkManager"; import { SelectionManager } from "../util/SelectionManager"; import { SharingManager } from "../util/SharingManager"; import { Transform } from "../util/Transform"; @@ -27,12 +28,11 @@ import { EditableView } from "./EditableView"; import { InkStrokeProperties } from "./InkStrokeProperties"; import { DocumentView, StyleProviderFunc } from "./nodes/DocumentView"; import { KeyValueBox } from "./nodes/KeyValueBox"; -import { PresBox } from "./nodes/trails/PresBox"; import { PropertiesButtons } from "./PropertiesButtons"; import { PropertiesDocContextSelector } from "./PropertiesDocContextSelector"; import "./PropertiesView.scss"; import { DefaultStyleProvider } from "./StyleProvider"; -import { LinkManager } from "../util/LinkManager"; +import { PresBox } from "./nodes/trails"; const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -1218,7 +1218,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { onChange={e => this.handleLinkRelationshipChange(e.currentTarget.value)} className="text" type="text" - /> + />; } @computed @@ -1232,7 +1232,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { onChange={e => this.handleDescriptionChange(e.currentTarget.value)} className="text" type="text" - /> + />; } /** diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx index 793e01822..7d9dc39ae 100644 --- a/src/client/views/collections/CollectionStackedTimeline.tsx +++ b/src/client/views/collections/CollectionStackedTimeline.tsx @@ -791,7 +791,7 @@ class StackedTimelineAnchor extends React.Component<StackedTimelineAnchorProps> DocListCast(this.props.mark.links).length && time > NumCast(this.props.mark[this.props.startTag]) && time < NumCast(this.props.mark[this.props.endTag]) && - this._lastTimecode < NumCast(this.props.mark[this.props.startTag]) + this._lastTimecode < NumCast(this.props.mark[this.props.startTag]) - 1e-5 ) { LinkManager.FollowLink( undefined, diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index fc1bcb8b9..34209ebc9 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -446,6 +446,7 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?: generatedDocuments.push(...await DocUtils.uploadFilesToDocs(files, options)); } if (generatedDocuments.length) { + // Creating a dash document const isFreeformView = this.props.Document._viewType === CollectionViewType.Freeform; const set = !isFreeformView ? generatedDocuments : generatedDocuments.length > 1 ? generatedDocuments.map(d => { DocUtils.iconify(d); return d; }) : []; diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx index c35bb3581..f5a5492e3 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinkView.tsx @@ -150,8 +150,8 @@ export class CollectionFreeFormLinkView extends React.Component<CollectionFreeFo } onClickLine = () => { - SelectionManager.SelectSchemaViewDoc(this.props.LinkDocs[0], true) - this.toggleProperties() + SelectionManager.SelectSchemaViewDoc(this.props.LinkDocs[0], true); + this.toggleProperties(); } // componentToHex = (c: number) => { @@ -249,7 +249,7 @@ export class CollectionFreeFormLinkView extends React.Component<CollectionFreeFo //thickness varies linearly from 3px to 12px for increasing link count const strokeWidth = linkSize === -1 ? "3px" : Math.floor(2 + 10 * (linkSize / Math.max(...linkRelationshipSizes))) + "px"; - if (this.props.LinkDocs[0].displayArrow == undefined) { + if (this.props.LinkDocs[0].displayArrow === undefined) { this.props.LinkDocs[0].displayArrow = false; } diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx index e80ad8acd..50444c73a 100644 --- a/src/client/views/nodes/MapBox/MapBox.tsx +++ b/src/client/views/nodes/MapBox/MapBox.tsx @@ -57,9 +57,9 @@ const defaultCenter = { const mapOptions = { fullscreenControl: false, -} +}; -dotenv.config({ path: __dirname + '/.env' }) +dotenv.config({ path: __dirname + '/.env' }); const apiKey = process.env.GOOGLE_MAPS; const script = document.createElement('script'); @@ -115,8 +115,8 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps @observable private searchMarkers: google.maps.Marker[] = []; @observable private searchBox = new window.google.maps.places.Autocomplete(this.inputRef.current!, options); @observable private _savedAnnotations = new ObservableMap<number, HTMLDivElement[]>(); - @computed get allSidebarDocs() { return DocListCast(this.dataDoc[this.SidebarKey]); }; - @computed get allMapMarkers() { return DocListCast(this.dataDoc[this.annotationKey]); }; + @computed get allSidebarDocs() { return DocListCast(this.dataDoc[this.SidebarKey]); } + @computed get allMapMarkers() { return DocListCast(this.dataDoc[this.annotationKey]); } @observable private toggleAddMarker = false; private _mainCont: React.RefObject<HTMLDivElement> = React.createRef(); @@ -155,7 +155,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps */ private CenterControl = () => { const controlDiv = document.createElement("div"); - controlDiv.className = "mapBox-addMarker" + controlDiv.className = "mapBox-addMarker"; // Set CSS for the control border. const controlUI = document.createElement("div"); controlUI.style.backgroundColor = "#fff"; @@ -201,7 +201,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps // Setup the click event listeners controlUI.addEventListener("click", () => { - if (this.toggleAddMarker == true) { + if (this.toggleAddMarker === true) { this.toggleAddMarker = false; console.log("add marker button status:" + this.toggleAddMarker); controlUI.style.backgroundColor = "#fff"; @@ -211,7 +211,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps console.log("add marker button status:" + this.toggleAddMarker); controlUI.style.backgroundColor = "#4476f7"; markerIcon.style.color = "rgb(255,255,255)"; - }; + } }); controlDiv.appendChild(controlUI); return controlDiv; @@ -271,10 +271,10 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps }, 250); // listener to addmarker event this._map.addListener('click', (e: MouseEvent) => { - if (this.toggleAddMarker == true) { + if (this.toggleAddMarker === true) { this.placeMarker((e as any).latLng, map); } - }) + }); } @action @@ -328,10 +328,10 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps console.log("print all sidebar Docs"); console.log(this.allSidebarDocs); if (!this.layoutDoc._showSidebar) this.toggleSidebar(); - const docs = doc instanceof Doc ? [doc] : doc + const docs = doc instanceof Doc ? [doc] : doc; docs.forEach(doc => { if (doc.lat !== undefined && doc.lng !== undefined) { - const existingMarker = this.allMapMarkers.find(marker => marker.lat === doc.lat && marker.lng == doc.lng); + const existingMarker = this.allMapMarkers.find(marker => marker.lat === doc.lat && marker.lng === doc.lng); doc.onClickBehavior = "enterPortal"; if (existingMarker) { Doc.AddDocToList(existingMarker, "data", doc); @@ -340,7 +340,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps this.addDocument(marker, this.annotationKey); } } - }) //add to annotation list + }); //add to annotation list console.log("sidebaraddDocument"); console.log(doc); @@ -359,7 +359,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps docs.forEach(doc => { console.log(this.allMapMarkers); console.log(this.allSidebarDocs); - }) + }); return this.removeDocument(doc, sidebarKey); } @@ -432,7 +432,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps title: place.name, position: place.geometry.location, }) - ) + ); } /** @@ -498,7 +498,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps @computed get annotationLayer() { const pe = this.props.isContentActive() && this.props.pointerEvents !== "none" && !MarqueeOptionsMenu.Instance.isShown() ? "all" : - SnappingManager.GetIsDragging() ? undefined : "none" + SnappingManager.GetIsDragging() ? undefined : "none"; return <div className="mapBox-annotationLayer" style={{ height: Doc.NativeHeight(this.Document) || undefined }} ref={this._annotationLayer}> {this.inlineTextAnnotations.sort((a, b) => NumCast(a.y) - NumCast(b.y)).map(anno => <Annotation key={`${anno[Id]}-annotation`} {...this.props} @@ -509,7 +509,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps getAnchor = () => { const anchor = AnchorMenu.Instance?.GetAnchor(this._savedAnnotations) ?? - this.rootDoc + this.rootDoc; return anchor; } @@ -525,7 +525,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps onLoad={marker => this.markerLoadHandler(marker, place)} onClick={(e: google.maps.MapMouseEvent) => this.markerClickHandler(e, place)} /> - )) + )); } // TODO: auto center on select a document in the sidebar diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index c8e0cdb66..56cb562bc 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -168,8 +168,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp } this._youtubePlayer && SelectionManager.DeselectAll(); // if we don't deselect the player, then we get an annoying YouTube spinner I guess telling us we're paused. this._playTimer = undefined; - this.updateTimecode(); - if (!this._finished) clearTimeout(this._playRegionTimer);; + this.props.renderDepth !== -1 && this.updateTimecode(); } @action public FullScreen = () => { @@ -701,7 +700,12 @@ export class VideoBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp Pause={this.Pause} playLink={this.playLink} PanelHeight={this.timelineHeight} - rawDuration={this.rawDuration} + trimming={false} + trimStart={0} + trimEnd={this.duration} + trimDuration={this.duration} + setStartTrim={emptyFunction} + setEndTrim={emptyFunction} /> </div>; } diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 4a6af86c1..311d52afa 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -120,7 +120,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp public ProseRef?: HTMLDivElement; public get EditorView() { return this._editorView; } public get SidebarKey() { return this.fieldKey + "-sidebar"; } - @computed get allSidebarDocs() { return DocListCast(this.dataDoc[this.SidebarKey]); }; + @computed get allSidebarDocs() { return DocListCast(this.dataDoc[this.SidebarKey]); } @computed get sidebarWidthPercent() { return this._showSidebar ? "20%" : StrCast(this.layoutDoc._sidebarWidthPercent, "0%"); } @computed get sidebarColor() { return StrCast(this.layoutDoc.sidebarColor, StrCast(this.layoutDoc[this.props.fieldKey + "-backgroundColor"], "#e4e4e4")); } diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 6fe86d0fe..c15d4b4af 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1242,7 +1242,7 @@ export namespace Doc { case DocumentType.INK: return "pen-nib"; case DocumentType.PDF: return "file-pdf"; case DocumentType.LINK: return "link"; - case DocumentType.MAP: return "map-marker-alt" + case DocumentType.MAP: return "map-marker-alt"; default: return "question"; } } diff --git a/src/server/ApiManagers/UserManager.ts b/src/server/ApiManagers/UserManager.ts index f36506b14..fe80c6a7c 100644 --- a/src/server/ApiManagers/UserManager.ts +++ b/src/server/ApiManagers/UserManager.ts @@ -4,6 +4,7 @@ import { Database } from "../database"; import { msToTime } from "../ActionUtilities"; import * as bcrypt from "bcrypt-nodejs"; import { Opt } from "../../fields/Doc"; +import { WebSocket } from "../websocket"; export const timeMap: { [id: string]: number } = {}; interface ActivityUnit { @@ -131,9 +132,12 @@ export default class UserManager extends ApiManager { for (const user in timeMap) { const time = timeMap[user]; - const duration = now - time; - const target = (duration / 1000) < (60 * 5) ? activeTimes : inactiveTimes; - target.push({ user, duration }); + const socketPair = Array.from(WebSocket.socketMap).find(pair => pair[1] === user); + if (socketPair && !socketPair[0].disconnected) { + const duration = now - time; + const target = (duration / 1000) < (60 * 5) ? activeTimes : inactiveTimes; + target.push({ user, duration }); + } } const process = (target: { user: string, duration: number }[]) => { diff --git a/src/server/websocket.ts b/src/server/websocket.ts index 13d7237f6..0c79c1bbb 100644 --- a/src/server/websocket.ts +++ b/src/server/websocket.ts @@ -187,7 +187,7 @@ export namespace WebSocket { + currentdate.getMinutes() + ":" + currentdate.getSeconds(); console.log(blue(`user ${userEmail} has connected to the web socket at: ${datetime}`)); - socketMap.set(socket, userEmail); + socketMap.set(socket, userEmail + " at " + datetime); } function getField([id, callback]: [string, (result?: Transferable) => void]) { @@ -338,7 +338,18 @@ export namespace WebSocket { if (!pendingOps.get(id)!.length) pendingOps.delete(id); } + function printActiveUsers() { + socketMap.forEach((user, socket) => { + !socket.disconnected && console.log(user); + }); + } + var CurUser: string | undefined = undefined; + function UpdateField(socket: Socket, diff: Diff) { + if (CurUser !== socketMap.get(socket)) { + CurUser = socketMap.get(socket); + console.log("Switch User: " + CurUser); + } if (pendingOps.has(diff.id)) { pendingOps.get(diff.id)!.push({ diff, socket }); return true; |