From 9caee7c75fcf535c398b40b18010acb677101686 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sun, 23 Aug 2020 11:12:59 -0400 Subject: added sharing button to document button bar --- src/client/views/DocumentButtonBar.tsx | 14 +++++++ src/client/views/PropertiesButtons.tsx | 68 +++++++++++----------------------- 2 files changed, 36 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx index 7effc4aa0..82ece7dc3 100644 --- a/src/client/views/DocumentButtonBar.tsx +++ b/src/client/views/DocumentButtonBar.tsx @@ -23,6 +23,7 @@ import { Template, Templates } from "./Templates"; import React = require("react"); import { DocumentLinksButton } from './nodes/DocumentLinksButton'; import { Tooltip } from '@material-ui/core'; +import SharingManager from '../util/SharingManager'; const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -205,6 +206,16 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV ; } + @computed + get shareButton() { + const targetDoc = this.view0?.props.Document; + return !targetDoc ? (null) :
{"Open Sharing Manager"}
}> +
SharingManager.Instance.open(this.view0, targetDoc)}> + +
; + } + @computed get metadataButton() { const view0 = this.view0; @@ -293,6 +304,9 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV
{this.pinButton}
+
+ {this.shareButton} +
{/*
{this.considerGoogleDocsPush}
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx index 9e776c652..bcb492c49 100644 --- a/src/client/views/PropertiesButtons.tsx +++ b/src/client/views/PropertiesButtons.tsx @@ -319,13 +319,13 @@ export class PropertiesButtons extends React.Component<{}, {}> { Array.from(Object.values(Templates.TemplateList)).map(template => templates.set(template, views.reduce((checked, doc) => checked || doc?.props.Document["_show" + template.Name] ? true : false, false as boolean))); return !docView ? (null) : -
Customize layout
} placement="top"> + Customize layout} placement="top">
this._aliasDown = true)} onClose={action(() => this._aliasDown = false)} content={ v).map(v => v as DocumentView)} templates={templates} />}>
- {} +
Layout
@@ -350,13 +350,13 @@ export class PropertiesButtons extends React.Component<{}, {}> { @computed get copyButton() { const targetDoc = this.selectedDoc; - return !targetDoc ? (null) :
{"Tap or Drag to create an alias"}
} placement="top"> + return !targetDoc ? (null) : {"Tap or Drag to create an alias"}
} placement="top">
- {} +
Alias
@@ -373,15 +373,13 @@ export class PropertiesButtons extends React.Component<{}, {}> { get lockButton() { const targetDoc = this.selectedDoc; return !targetDoc ? (null) :
{this.selectedDoc?.lockedPosition ? - "Unlock Position" : "Lock Position"}
} placement="top"> + title={
{`${this.selectedDoc?.lockedPosition ? "Unlock" : "Lock"} " Position"`}
} placement="top">
-
- {} +
+
{ get downloadButton() { const targetDoc = this.selectedDoc; return !targetDoc ? (null) :
{"Download Document"}
} placement="top"> + title={
{"Download Document"}
} placement="top">
-
{ - if (this.selectedDoc) { - Doc.Zip(this.selectedDoc); - } - }}> - {} +
this.selectedDoc && Doc.Zip(this.selectedDoc)}> +
downld
@@ -416,13 +408,10 @@ export class PropertiesButtons extends React.Component<{}, {}> { @computed get deleteButton() { const targetDoc = this.selectedDoc; - return !targetDoc ? (null) :
Close Document
} placement="top"> + return !targetDoc ? (null) : Close Document
} placement="top">
-
- {} +
+
close
@@ -444,14 +433,8 @@ export class PropertiesButtons extends React.Component<{}, {}> { return !targetDoc ? (null) :
{"Share Document"}
} placement="top">
-
{ - if (this.selectedDocumentView) { - SharingManager.Instance.open(docView, this.selectedDoc); - } - }}> - {} +
this.selectedDocumentView && SharingManager.Instance.open(docView, this.selectedDoc)}> +
share
@@ -564,13 +547,8 @@ export class PropertiesButtons extends React.Component<{}, {}> { title={<>
{"Export to Google Photos"}
} placement="top">
{ - if (this.selectedDoc) { - GooglePhotos.Export.CollectionToAlbum({ collection: this.selectedDoc }).then(console.log); - } - }}> - {} + onPointerDown={() => this.selectedDoc && GooglePhotos.Export.CollectionToAlbum({ collection: this.selectedDoc }).then(console.log)}> + {}
google
@@ -651,10 +629,8 @@ export class PropertiesButtons extends React.Component<{}, {}> { return !targetDoc ? (null) :
Make Mask
} placement="top">
-
- {} +
+
mask
-- cgit v1.2.3-70-g09d2