From 3f447645d6bc1a4512cffe10fde59eb494c8e4a1 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 18 Aug 2020 18:01:20 -0400 Subject: [PATCH] groups: pad shortcode prompt to avoid graphic bug Fixes #3282. Also refactors shortcode render into a function. --- .../groups/components/lib/group-detail.js | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/pkg/interface/src/views/apps/groups/components/lib/group-detail.js b/pkg/interface/src/views/apps/groups/components/lib/group-detail.js index 0fb197aa79..3dbe30dac0 100644 --- a/pkg/interface/src/views/apps/groups/components/lib/group-detail.js +++ b/pkg/interface/src/views/apps/groups/components/lib/group-detail.js @@ -19,6 +19,7 @@ export class GroupDetail extends Component { this.changeTitle = this.changeTitle.bind(this); this.changeDescription = this.changeDescription.bind(this); this.changePolicy = this.changePolicy.bind(this); + this.getShortcode = this.getShortcode.bind(this); } componentDidMount() { @@ -185,6 +186,41 @@ export class GroupDetail extends Component { ); } + getShortcode(group, path) { + if (group?.policy?.open) { + return ( +
+

Share

+

+ Share a shortcode to join this group +

+
+ + { + writeText(path.substr(6)); + this.refs.copy.innerText = 'Copied'; + }}> + Copy + +
+
+ ); + } else { + return
; + }; + } + renderSettings() { const { props } = this; @@ -201,33 +237,8 @@ export class GroupDetail extends Component { { description: 'Janitor', tag: 'janitor', addDescription: 'Make Janitor' } ]; - let shortcode =
; + const shortcode = this.getShortcode(group, props.path); - if (group?.policy?.open) { - shortcode =
-

Share

-

Share a shortcode to join this group

-
- - { - writeText(props.path.substr(6)); - this.refs.copy.innerText = 'Copied'; - }} - > - Copy - -
-
; - } return (