aboutsummaryrefslogtreecommitdiff
path: root/src/client/util
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-12-14 00:07:52 -0500
committerbobzel <zzzman@gmail.com>2023-12-14 00:07:52 -0500
commitcebe9d2a567c20b99c8c394cfa598ee9d4d53ece (patch)
treec33df9a3dc80cb199002610cc38645976023eff9 /src/client/util
parent1cf241544f8063e3d71406238a584299b6ced794 (diff)
a bunch more fixes to making things observable. fixed calling super.componentDidUpdate on subsclasses
Diffstat (limited to 'src/client/util')
-rw-r--r--src/client/util/BranchingTrailManager.tsx12
-rw-r--r--src/client/util/CaptureManager.tsx3
-rw-r--r--src/client/util/GroupManager.tsx6
-rw-r--r--src/client/util/PingManager.ts3
-rw-r--r--src/client/util/RTFMarkup.tsx3
-rw-r--r--src/client/util/ReplayMovements.ts3
-rw-r--r--src/client/util/SelectionManager.ts10
-rw-r--r--src/client/util/ServerStats.tsx3
-rw-r--r--src/client/util/SharingManager.tsx3
-rw-r--r--src/client/util/TrackMovements.ts4
-rw-r--r--src/client/util/reportManager/ReportManager.tsx3
11 files changed, 30 insertions, 23 deletions
diff --git a/src/client/util/BranchingTrailManager.tsx b/src/client/util/BranchingTrailManager.tsx
index a224b84f4..11f16493f 100644
--- a/src/client/util/BranchingTrailManager.tsx
+++ b/src/client/util/BranchingTrailManager.tsx
@@ -1,4 +1,4 @@
-import { action, computed, observable } from 'mobx';
+import { action, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { Doc } from '../../fields/Doc';
@@ -15,13 +15,14 @@ export class BranchingTrailManager extends React.Component {
constructor(props: any) {
super(props);
+ makeObservable(this);
if (!BranchingTrailManager.Instance) {
BranchingTrailManager.Instance = this;
}
}
setupUi = () => {
- OverlayView.Instance.addWindow(<BranchingTrailManager></BranchingTrailManager>, { x: 100, y: 150, width: 1000, title: 'Branching Trail'});
+ OverlayView.Instance.addWindow(<BranchingTrailManager></BranchingTrailManager>, { x: 100, y: 150, width: 1000, title: 'Branching Trail' });
// OverlayView.Instance.forceUpdate();
console.log(OverlayView.Instance);
// let hi = Docs.Create.TextDocument("beee", {
@@ -30,11 +31,10 @@ export class BranchingTrailManager extends React.Component {
// })
// hi.overlayX = 100;
// hi.overlayY = 100;
-
+
// Doc.AddToMyOverlay(hi);
console.log(DocumentManager._overlayViews);
};
-
// stack of the history
@observable private slideHistoryStack: String[] = [];
@@ -69,7 +69,7 @@ export class BranchingTrailManager extends React.Component {
if (this.prevPresId === null || this.prevPresId !== presId) {
Doc.UserDoc().isBranchingMode = true;
this.setPrevPres(presId);
-
+
// REVERT THE SET
const stringified = [presId, targetDocId].toString();
if (this.containsSet.has([presId, targetDocId].toString())) {
@@ -98,7 +98,7 @@ export class BranchingTrailManager extends React.Component {
const newStack = this.slideHistoryStack.slice(0, removeIndex);
const removed = this.slideHistoryStack.slice(removeIndex);
-
+
this.setSlideHistoryStack(newStack);
removed.forEach(info => this.containsSet.delete(info.toString()));
diff --git a/src/client/util/CaptureManager.tsx b/src/client/util/CaptureManager.tsx
index 271cf7495..071fc1ee9 100644
--- a/src/client/util/CaptureManager.tsx
+++ b/src/client/util/CaptureManager.tsx
@@ -1,5 +1,5 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { action, computed, observable } from 'mobx';
+import { action, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { Doc } from '../../fields/Doc';
@@ -20,6 +20,7 @@ export class CaptureManager extends React.Component<{}> {
constructor(props: {}) {
super(props);
+ makeObservable(this);
CaptureManager.Instance = this;
}
diff --git a/src/client/util/GroupManager.tsx b/src/client/util/GroupManager.tsx
index c8c93b7d0..90f65b648 100644
--- a/src/client/util/GroupManager.tsx
+++ b/src/client/util/GroupManager.tsx
@@ -1,6 +1,6 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button, IconButton, Size, Type } from 'browndash-components';
-import { action, computed, observable } from 'mobx';
+import { action, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import Select from 'react-select';
@@ -17,6 +17,7 @@ import './GroupManager.scss';
import { GroupMemberView } from './GroupMemberView';
import { SettingsManager } from './SettingsManager';
import { SharingManager, User } from './SharingManager';
+import { ObservableReactComponent } from '../views/ObservableReactComponent';
/**
* Interface for options for the react-select component
@@ -27,7 +28,7 @@ export interface UserOptions {
}
@observer
-export class GroupManager extends React.Component<{}> {
+export class GroupManager extends ObservableReactComponent<{}> {
static Instance: GroupManager;
@observable isOpen: boolean = false; // whether the GroupManager is to be displayed or not.
@observable private users: string[] = []; // list of users populated from the database.
@@ -41,6 +42,7 @@ export class GroupManager extends React.Component<{}> {
constructor(props: Readonly<{}>) {
super(props);
+ makeObservable(this);
GroupManager.Instance = this;
}
diff --git a/src/client/util/PingManager.ts b/src/client/util/PingManager.ts
index 4dd2fcd35..865f8bc02 100644
--- a/src/client/util/PingManager.ts
+++ b/src/client/util/PingManager.ts
@@ -1,4 +1,4 @@
-import { action, observable, runInAction } from 'mobx';
+import { action, makeObservable, observable, runInAction } from 'mobx';
import { Networking } from '../Network';
import { CurrentUserUtils } from './CurrentUserUtils';
export class PingManager {
@@ -33,6 +33,7 @@ export class PingManager {
private _interval: NodeJS.Timeout | null = null;
INTERVAL_SECONDS = 1;
constructor() {
+ makeObservable(this);
PingManager._instance = this;
this._interval = setInterval(this.sendPing, this.INTERVAL_SECONDS * 1000);
}
diff --git a/src/client/util/RTFMarkup.tsx b/src/client/util/RTFMarkup.tsx
index 495af6abd..f96d8a5df 100644
--- a/src/client/util/RTFMarkup.tsx
+++ b/src/client/util/RTFMarkup.tsx
@@ -1,4 +1,4 @@
-import { action, computed, observable } from 'mobx';
+import { action, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { MainViewModal } from '../views/MainViewModal';
@@ -23,6 +23,7 @@ export class RTFMarkup extends React.Component<{}> {
constructor(props: {}) {
super(props);
+ makeObservable(this);
RTFMarkup.Instance = this;
}
diff --git a/src/client/util/ReplayMovements.ts b/src/client/util/ReplayMovements.ts
index d99630f82..b881f18b4 100644
--- a/src/client/util/ReplayMovements.ts
+++ b/src/client/util/ReplayMovements.ts
@@ -1,4 +1,4 @@
-import { IReactionDisposer, observable, reaction } from 'mobx';
+import { IReactionDisposer, makeObservable, observable, reaction } from 'mobx';
import { Doc, IdToDoc } from '../../fields/Doc';
import { CollectionDockingView } from '../views/collections/CollectionDockingView';
import { CollectionFreeFormView } from '../views/collections/collectionFreeForm';
@@ -19,6 +19,7 @@ export class ReplayMovements {
return ReplayMovements._instance;
}
constructor() {
+ makeObservable(this);
// init the global instance
ReplayMovements._instance = this;
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index 4bd6647c0..07bbde36c 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -31,8 +31,7 @@ export class SelectionManager {
this.Instance.SelectedSchemaDocument = doc;
};
- @action
- public static SelectView = (docView: DocumentView | undefined, extendSelection: boolean): void => {
+ public static SelectView = action((docView: DocumentView | undefined, extendSelection: boolean): void => {
if (!docView) this.DeselectAll();
else if (!docView.SELECTED) {
if (!extendSelection) this.DeselectAll();
@@ -40,16 +39,15 @@ export class SelectionManager {
docView.SELECTED = true;
docView._props.whenChildContentsActiveChanged(true);
}
- };
+ });
- @action
- public static DeselectView = (docView?: DocumentView): void => {
+ public static DeselectView = action((docView?: DocumentView): void => {
if (docView && this.Instance.SelectedViews.includes(docView)) {
docView.SELECTED = false;
this.Instance.SelectedViews.splice(this.Instance.SelectedViews.indexOf(docView), 1);
docView._props.whenChildContentsActiveChanged(false);
}
- };
+ });
public static DeselectAll = (except?: Doc): void => {
const found = this.Instance.SelectedViews.find(dv => dv.Document === except);
diff --git a/src/client/util/ServerStats.tsx b/src/client/util/ServerStats.tsx
index 7d5e0458d..c8df9182d 100644
--- a/src/client/util/ServerStats.tsx
+++ b/src/client/util/ServerStats.tsx
@@ -1,4 +1,4 @@
-import { action, computed, observable } from 'mobx';
+import { action, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { MainViewModal } from '../views/MainViewModal';
@@ -33,6 +33,7 @@ export class ServerStats extends React.Component<{}> {
constructor(props: {}) {
super(props);
+ makeObservable(this);
ServerStats.Instance = this;
}
diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx
index 7176b568e..ac7de9872 100644
--- a/src/client/util/SharingManager.tsx
+++ b/src/client/util/SharingManager.tsx
@@ -1,7 +1,7 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button, IconButton, Size, Type } from 'browndash-components';
import { concat, intersection } from 'lodash';
-import { action, computed, observable, runInAction } from 'mobx';
+import { action, computed, makeObservable, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import Select from 'react-select';
@@ -119,6 +119,7 @@ export class SharingManager extends React.Component<{}> {
constructor(props: {}) {
super(props);
+ makeObservable(this);
SharingManager.Instance = this;
}
diff --git a/src/client/util/TrackMovements.ts b/src/client/util/TrackMovements.ts
index 0e56ee1bc..0b197cf9a 100644
--- a/src/client/util/TrackMovements.ts
+++ b/src/client/util/TrackMovements.ts
@@ -1,4 +1,4 @@
-import { IReactionDisposer, observable, observe, reaction } from 'mobx';
+import { IReactionDisposer, makeObservable, observable, observe, reaction } from 'mobx';
import { NumCast } from '../../fields/Types';
import { Doc, DocListCast } from '../../fields/Doc';
import { CollectionDockingView } from '../views/collections/CollectionDockingView';
@@ -40,7 +40,7 @@ export class TrackMovements {
constructor() {
// init the global instance
TrackMovements._instance = this;
-
+ makeObservable(this);
// init the instance variables
this.currentPresentation = TrackMovements.NULL_PRESENTATION;
this.tracking = false;
diff --git a/src/client/util/reportManager/ReportManager.tsx b/src/client/util/reportManager/ReportManager.tsx
index 738902a31..0c49aeed4 100644
--- a/src/client/util/reportManager/ReportManager.tsx
+++ b/src/client/util/reportManager/ReportManager.tsx
@@ -3,7 +3,7 @@ import * as uuid from 'uuid';
import '.././SettingsManager.scss';
import './ReportManager.scss';
import ReactLoading from 'react-loading';
-import { action, observable } from 'mobx';
+import { action, makeObservable, observable } from 'mobx';
import { BsX, BsArrowsAngleExpand, BsArrowsAngleContract } from 'react-icons/bs';
import { CgClose } from 'react-icons/cg';
import { HiOutlineArrowLeft } from 'react-icons/hi';
@@ -103,6 +103,7 @@ export class ReportManager extends React.Component<{}> {
constructor(props: {}) {
super(props);
+ makeObservable(this);
ReportManager.Instance = this;
// initializing Github connection