aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/trails/PresElementBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/trails/PresElementBox.tsx')
-rw-r--r--src/client/views/nodes/trails/PresElementBox.tsx440
1 files changed, 250 insertions, 190 deletions
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index cc7bd5189..1a2054676 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -1,52 +1,66 @@
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { Tooltip } from "@material-ui/core";
-import { action, computed, IReactionDisposer, observable, reaction } from "mobx";
-import { observer } from "mobx-react";
-import { Doc, DocListCast, HeightSym, Opt, WidthSym } from "../../../../fields/Doc";
-import { Id } from "../../../../fields/FieldSymbols";
-import { BoolCast, Cast, DocCast, NumCast, StrCast } from "../../../../fields/Types";
-import { emptyFunction, returnEmptyDoclist, returnFalse, returnTrue, setupMoveUpEvents } from "../../../../Utils";
-import { Docs, DocUtils } from "../../../documents/Documents";
-import { DocumentType } from "../../../documents/DocumentTypes";
-import { CurrentUserUtils } from "../../../util/CurrentUserUtils";
-import { DocumentManager } from "../../../util/DocumentManager";
-import { DragManager } from "../../../util/DragManager";
-import { Transform } from "../../../util/Transform";
-import { undoBatch } from "../../../util/UndoManager";
-import { CollectionViewType } from "../../collections/CollectionView";
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { Tooltip } from '@material-ui/core';
+import { action, computed, IReactionDisposer, observable, reaction } from 'mobx';
+import { observer } from 'mobx-react';
+import { Doc, DocListCast, HeightSym, Opt, WidthSym } from '../../../../fields/Doc';
+import { Id } from '../../../../fields/FieldSymbols';
+import { List } from '../../../../fields/List';
+import { Cast, DocCast, NumCast, StrCast } from '../../../../fields/Types';
+import { emptyFunction, returnEmptyDoclist, returnFalse, returnTrue, setupMoveUpEvents } from '../../../../Utils';
+import { Docs, DocUtils } from '../../../documents/Documents';
+import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
+import { DocumentManager } from '../../../util/DocumentManager';
+import { DragManager } from '../../../util/DragManager';
+import { SettingsManager } from '../../../util/SettingsManager';
+import { Transform } from '../../../util/Transform';
+import { undoBatch } from '../../../util/UndoManager';
import { ViewBoxBaseComponent } from '../../DocComponent';
-import { EditableView } from "../../EditableView";
-import { Colors } from "../../global/globalEnums";
-import { DocumentView, DocumentViewProps } from "../../nodes/DocumentView";
+import { EditableView } from '../../EditableView';
+import { Colors } from '../../global/globalEnums';
+import { DocumentView, DocumentViewProps } from '../../nodes/DocumentView';
import { FieldView, FieldViewProps } from '../../nodes/FieldView';
-import { StyleProp } from "../../StyleProvider";
-import { PresBox } from "./PresBox";
-import "./PresElementBox.scss";
-import { PresMovement } from "./PresEnums";
-import React = require("react");
-import { List } from "../../../../fields/List";
+import { StyleProp } from '../../StyleProvider';
+import { PresBox } from './PresBox';
+import './PresElementBox.scss';
+import { PresMovement } from './PresEnums';
+import React = require('react');
/**
* This class models the view a document added to presentation will have in the presentation.
* It involves some functionality for its buttons and options.
*/
@observer
export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
- public static LayoutString(fieldKey: string) { return FieldView.LayoutString(PresElementBox, fieldKey); }
+ public static LayoutString(fieldKey: string) {
+ return FieldView.LayoutString(PresElementBox, fieldKey);
+ }
_heightDisposer: IReactionDisposer | undefined;
@observable _dragging = false;
// Idea: this boolean will determine whether to automatically show the video when this preselement is selected.
// @observable static showVideo: boolean = false;
- @computed get indexInPres() { return DocListCast(this.presBox[StrCast(this.presBox.presFieldKey, "data")]).indexOf(this.rootDoc); } // the index field is where this document is in the presBox display list (since this value is different for each presentation element, the value can't be stored on the layout template which is used by all display elements)
- @computed get collapsedHeight() { return [CollectionViewType.Tree, CollectionViewType.Stacking].includes(this.presBox._viewType as any) ? 35 : 31; } // the collapsed height changes depending on the state of the presBox. We could store this on the presentation element template if it's used by only one presentation - but if it's shared by multiple, then this value must be looked up
- @computed get presStatus() { return this.presBox.presStatus; }
- @computed get presBox() { return (this.props.DocumentView?.().props.treeViewDoc ?? this.props.ContainingCollectionDoc)!; }
- @computed get targetDoc() { return Cast(this.rootDoc.presentationTargetDoc, Doc, null) || this.rootDoc; }
+ @computed get indexInPres() {
+ return DocListCast(this.presBox[StrCast(this.presBox.presFieldKey, 'data')]).indexOf(this.rootDoc);
+ } // the index field is where this document is in the presBox display list (since this value is different for each presentation element, the value can't be stored on the layout template which is used by all display elements)
+ @computed get collapsedHeight() {
+ return [CollectionViewType.Tree, CollectionViewType.Stacking].includes(this.presBox._viewType as any) ? 35 : 31;
+ } // the collapsed height changes depending on the state of the presBox. We could store this on the presentation element template if it's used by only one presentation - but if it's shared by multiple, then this value must be looked up
+ @computed get presStatus() {
+ return this.presBox.presStatus;
+ }
+ @computed get presBox() {
+ return (this.props.DocumentView?.().props.treeViewDoc ?? this.props.ContainingCollectionDoc)!;
+ }
+ @computed get targetDoc() {
+ return Cast(this.rootDoc.presentationTargetDoc, Doc, null) || this.rootDoc;
+ }
componentDidMount() {
this.layoutDoc.hideLinkButton = true;
- this._heightDisposer = reaction(() => [this.rootDoc.presExpandInlineButton, this.collapsedHeight],
- params => this.layoutDoc._height = NumCast(params[1]) + (Number(params[0]) ? 100 : 0), { fireImmediately: true });
+ this._heightDisposer = reaction(
+ () => [this.rootDoc.presExpandInlineButton, this.collapsedHeight],
+ params => (this.layoutDoc._height = NumCast(params[1]) + (Number(params[0]) ? 100 : 0)),
+ { fireImmediately: true }
+ );
}
componentWillUnmount() {
this._heightDisposer?.();
@@ -60,26 +74,26 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
@action
presExpandDocumentClick = () => {
this.rootDoc.presExpandInlineButton = !this.rootDoc.presExpandInlineButton;
- }
+ };
embedHeight = (): number => 97;
// embedWidth = () => this.props.PanelWidth();
// embedHeight = () => Math.min(this.props.PanelWidth() - 20, this.props.PanelHeight() - this.collapsedHeight);
embedWidth = (): number => this.props.PanelWidth() - 35;
- styleProvider = (doc: (Doc | undefined), props: Opt<DocumentViewProps>, property: string): any => {
+ styleProvider = (doc: Doc | undefined, props: Opt<DocumentViewProps>, property: string): any => {
if (property === StyleProp.Opacity) return 1;
return this.props.styleProvider?.(doc, props, property);
- }
+ };
/**
* The function that is responsible for rendering a preview or not for this
* presentation element.
*/
@computed get renderEmbeddedInline() {
- return !this.rootDoc.presExpandInlineButton || !this.targetDoc ? (null) :
+ return !this.rootDoc.presExpandInlineButton || !this.targetDoc ? null : (
<div className="presItem-embedded" style={{ height: this.embedHeight(), width: this.embedWidth() }}>
<DocumentView
Document={this.rootDoc}
- DataDoc={undefined}//this.targetDoc[DataSym] !== this.targetDoc && this.targetDoc[DataSym]}
+ DataDoc={undefined} //this.targetDoc[DataSym] !== this.targetDoc && this.targetDoc[DataSym]}
styleProvider={this.styleProvider}
docViewPath={returnEmptyDoclist}
rootSelected={returnTrue}
@@ -105,22 +119,23 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
hideLinkButton={true}
/>
<div className="presItem-embeddedMask" />
- </div>;
+ </div>
+ );
}
@computed get renderGroupSlides() {
const childDocs = DocListCast(this.targetDoc.data);
- const groupSlides = childDocs.map((doc: Doc, ind: number) =>
- <div className="presItem-groupSlide" onClick={(e) => {
- console.log("Clicked on slide with index: ", ind);
- e.stopPropagation();
- e.preventDefault();
- PresBox.Instance.modifierSelect(doc, this._itemRef.current!, this._dragRef.current!, !e.shiftKey && !e.ctrlKey && !e.metaKey, e.ctrlKey || e.metaKey, e.shiftKey);
- this.presExpandDocumentClick();
- }}>
- <div className="presItem-groupNum">
- {`${ind + 1}.`}
- </div>
+ const groupSlides = childDocs.map((doc: Doc, ind: number) => (
+ <div
+ className="presItem-groupSlide"
+ onClick={e => {
+ console.log('Clicked on slide with index: ', ind);
+ e.stopPropagation();
+ e.preventDefault();
+ PresBox.Instance.modifierSelect(doc, this._itemRef.current!, this._dragRef.current!, !e.shiftKey && !e.ctrlKey && !e.metaKey, e.ctrlKey || e.metaKey, e.shiftKey);
+ this.presExpandDocumentClick();
+ }}>
+ <div className="presItem-groupNum">{`${ind + 1}.`}</div>
{/* style={{ maxWidth: showMore ? (toolbarWidth - 195) : toolbarWidth - 105, cursor: isSelected ? 'text' : 'grab' }} */}
<div className="presItem-name">
<EditableView
@@ -130,37 +145,36 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
overflow={'ellipsis'}
GetValue={() => StrCast(doc.title)}
SetValue={(value: string) => {
- doc.title = !value.trim().length ? "-untitled-" : value;
+ doc.title = !value.trim().length ? '-untitled-' : value;
return true;
}}
/>
</div>
</div>
- );
- return (
- groupSlides
- );
+ ));
+ return groupSlides;
}
@computed get duration() {
let durationInS: number;
- if (this.rootDoc.type === DocumentType.AUDIO || this.rootDoc.type === DocumentType.VID) { durationInS = NumCast(this.rootDoc.presEndTime) - NumCast(this.rootDoc.presStartTime); durationInS = Math.round(durationInS * 10) / 10; }
- else if (this.rootDoc.presDuration) durationInS = NumCast(this.rootDoc.presDuration) / 1000;
+ if (this.rootDoc.type === DocumentType.AUDIO || this.rootDoc.type === DocumentType.VID) {
+ durationInS = NumCast(this.rootDoc.presEndTime) - NumCast(this.rootDoc.presStartTime);
+ durationInS = Math.round(durationInS * 10) / 10;
+ } else if (this.rootDoc.presDuration) durationInS = NumCast(this.rootDoc.presDuration) / 1000;
else durationInS = 2;
- return "D: " + durationInS + "s";
+ return 'D: ' + durationInS + 's';
}
@computed get transition() {
let transitionInS: number;
if (this.rootDoc.presTransition) transitionInS = NumCast(this.rootDoc.presTransition) / 1000;
else transitionInS = 0.5;
- return this.rootDoc.presMovement === PresMovement.Jump || this.rootDoc.presMovement === PresMovement.None ? (null) : "M: " + transitionInS + "s";
+ return this.rootDoc.presMovement === PresMovement.Jump || this.rootDoc.presMovement === PresMovement.None ? null : 'M: ' + transitionInS + 's';
}
private _itemRef: React.RefObject<HTMLDivElement> = React.createRef();
private _dragRef: React.RefObject<HTMLDivElement> = React.createRef();
private _titleRef: React.RefObject<EditableView> = React.createRef();
-
@action
headerDown = (e: React.PointerEvent<HTMLDivElement>) => {
const element = e.target as any;
@@ -171,18 +185,24 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
PresBox.Instance._selectedArray.size === 1 && PresBox.Instance.regularSelect(this.rootDoc, this._itemRef.current!, this._dragRef.current!, false, false);
setupMoveUpEvents(this, e, this.startDrag, emptyFunction, emptyFunction);
} else {
- setupMoveUpEvents(this, e, ((e: PointerEvent) => {
- PresBox.Instance.regularSelect(this.rootDoc, this._itemRef.current!, this._dragRef.current!, false, false);
- return this.startDrag(e);
- }), emptyFunction, emptyFunction);
+ setupMoveUpEvents(
+ this,
+ e,
+ (e: PointerEvent) => {
+ PresBox.Instance.regularSelect(this.rootDoc, this._itemRef.current!, this._dragRef.current!, false, false);
+ return this.startDrag(e);
+ },
+ emptyFunction,
+ emptyFunction
+ );
}
}
- }
+ };
headerUp = (e: React.PointerEvent<HTMLDivElement>) => {
e.stopPropagation();
e.preventDefault();
- }
+ };
/**
* Function to drag and drop the pres element to a diferent location
@@ -193,37 +213,43 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
const dragArray = PresBox.Instance._dragArray;
const dragData = new DragManager.DocumentDragData(PresBox.Instance.sortArray());
if (!dragData.draggedDocuments.length) dragData.draggedDocuments.push(this.rootDoc);
- dragData.dropAction = "move";
+ dragData.dropAction = 'move';
dragData.treeViewDoc = this.props.docViewPath().lastElement()?.props.treeViewDoc;
dragData.moveDocument = this.props.docViewPath().lastElement()?.props.moveDocument;
const dragItem: HTMLElement[] = [];
if (dragArray.length === 1) {
const doc = this._itemRef.current || dragArray[0];
- doc.className = miniView ? "presItem-miniSlide" : "presItem-slide";
+ doc.className = miniView ? 'presItem-miniSlide' : 'presItem-slide';
dragItem.push(doc);
} else if (dragArray.length >= 1) {
const doc = document.createElement('div');
- doc.className = "presItem-multiDrag";
- doc.innerText = "Move " + PresBox.Instance._selectedArray.size + " slides";
+ doc.className = 'presItem-multiDrag';
+ doc.innerText = 'Move ' + PresBox.Instance._selectedArray.size + ' slides';
doc.style.position = 'absolute';
- doc.style.top = (e.clientY) + 'px';
- doc.style.left = (e.clientX - 50) + 'px';
+ doc.style.top = e.clientY + 'px';
+ doc.style.left = e.clientX - 50 + 'px';
dragItem.push(doc);
}
// const dropEvent = () => runInAction(() => this._dragging = false);
if (activeItem) {
- DragManager.StartDocumentDrag(dragItem.map(ele => ele), dragData, e.clientX, e.clientY, undefined);
+ DragManager.StartDocumentDrag(
+ dragItem.map(ele => ele),
+ dragData,
+ e.clientX,
+ e.clientY,
+ undefined
+ );
// runInAction(() => this._dragging = true);
return true;
}
return false;
- }
+ };
onPointerOver = (e: any) => {
- document.removeEventListener("pointermove", this.onPointerMove);
- document.addEventListener("pointermove", this.onPointerMove);
- }
+ document.removeEventListener('pointermove', this.onPointerMove);
+ document.addEventListener('pointermove', this.onPointerMove);
+ };
onPointerMove = (e: PointerEvent) => {
const slide = this._itemRef.current!;
@@ -233,32 +259,32 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
}
if (slide && dragIsPresItem) {
const rect = slide.getBoundingClientRect();
- const y = e.clientY - rect.top; //y position within the element.
+ const y = e.clientY - rect.top; //y position within the element.
const height = slide.clientHeight;
const halfLine = height / 2;
if (y <= halfLine) {
slide.style.borderTop = `solid 2px ${Colors.MEDIUM_BLUE}`;
- slide.style.borderBottom = "0px";
+ slide.style.borderBottom = '0px';
} else if (y > halfLine) {
- slide.style.borderTop = "0px";
+ slide.style.borderTop = '0px';
slide.style.borderBottom = `solid 2px ${Colors.MEDIUM_BLUE}`;
}
}
- document.removeEventListener("pointermove", this.onPointerMove);
- }
+ document.removeEventListener('pointermove', this.onPointerMove);
+ };
onPointerLeave = (e: any) => {
- this._itemRef.current!.style.borderTop = "0px";
- this._itemRef.current!.style.borderBottom = "0px";
- document.removeEventListener("pointermove", this.onPointerMove);
- }
+ this._itemRef.current!.style.borderTop = '0px';
+ this._itemRef.current!.style.borderBottom = '0px';
+ document.removeEventListener('pointermove', this.onPointerMove);
+ };
@action
toggleProperties = () => {
- if (CurrentUserUtils.propertiesWidth < 5) {
- action(() => (CurrentUserUtils.propertiesWidth = 250));
+ if (SettingsManager.propertiesWidth < 5) {
+ action(() => (SettingsManager.propertiesWidth = 250));
}
- }
+ };
@undoBatch
removeItem = action((e: React.MouseEvent) => {
@@ -267,32 +293,35 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
if (PresBox.Instance._selectedArray.has(this.rootDoc)) {
PresBox.Instance._selectedArray.delete(this.rootDoc);
}
- this.removeAllRecordingInOverlay()
+ this.removeAllRecordingInOverlay();
});
// set the value/title of the individual pres element
@undoBatch
@action
onSetValue = (value: string) => {
- this.rootDoc.title = !value.trim().length ? "-untitled-" : value;
+ this.rootDoc.title = !value.trim().length ? '-untitled-' : value;
return true;
- }
+ };
/**
* Method called for updating the view of the currently selected document
- *
- * @param targetDoc
- * @param activeItem
+ *
+ * @param targetDoc
+ * @param activeItem
*/
@undoBatch
@action
updateView = (targetDoc: Doc, activeItem: Doc) => {
switch (targetDoc.type) {
- case DocumentType.PDF: case DocumentType.WEB: case DocumentType.RTF:
+ case DocumentType.PDF:
+ case DocumentType.WEB:
+ case DocumentType.RTF:
const scroll = targetDoc._scrollTop;
activeItem.presPinViewScroll = scroll;
break;
- case DocumentType.VID: case DocumentType.AUDIO:
+ case DocumentType.VID:
+ case DocumentType.AUDIO:
activeItem.presStartTime = targetDoc._currentTimecode;
break;
case DocumentType.COMPARISON:
@@ -307,53 +336,53 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
activeItem.presPinViewY = y;
activeItem.presPinViewScale = scale;
}
- }
+ };
@computed get recordingIsInOverlay() {
- let isInOverlay = false
- DocListCast(CurrentUserUtils.MyOverlayDocs.data).forEach((doc) => {
+ let isInOverlay = false;
+ DocListCast(Doc.MyOverlayDocs.data).forEach(doc => {
if (doc.slides === this.rootDoc) {
- isInOverlay = true
+ isInOverlay = true;
// return
}
- })
- return isInOverlay
+ });
+ return isInOverlay;
}
// a previously recorded video will have timecode defined
static videoIsRecorded = (activeItem: Doc) => {
const casted = Cast(activeItem.recording, Doc, null);
return casted && 'currentTimecode' in casted;
- }
+ };
removeAllRecordingInOverlay = () => {
- DocListCast(CurrentUserUtils.MyOverlayDocs.data).forEach((doc) => {
+ DocListCast(Doc.MyOverlayDocs.data).forEach(doc => {
if (doc.slides === this.rootDoc) {
- Doc.RemoveDocFromList(CurrentUserUtils.MyOverlayDocs, undefined, doc);
+ Doc.RemoveDocFromList(Doc.MyOverlayDocs, undefined, doc);
}
- })
- }
+ });
+ };
static removeEveryExistingRecordingInOverlay = () => {
// Remove every recording that already exists in overlay view
- DocListCast(CurrentUserUtils.MyOverlayDocs.data).forEach((doc) => {
+ DocListCast(Doc.MyOverlayDocs.data).forEach(doc => {
// if it's a recording video, don't remove from overlay (user can lose data)
- if (!PresElementBox.videoIsRecorded(DocCast(doc.slides))) return
+ if (!PresElementBox.videoIsRecorded(DocCast(doc.slides))) return;
if (doc.slides !== null) {
- Doc.RemoveDocFromList(CurrentUserUtils.MyOverlayDocs, undefined, doc);
+ Doc.RemoveDocFromList(Doc.MyOverlayDocs, undefined, doc);
}
- })
- }
+ });
+ };
@undoBatch
@action
hideRecording = (e: React.MouseEvent, iconClick: boolean = false) => {
- e.stopPropagation()
- this.removeAllRecordingInOverlay()
+ e.stopPropagation();
+ this.removeAllRecordingInOverlay();
// if (iconClick) PresElementBox.showVideo = false;
- }
+ };
@undoBatch
@action
@@ -364,47 +393,46 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
// remove the overlays on switch *IF* not opened from the specific icon
if (!iconClick) PresElementBox.removeEveryExistingRecordingInOverlay();
-
if (activeItem.recording) {
- Doc.AddDocToList(CurrentUserUtils.MyOverlayDocs, undefined, Cast(activeItem.recording, Doc, null));
+ Doc.AddDocToList(Doc.MyOverlayDocs, undefined, Cast(activeItem.recording, Doc, null));
}
- }
+ };
@undoBatch
@action
startRecording = (activeItem: Doc) => {
- console.log('start recording', 'activeItem', activeItem)
+ console.log('start recording', 'activeItem', activeItem);
if (PresElementBox.videoIsRecorded(activeItem)) {
// if we already have an existing recording
this.showRecording(activeItem, true);
// // if we already have an existing recording
- // Doc.AddDocToList(CurrentUserUtils.MyOverlayDocs, undefined, Cast(activeItem.recording, Doc, null));
-
+ // Doc.AddDocToList(Doc.MyOverlayDocs, undefined, Cast(activeItem.recording, Doc, null));
} else {
// Remove every recording that already exists in overlay view
// this is a design decision to clear to focus in on the recoding mode
PresElementBox.removeEveryExistingRecordingInOverlay();
// if we dont have any recording
- const recording = Docs.Create.WebCamDocument("", {
- _width: 384, _height: 216,
+ const recording = Docs.Create.WebCamDocument('', {
+ _width: 384,
+ _height: 216,
hideDocumentButtonBar: true,
hideDecorationTitle: true,
hideOpenButton: true,
// hideDeleteButton: true,
- cloneFieldFilter: new List<string>(["system"])
+ cloneFieldFilter: new List<string>(['system']),
});
// attach the recording to the slide, and attach the slide to the recording
- recording.slides = activeItem
- activeItem.recording = recording
+ recording.slides = activeItem;
+ activeItem.recording = recording;
// make recording box appear in the bottom right corner of the screen
recording.x = window.innerWidth - recording[WidthSym]() - 20;
recording.y = window.innerHeight - recording[HeightSym]() - 20;
- Doc.AddDocToList(CurrentUserUtils.MyOverlayDocs, undefined, recording);
+ Doc.AddDocToList(Doc.MyOverlayDocs, undefined, recording);
}
- }
+ };
@computed
get toolbarWidth(): number {
@@ -422,17 +450,18 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
const miniView: boolean = this.toolbarWidth <= 110;
const presBox: Doc = this.presBox; //presBox
const presBoxColor: string = StrCast(presBox._backgroundColor);
- const presColorBool: boolean = presBoxColor ? (presBoxColor !== Colors.WHITE && presBoxColor !== "transparent") : false;
+ const presColorBool: boolean = presBoxColor ? presBoxColor !== Colors.WHITE && presBoxColor !== 'transparent' : false;
const targetDoc: Doc = this.targetDoc;
const activeItem: Doc = this.rootDoc;
return (
- <div className={`presItem-container`}
+ <div
+ className={`presItem-container`}
key={this.props.Document[Id] + this.indexInPres}
ref={this._itemRef}
style={{
- backgroundColor: presColorBool ? isSelected ? "rgba(250,250,250,0.3)" : "transparent" : isSelected ? Colors.LIGHT_BLUE : "transparent",
- opacity: this._dragging ? 0.3 : 1
+ backgroundColor: presColorBool ? (isSelected ? 'rgba(250,250,250,0.3)' : 'transparent') : isSelected ? Colors.LIGHT_BLUE : 'transparent',
+ opacity: this._dragging ? 0.3 : 1,
}}
onClick={e => {
e.stopPropagation();
@@ -447,8 +476,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
onPointerOver={this.onPointerOver}
onPointerLeave={this.onPointerLeave}
onPointerDown={this.headerDown}
- onPointerUp={this.headerUp}
- >
+ onPointerUp={this.headerUp}>
{/* {miniView ?
// when width is LESS than 110 px
<div className={`presItem-miniSlide ${isSelected ? "active" : ""}`} ref={miniView ? this._dragRef : null}>
@@ -462,50 +490,63 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
{/* <div className="presItem-number">
{`${this.indexInPres + 1}.`}
</div> */}
- {miniView ? (null) : <div ref={miniView ? null : this._dragRef} className={`presItem-slide ${isSelected ? "active" : ""}`}
- style={{
- backgroundColor: this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.BackgroundColor),
- boxShadow: presBoxColor && presBoxColor !== "white" && presBoxColor !== "transparent" ? isSelected ? "0 0 0px 1.5px" + presBoxColor : undefined : undefined
- }}>
- <div className="presItem-name" style={{ maxWidth: showMore ? (toolbarWidth - 195) : toolbarWidth - 105, cursor: isSelected ? 'text' : 'grab' }}>
- <div>{`${this.indexInPres + 1}. `}</div>
- <EditableView
- ref={this._titleRef}
- editing={!isSelected ? false : undefined}
- contents={activeItem.title}
- overflow={'ellipsis'}
- GetValue={() => StrCast(activeItem.title)}
- SetValue={this.onSetValue}
- />
- </div>
- {/* <Tooltip title={<><div className="dash-tooltip">{"Movement speed"}</div></>}><div className="presItem-time" style={{ display: showMore ? "block" : "none" }}>{this.transition}</div></Tooltip> */}
- {/* <Tooltip title={<><div className="dash-tooltip">{"Duration"}</div></>}><div className="presItem-time" style={{ display: showMore ? "block" : "none" }}>{this.duration}</div></Tooltip> */}
- <div className={"presItem-slideButtons"}>
- <Tooltip title={<><div className="dash-tooltip">{"Update view"}</div></>}>
- <div className="slideButton"
- onClick={() => this.updateView(targetDoc, activeItem)}
- style={{ fontWeight: 700, display: activeItem.presPinView ? "flex" : "none" }}>V</div>
- </Tooltip>
-
- {this.recordingIsInOverlay ?
- <Tooltip title={<><div className="dash-tooltip">{"Hide Recording"}</div></>}>
- <div className="slideButton"
- onClick={(e) => this.hideRecording(e, true)}
- style={{ fontWeight: 700 }}>
- <FontAwesomeIcon icon={"video-slash"} onPointerDown={e => e.stopPropagation()} />
- </div>
- </Tooltip> :
- <Tooltip title={<><div className="dash-tooltip">{`${PresElementBox.videoIsRecorded(activeItem) ? "Show" : "Start"} recording`}</div></>}>
- <div className="slideButton"
- onClick={(e) => { e.stopPropagation(); this.startRecording(activeItem); }}
- style={{ fontWeight: 700 }}>
- <FontAwesomeIcon icon={"video"} onPointerDown={e => e.stopPropagation()} />
+ {miniView ? null : (
+ <div
+ ref={miniView ? null : this._dragRef}
+ className={`presItem-slide ${isSelected ? 'active' : ''}`}
+ style={{
+ backgroundColor: this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.BackgroundColor),
+ boxShadow: presBoxColor && presBoxColor !== 'white' && presBoxColor !== 'transparent' ? (isSelected ? '0 0 0px 1.5px' + presBoxColor : undefined) : undefined,
+ }}>
+ <div className="presItem-name" style={{ maxWidth: showMore ? toolbarWidth - 195 : toolbarWidth - 105, cursor: isSelected ? 'text' : 'grab' }}>
+ <div>{`${this.indexInPres + 1}. `}</div>
+ <EditableView ref={this._titleRef} editing={!isSelected ? false : undefined} contents={activeItem.title} overflow={'ellipsis'} GetValue={() => StrCast(activeItem.title)} SetValue={this.onSetValue} />
+ </div>
+ {/* <Tooltip title={<><div className="dash-tooltip">{"Movement speed"}</div></>}><div className="presItem-time" style={{ display: showMore ? "block" : "none" }}>{this.transition}</div></Tooltip> */}
+ {/* <Tooltip title={<><div className="dash-tooltip">{"Duration"}</div></>}><div className="presItem-time" style={{ display: showMore ? "block" : "none" }}>{this.duration}</div></Tooltip> */}
+ <div className={'presItem-slideButtons'}>
+ <Tooltip
+ title={
+ <>
+ <div className="dash-tooltip">{'Update view'}</div>
+ </>
+ }>
+ <div className="slideButton" onClick={() => this.updateView(targetDoc, activeItem)} style={{ fontWeight: 700, display: activeItem.presPinView ? 'flex' : 'none' }}>
+ V
</div>
</Tooltip>
- }
-
- {/* {this.indexInPres === 0 ? (null) : <Tooltip title={<><div className="dash-tooltip">{activeItem.groupWithUp ? "Ungroup" : "Group with up"}</div></>}>
+ {this.recordingIsInOverlay ? (
+ <Tooltip
+ title={
+ <>
+ <div className="dash-tooltip">{'Hide Recording'}</div>
+ </>
+ }>
+ <div className="slideButton" onClick={e => this.hideRecording(e, true)} style={{ fontWeight: 700 }}>
+ <FontAwesomeIcon icon={'video-slash'} onPointerDown={e => e.stopPropagation()} />
+ </div>
+ </Tooltip>
+ ) : (
+ <Tooltip
+ title={
+ <>
+ <div className="dash-tooltip">{`${PresElementBox.videoIsRecorded(activeItem) ? 'Show' : 'Start'} recording`}</div>
+ </>
+ }>
+ <div
+ className="slideButton"
+ onClick={e => {
+ e.stopPropagation();
+ this.startRecording(activeItem);
+ }}
+ style={{ fontWeight: 700 }}>
+ <FontAwesomeIcon icon={'video'} onPointerDown={e => e.stopPropagation()} />
+ </div>
+ </Tooltip>
+ )}
+
+ {/* {this.indexInPres === 0 ? (null) : <Tooltip title={<><div className="dash-tooltip">{activeItem.groupWithUp ? "Ungroup" : "Group with up"}</div></>}>
<div className="slideButton"
onClick={() => activeItem.groupWithUp = !activeItem.groupWithUp}
style={{
@@ -520,22 +561,41 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
</div>
</div>
</Tooltip>} */}
- <Tooltip title={<><div className="dash-tooltip">{this.rootDoc.presExpandInlineButton ? "Minimize" : "Expand"}</div></>}><div className={"slideButton"} onClick={e => { e.stopPropagation(); this.presExpandDocumentClick(); }}>
- <FontAwesomeIcon icon={this.rootDoc.presExpandInlineButton ? "eye-slash" : "eye"} onPointerDown={e => e.stopPropagation()} />
- </div></Tooltip>
- <Tooltip title={<><div className="dash-tooltip">{"Remove from presentation"}</div></>}><div
- className={"slideButton"}
- onClick={this.removeItem}>
- <FontAwesomeIcon icon={"trash"} onPointerDown={e => e.stopPropagation()} />
- </div></Tooltip>
+ <Tooltip
+ title={
+ <>
+ <div className="dash-tooltip">{this.rootDoc.presExpandInlineButton ? 'Minimize' : 'Expand'}</div>
+ </>
+ }>
+ <div
+ className={'slideButton'}
+ onClick={e => {
+ e.stopPropagation();
+ this.presExpandDocumentClick();
+ }}>
+ <FontAwesomeIcon icon={this.rootDoc.presExpandInlineButton ? 'eye-slash' : 'eye'} onPointerDown={e => e.stopPropagation()} />
+ </div>
+ </Tooltip>
+ <Tooltip
+ title={
+ <>
+ <div className="dash-tooltip">{'Remove from presentation'}</div>
+ </>
+ }>
+ <div className={'slideButton'} onClick={this.removeItem}>
+ <FontAwesomeIcon icon={'trash'} onPointerDown={e => e.stopPropagation()} />
+ </div>
+ </Tooltip>
+ </div>
+ {/* <div className="presItem-docName" style={{ maxWidth: showMore ? (toolbarWidth - 195) : toolbarWidth - 105 }}>{activeItem.presPinView ? (<><i>View of </i> {targetDoc.title}</>) : targetDoc.title}</div> */}
+ {this.renderEmbeddedInline}
</div>
- {/* <div className="presItem-docName" style={{ maxWidth: showMore ? (toolbarWidth - 195) : toolbarWidth - 105 }}>{activeItem.presPinView ? (<><i>View of </i> {targetDoc.title}</>) : targetDoc.title}</div> */}
- {this.renderEmbeddedInline}
- </div>}
- </div >);
+ )}
+ </div>
+ );
}
render() {
- return !(this.rootDoc instanceof Doc) || this.targetDoc instanceof Promise ? (null) : this.mainItem;
+ return !(this.rootDoc instanceof Doc) || this.targetDoc instanceof Promise ? null : this.mainItem;
}
-} \ No newline at end of file
+}