aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Main.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-08-03 09:01:29 -0400
committerbobzel <zzzman@gmail.com>2022-08-03 09:01:29 -0400
commit9c26b676be062f9bd0f1ab66f8ba40fc9ec85d42 (patch)
treeba6f48f871ddc356fdf7fd51ce2465c6d9f80c69 /src/client/views/Main.tsx
parentc1cd00c7664df694b867f4989a1f61d959390742 (diff)
parent85dade366a9517796d1d80cee2be022d5cacdc93 (diff)
Merge branch 'master' into parker
Diffstat (limited to 'src/client/views/Main.tsx')
-rw-r--r--src/client/views/Main.tsx67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 31fa5b157..4cb1183d0 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -4,42 +4,45 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
-import { AssignAllExtensions } from "../../extensions/General/Extensions";
-import { Docs } from "../documents/Documents";
-import { CurrentUserUtils } from "../util/CurrentUserUtils";
-import { LinkManager } from "../util/LinkManager";
+import { AssignAllExtensions } from '../../extensions/General/Extensions';
+import { Utils } from '../../Utils';
+import { DocServer } from '../DocServer';
+import { Docs } from '../documents/Documents';
+import { CurrentUserUtils } from '../util/CurrentUserUtils';
+import { LinkManager } from '../util/LinkManager'; // this must come before importing Docs and CurrentUserUtils
import { ReplayMovements } from '../util/ReplayMovements';
-import { TrackMovements } from "../util/TrackMovements";
-import { CollectionView } from "./collections/CollectionView";
-import { MainView } from "./MainView";
+import { TrackMovements } from '../util/TrackMovements';
+import { CollectionView } from './collections/CollectionView';
+import { MainView } from './MainView';
AssignAllExtensions();
(async () => {
- MainView.Live = window.location.search.includes("live");
- window.location.search.includes("safe") && CollectionView.SetSafeMode(true);
+ MainView.Live = window.location.search.includes('live');
+ window.location.search.includes('safe') && CollectionView.SetSafeMode(true);
const info = await CurrentUserUtils.loadCurrentUser();
- if (info.id !== "__guest__") {
- // a guest will not have an id registered
- await CurrentUserUtils.loadUserDocument(info.id);
- } else {
- await Docs.Prototypes.initialize();
+ if (info.email === 'guest') DocServer.Control.makeReadOnly();
+ await CurrentUserUtils.loadUserDocument(info.id);
+ setTimeout(() => {
+ document.getElementById('root')!.addEventListener(
+ 'wheel',
+ event => {
+ if (event.ctrlKey) {
+ event.preventDefault();
+ }
+ },
+ true
+ );
+ const startload = (document as any).startLoad;
+ const loading = Date.now() - (startload ? Number(startload) : Date.now() - 3000);
+ console.log('Loading Time = ' + loading);
+ const d = new Date();
+ d.setTime(d.getTime() + 100 * 24 * 60 * 60 * 1000);
+ const expires = 'expires=' + d.toUTCString();
+ document.cookie = `loadtime=${loading};${expires};path=/`;
new LinkManager();
- }
- document.getElementById('root')!.addEventListener('wheel', event => {
- if (event.ctrlKey) {
- event.preventDefault();
- }
- }, true);
- const startload = (document as any).startLoad;
- const loading = Date.now() - (startload ? Number(startload) : (Date.now() - 3000));
- console.log("Load Time = " + loading);
- const d = new Date();
- d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000));
- const expires = "expires=" + d.toUTCString();
- document.cookie = `loadtime=${loading};${expires};path=/`;
- new LinkManager();
- new TrackMovements();
- new ReplayMovements();
- ReactDOM.render(<MainView />, document.getElementById('root'));
-})(); \ No newline at end of file
+ new TrackMovements();
+ new ReplayMovements();
+ ReactDOM.render(<MainView />, document.getElementById('root'));
+ }, 0);
+})();