aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MainView.tsx
diff options
context:
space:
mode:
authorbrynnchernosky <56202540+brynnchernosky@users.noreply.github.com>2022-10-28 10:10:04 -0400
committerbrynnchernosky <56202540+brynnchernosky@users.noreply.github.com>2022-10-28 10:10:04 -0400
commitceb338752aacc383c97a0e3a9b608365a1cf39b6 (patch)
treed2f355b726a9b21950f332c0f65931d7d6eef515 /src/client/views/MainView.tsx
parent5d6a0458b9d4f35e0c568a4d76d4fcab4e22f698 (diff)
parent2fc88a931cb2fc3408297b000208990633445585 (diff)
merge
Diffstat (limited to 'src/client/views/MainView.tsx')
-rw-r--r--src/client/views/MainView.tsx93
1 files changed, 57 insertions, 36 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 45281ed69..4dc1ebd99 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -5,16 +5,17 @@ import * as fa from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, configure, observable, reaction, runInAction } from 'mobx';
import { observer } from 'mobx-react';
+import 'normalize.css';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Doc, DocListCast, Opt } from '../../fields/Doc';
import { ScriptField } from '../../fields/ScriptField';
-import { StrCast } from '../../fields/Types';
+import { DocCast, StrCast } from '../../fields/Types';
import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, returnZero, setupMoveUpEvents, simulateMouseClick, Utils } from '../../Utils';
import { GoogleAuthenticationManager } from '../apis/GoogleAuthenticationManager';
import { DocServer } from '../DocServer';
import { Docs, DocUtils } from '../documents/Documents';
-import { CollectionViewType } from '../documents/DocumentTypes';
+import { CollectionViewType, DocumentType } from '../documents/DocumentTypes';
import { CaptureManager } from '../util/CaptureManager';
import { DocumentManager } from '../util/DocumentManager';
import { GroupManager } from '../util/GroupManager';
@@ -56,6 +57,7 @@ import { LinkDescriptionPopup } from './nodes/LinkDescriptionPopup';
import { LinkDocPreview } from './nodes/LinkDocPreview';
import { RadialMenu } from './nodes/RadialMenu';
import { TaskCompletionBox } from './nodes/TaskCompletedBox';
+import { PresBox } from './nodes/trails';
import { WebBox } from './nodes/WebBox';
import { OverlayView } from './OverlayView';
import { AnchorMenu } from './pdf/AnchorMenu';
@@ -63,6 +65,7 @@ import { PreviewCursor } from './PreviewCursor';
import { PropertiesView } from './PropertiesView';
import { DashboardStyleProvider, DefaultStyleProvider } from './StyleProvider';
import { TopBar } from './topbar/TopBar';
+import 'browndash-components/dist/styles/global.min.css';
const _global = (window /* browser */ || global) /* node */ as any;
@observer
@@ -86,7 +89,7 @@ export class MainView extends React.Component {
return this._hideUI ? 0 : 27;
} // 27 comes form lm.config.defaultConfig.dimensions.headerHeight in goldenlayout.js
@computed private get topOfDashUI() {
- return this._hideUI ? 0 : Number(DASHBOARD_SELECTOR_HEIGHT.replace('px', ''));
+ return this._hideUI || LightboxView.LightboxDoc ? 0 : Number(DASHBOARD_SELECTOR_HEIGHT.replace('px', ''));
}
@computed private get topOfHeaderBarDoc() {
return this.topOfDashUI;
@@ -111,7 +114,7 @@ export class MainView extends React.Component {
}
@observable mainDoc: Opt<Doc>;
@computed private get mainContainer() {
- if (window.location.pathname.startsWith('/doc/')) {
+ if (window.location.pathname.startsWith('/doc/') && Doc.CurrentUserEmail === 'guest') {
DocServer.GetRefField(window.location.pathname.substring('/doc/'.length)).then(main => runInAction(() => (this.mainDoc = main as Doc)));
return this.mainDoc;
}
@@ -157,11 +160,15 @@ export class MainView extends React.Component {
'viewTransition',
'treeViewOpen',
'showSidebar',
+ 'itemIndex', // for changing slides in presentations
'sidebarWidthPercent',
'currentTimecode',
'timelineHeightPercent',
+ 'presStatus',
'panX',
'panY',
+ 'overlayX',
+ 'overlayY',
'fitWidth',
'nativeWidth',
'nativeHeight',
@@ -176,6 +183,7 @@ export class MainView extends React.Component {
'chromeHidden',
'currentFrame',
'width',
+ 'height',
'nativeWidth',
]); // can play with these fields on someone else's
}
@@ -227,7 +235,13 @@ export class MainView extends React.Component {
if (pathname.length > 1 && pathname[0] === 'doc') {
Doc.MainDocId = pathname[1];
//!this.userDoc &&
- DocServer.GetRefField(pathname[1]).then(action(field => field instanceof Doc && (Doc.GuestTarget = field)));
+ DocServer.GetRefField(pathname[1]).then(
+ action(field => {
+ if (field instanceof Doc && field._viewType !== CollectionViewType.Docking) {
+ Doc.GuestTarget = field;
+ }
+ })
+ );
}
}
@@ -289,6 +303,7 @@ export class MainView extends React.Component {
fa.faStop,
fa.faCalculator,
fa.faWindowMaximize,
+ fa.faIdCard,
fa.faAddressCard,
fa.faQuestionCircle,
fa.faArrowLeft,
@@ -449,6 +464,7 @@ export class MainView extends React.Component {
fa.faPhoneSlash,
fa.faGripLines,
fa.faSave,
+ fa.faBook,
fa.faBookmark,
fa.faList,
fa.faListOl,
@@ -519,11 +535,23 @@ export class MainView extends React.Component {
};
@action
- createNewPresentation = async () => {
- const pres = Docs.Create.PresDocument({ title: 'Untitled Trail', _viewType: CollectionViewType.Stacking, _fitWidth: true, _width: 400, _height: 500, targetDropAction: 'alias', _chromeHidden: true, boxShadow: '0 0' });
- CollectionDockingView.AddSplit(pres, 'left');
+ createNewPresentation = () => {
+ const pres = Doc.MakeCopy(Doc.UserDoc().emptyTrail as Doc, true);
+ CollectionDockingView.AddSplit(pres, 'right');
+ Doc.MyTrails && Doc.AddDocToList(Doc.MyTrails, 'data', pres); // Doc.MyTrails should be created in createDashboard
Doc.ActivePresentation = pres;
- Doc.AddDocToList(Doc.MyTrails, 'data', pres);
+ };
+
+ @action
+ openPresentation = (pres: Doc) => {
+ if (pres.type === DocumentType.PRES) {
+ CollectionDockingView.AddSplit(pres, 'right');
+ Doc.MyTrails && (Doc.ActivePresentation = pres);
+ Doc.AddDocToList(Doc.MyTrails, 'data', pres);
+ this.closeFlyout();
+ } else {
+ PresBox.NavigateToDoc(DocCast(pres.presentationTargetDoc), pres);
+ }
};
@action
@@ -610,7 +638,7 @@ export class MainView extends React.Component {
@computed get dockingContent() {
return (
- <GestureOverlay>
+ <GestureOverlay isActive={LightboxView.LightboxDoc ? false : true}>
<div
key="docking"
className={`mainView-dockingContent${this._leftMenuFlyoutWidth ? '-flyout' : ''}`}
@@ -619,6 +647,7 @@ export class MainView extends React.Component {
e.preventDefault();
}}
style={{
+ width: `calc(100% - ${this._leftMenuFlyoutWidth + this.leftMenuWidth() + this.propertiesWidth()}px)`,
minWidth: `calc(100% - ${this._leftMenuFlyoutWidth + this.leftMenuWidth() + this.propertiesWidth()}px)`,
transform: LightboxView.LightboxDoc ? 'scale(0.0001)' : undefined,
}}>
@@ -657,21 +686,16 @@ export class MainView extends React.Component {
const locationFields = doc._viewType === CollectionViewType.Docking ? ['dashboard'] : location.split(':');
const locationParams = locationFields.length > 1 ? locationFields[1] : '';
if (doc.dockingConfig) return DashboardView.openDashboard(doc);
+ // prettier-ignore
switch (locationFields[0]) {
- case 'dashboard':
- return DashboardView.openDashboard(doc);
- case 'close':
- return CollectionDockingView.CloseSplit(doc, locationParams);
- case 'fullScreen':
- return CollectionDockingView.OpenFullScreen(doc);
- case 'lightbox':
- return LightboxView.AddDocTab(doc, location);
- case 'toggle':
- return CollectionDockingView.ToggleSplit(doc, locationParams);
- case 'inPlace':
- case 'add':
default:
- return CollectionDockingView.AddSplit(doc, locationParams);
+ case 'inPlace':
+ case 'add': return CollectionDockingView.AddSplit(doc, locationParams);
+ case 'dashboard': return DashboardView.openDashboard(doc);
+ case 'close': return CollectionDockingView.CloseSplit(doc, locationParams);
+ case 'fullScreen': return CollectionDockingView.OpenFullScreen(doc);
+ case 'lightbox': return LightboxView.AddDocTab(doc, location);
+ case 'toggle': return CollectionDockingView.ToggleSplit(doc, locationParams);
}
};
@@ -716,7 +740,7 @@ export class MainView extends React.Component {
@computed get leftMenuPanel() {
return (
- <div key="menu" className="mainView-leftMenuPanel">
+ <div key="menu" className="mainView-leftMenuPanel" style={{ display: LightboxView.LightboxDoc ? 'none' : undefined }}>
<DocumentView
Document={Doc.MyLeftSidebarMenu}
DataDoc={undefined}
@@ -991,19 +1015,16 @@ export class MainView extends React.Component {
{LinkDocPreview.LinkInfo ? <LinkDocPreview {...LinkDocPreview.LinkInfo} /> : null}
{((page: string) => {
+ // prettier-ignore
switch (page) {
- case 'dashboard':
default:
- return (
- <>
- <div style={{ position: 'relative', display: this._hideUI || LightboxView.LightboxDoc ? 'none' : undefined, zIndex: 2001 }}>
- <CollectionMenu panelWidth={this.topMenuWidth} panelHeight={this.topMenuHeight} />
- </div>
- {this.mainDashboardArea}
- </>
- );
- case 'home':
- return <DashboardView />;
+ case 'dashboard': return (<>
+ <div key="dashdiv" style={{ position: 'relative', display: this._hideUI || LightboxView.LightboxDoc ? 'none' : undefined, zIndex: 2001 }}>
+ <CollectionMenu panelWidth={this.topMenuWidth} panelHeight={this.topMenuHeight} />
+ </div>
+ {this.mainDashboardArea}
+ </> );
+ case 'home': return <DashboardView />;
}
})(Doc.ActivePage)}
@@ -1020,7 +1041,7 @@ export class MainView extends React.Component {
<InkTranscription />
{this.snapLines}
<div className="mainView-webRef" ref={this.makeWebRef} />
- <LightboxView PanelWidth={this._windowWidth} PanelHeight={this._windowHeight} maxBorder={[200, 50]} />
+ <LightboxView key="lightbox" PanelWidth={this._windowWidth} PanelHeight={this._windowHeight} maxBorder={[200, 50]} />
</div>
);
}