aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/views/Main.tsx14
-rw-r--r--src/client/views/collections/CollectionView.tsx4
2 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index fdbad6ce1..cb49bc4e6 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -73,8 +73,6 @@ export class Main extends React.Component {
return CurrentUserUtils.UserDocument;
}
- public mainDocId: string | undefined;
- private currentUser?: DashUserModel;
public static Instance: Main;
constructor(props: Readonly<{}>) {
@@ -85,7 +83,7 @@ export class Main extends React.Component {
if (window.location.pathname !== RouteStore.home) {
let pathname = window.location.pathname.split("/");
if (pathname.length > 1 && pathname[pathname.length - 2] == 'doc') {
- this.mainDocId = pathname[pathname.length - 1];
+ CurrentUserUtils.MainDocId = pathname[pathname.length - 1];
}
};
@@ -117,8 +115,8 @@ export class Main extends React.Component {
onHistory = () => {
if (window.location.pathname !== RouteStore.home) {
let pathname = window.location.pathname.split("/");
- this.mainDocId = pathname[pathname.length - 1];
- Server.GetField(this.mainDocId, action((field: Opt<Field>) => {
+ CurrentUserUtils.MainDocId = pathname[pathname.length - 1];
+ Server.GetField(CurrentUserUtils.MainDocId, action((field: Opt<Field>) => {
if (field instanceof Document) {
this.openWorkspace(field, true);
}
@@ -148,7 +146,7 @@ export class Main extends React.Component {
initAuthenticationRouters = () => {
// Load the user's active workspace, or create a new one if initial session after signup
- if (!this.mainDocId) {
+ if (!CurrentUserUtils.MainDocId) {
this.userDocument.GetTAsync(KeyStore.ActiveWorkspace, Document).then(doc => {
if (doc) {
this.openWorkspace(doc);
@@ -157,11 +155,11 @@ export class Main extends React.Component {
}
})
} else {
- Server.GetField(this.mainDocId).then(field => {
+ Server.GetField(CurrentUserUtils.MainDocId).then(field => {
if (field instanceof Document) {
this.openWorkspace(field)
} else {
- this.createNewWorkspace(this.mainDocId);
+ this.createNewWorkspace(CurrentUserUtils.MainDocId);
}
})
}
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 7e1d31018..c72633175 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -13,7 +13,7 @@ import { CollectionSchemaView } from "./CollectionSchemaView";
import { CollectionViewProps } from "./CollectionViewBase";
import { CollectionTreeView } from "./CollectionTreeView";
import { Field, FieldId, FieldWaiting } from "../../../fields/Field";
-import { Main } from "../Main";
+import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils";
export enum CollectionViewType {
Invalid,
@@ -96,7 +96,7 @@ export class CollectionView extends React.Component<CollectionViewProps> {
}
specificContextMenu = (e: React.MouseEvent): void => {
- if (!e.isPropagationStopped() && this.props.Document.Id != Main.Instance.mainDocId) { // need to test this because GoldenLayout causes a parallel hierarchy in the React DOM for its children and the main document view7
+ if (!e.isPropagationStopped() && this.props.Document.Id != CurrentUserUtils.MainDocId) { // need to test this because GoldenLayout causes a parallel hierarchy in the React DOM for its children and the main document view7
ContextMenu.Instance.addItem({ description: "Freeform", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Freeform) })
ContextMenu.Instance.addItem({ description: "Schema", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Schema) })
ContextMenu.Instance.addItem({ description: "Treeview", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Tree) })