diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-07-30 16:16:27 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-07-30 16:16:27 -0500 |
commit | da018ee4a1aa1b6f7f5e7c6cc13cb3d445033350 (patch) | |
tree | 1cd986d9be8bdbf1e1db2d623a7903cefa64ed66 | |
parent | 24c59f537e963a991b633afb21471b1571ad4f0a (diff) |
collection menu and properties adjustments
-rw-r--r-- | src/client/views/MainView.tsx | 13 | ||||
-rw-r--r-- | src/client/views/PropertiesButtons.tsx | 51 | ||||
-rw-r--r-- | src/client/views/collections/CollectionMenu.tsx | 3 |
3 files changed, 62 insertions, 5 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 825a75afa..a485d533c 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -172,7 +172,7 @@ export class MainView extends React.Component { fa.faFillDrip, fa.faLink, fa.faUnlink, fa.faBold, fa.faItalic, fa.faChevronLeft, fa.faUnderline, fa.faStrikethrough, fa.faSuperscript, fa.faSubscript, fa.faIndent, fa.faEyeDropper, fa.faPaintRoller, fa.faBars, fa.faBrush, fa.faShapes, fa.faEllipsisH, fa.faHandPaper, fa.faMap, fa.faUser, faHireAHelper, fa.faDesktop, fa.faTrashRestore, fa.faUsers, fa.faWrench, fa.faCog, fa.faMap, fa.faBellSlash, fa.faExpandAlt, fa.faArchive, fa.faBezierCurve, fa.faCircle, - fa.faLongArrowAltRight, fa.faPenFancy, fa.faAngleDoubleRight); + fa.faLongArrowAltRight, fa.faPenFancy, fa.faAngleDoubleRight, fa.faExpand); this.initEventListeners(); this.initAuthenticationRouters(); } @@ -420,7 +420,7 @@ export class MainView extends React.Component { @action onPointerMove = (e: PointerEvent) => { if (this.propertiesDownX) { - this._propertiesWidth = this._propertiesWidth + (this.propertiesDownX - e.screenX) * .5; + this._propertiesWidth = this._propertiesWidth + (this.propertiesDownX - e.screenX); if (this._propertiesWidth < 150) { this._propertiesWidth = 0; this.propertiesDownX = undefined; @@ -446,7 +446,7 @@ export class MainView extends React.Component { this._propertiesWidth = 0; } } else { - this._propertiesWidth = this._propertiesWidth + (this.propertiesDownX - e.screenX) * .5; + this._propertiesWidth = this._propertiesWidth + (this.propertiesDownX - e.screenX); if (this._propertiesWidth < 150) { this._propertiesWidth = 0; } else if (this._propertiesWidth > 400) { @@ -573,7 +573,12 @@ export class MainView extends React.Component { case "Settings": this.sidebarContent.proto = SettingsManager.Instance.open(); break; case "Sharing": this.sidebarContent.proto = GroupManager.Instance.open(); break; } - MainView.expandFlyout(); + if (str === "Settings" || str === "Sharing" || str === "Help") { + this.panelContent = "none"; + this.flyoutWidth = 0; + } else { + MainView.expandFlyout(); + } } return true; } diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx index cc15a8195..bd5301629 100644 --- a/src/client/views/PropertiesButtons.tsx +++ b/src/client/views/PropertiesButtons.tsx @@ -473,6 +473,46 @@ export class PropertiesButtons extends React.Component<{}, {}> { </Tooltip>; } + @computed + get clustersButton() { + const targetDoc = this.selectedDoc; + return !targetDoc ? (null) : <Tooltip + title={<><div className="dash-tooltip">{this.selectedDoc?.useClusters ? "Stop Showing Clusters" : "Show Clusters"}</div></>}> + <div className={"propertiesButtons-linkButton-empty"} + style={{ backgroundColor: this.selectedDoc?.useClusters ? "#a0a0a0" : "" }} + onPointerDown={this.changeClusters}> + {<FontAwesomeIcon className="documentdecorations-icon" + color={this.selectedDoc?.useClusters ? "black" : "white"} + icon="braille" size="sm" />} + </div> + </Tooltip>; + } + + @action @undoBatch + changeFitToBox = () => { + this.selectedDoc && (this.selectedDoc._fitToBox = !this.selectedDoc._fitToBox); + } + + @action @undoBatch + changeClusters = () => { + this.selectedDoc && (this.selectedDoc.useClusters = !this.selectedDoc.useClusters); + } + + @computed + get fitContentButton() { + const targetDoc = this.selectedDoc; + return !targetDoc ? (null) : <Tooltip + title={<><div className="dash-tooltip">{this.selectedDoc?._fitToBox ? "Stop Fitting Content" : "Fit Content"}</div></>}> + <div className={"propertiesButtons-linkButton-empty"} + style={{ backgroundColor: this.selectedDoc?._fitToBox ? "#a0a0a0" : "" }} + onPointerDown={this.changeFitToBox}> + {<FontAwesomeIcon className="documentdecorations-icon" + color={this.selectedDoc?._fitToBox ? "black" : "white"} + icon="expand" size="sm" />} + </div> + </Tooltip>; + } + // @computed // get importButton() { // const targetDoc = this.selectedDoc; @@ -490,6 +530,7 @@ export class PropertiesButtons extends React.Component<{}, {}> { // </Tooltip>; // } + render() { if (!this.selectedDoc) return (null); @@ -498,6 +539,7 @@ export class PropertiesButtons extends React.Component<{}, {}> { const considerPush = isText && this.considerGoogleDocsPush; const isImage = this.selectedDoc[Doc.LayoutFieldKey(this.selectedDoc)] instanceof ImageField; const isCollection = this.selectedDoc.type === DocumentType.COL ? true : false; + const isFreeForm = this.selectedDoc._viewType === "freeform" ? true : false; return <div><div className="propertiesButtons" style={{ paddingBottom: "5.5px" }}> <div className="propertiesButtons-button"> @@ -541,6 +583,15 @@ export class PropertiesButtons extends React.Component<{}, {}> { {/* <div className="propertiesButtons-button" style={{ display: !isCollection ? "none" : "" }}> {this.importButton} </div> */} + + <div className="propertiesButtons-button" style={{ display: !isFreeForm ? "none" : "" }}> + {this.clustersButton} + </div> + + <div className="propertiesButtons-button" style={{ display: !isFreeForm ? "none" : "" }}> + {this.fitContentButton} + </div> + </div> </div>; } diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx index e7c0ad6e6..14ab35a63 100644 --- a/src/client/views/collections/CollectionMenu.tsx +++ b/src/client/views/collections/CollectionMenu.tsx @@ -161,7 +161,8 @@ export class CollectionViewBaseChrome extends React.Component<CollectionMenuProp initialize: (button: Doc) => { button['target-docFilters'] = this.target._docFilters instanceof ObjectField ? ObjectField.MakeCopy(this.target._docFilters as any as ObjectField) : ""; }, }; - _freeform_commands = [this._viewCommand, this._saveFilterCommand, this._fitContentCommand, this._clusterCommand, this._contentCommand, this._templateCommand, this._narrativeCommand]; + @computed get _freeform_commands() { return Doc.UserDoc().noviceMode ? [this._viewCommand, this._saveFilterCommand] : [this._viewCommand, this._saveFilterCommand, this._contentCommand, this._templateCommand, this._narrativeCommand] }; + _stacking_commands = [this._contentCommand, this._templateCommand]; _masonry_commands = [this._contentCommand, this._templateCommand]; _schema_commands = [this._templateCommand, this._narrativeCommand]; |