From e7dc375aab0a5f9bf2695b7657269f088c9a086d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 May 2023 11:04:43 +0200 Subject: [PATCH] [Glitch] Change share action from being in action bar to being in dropdown in web UI Port 1caa5ff39e95f01eb74ee71b76eaa6c0fd7309fd to glitch-soc Co-authored-by: Claire Signed-off-by: Claire --- .../flavours/glitch/components/status_action_bar.jsx | 10 ++++------ .../glitch/features/account/components/header.jsx | 1 - .../glitch/features/status/components/action_bar.jsx | 11 +++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/javascript/flavours/glitch/components/status_action_bar.jsx b/app/javascript/flavours/glitch/components/status_action_bar.jsx index 00b3c3e94..65b822be8 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.jsx +++ b/app/javascript/flavours/glitch/components/status_action_bar.jsx @@ -103,7 +103,6 @@ class StatusActionBar extends ImmutablePureComponent { handleShareClick = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }); }; @@ -222,6 +221,10 @@ class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + if (publicStatus && 'share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick }); + } + if (publicStatus) { menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); } @@ -281,10 +284,6 @@ class StatusActionBar extends ImmutablePureComponent { replyTitle = intl.formatMessage(messages.replyAll); } - const shareButton = ('share' in navigator) && publicStatus && ( - - ); - const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private'; let reblogTitle = ''; @@ -314,7 +313,6 @@ class StatusActionBar extends ImmutablePureComponent { /> - {shareButton} {filterButton} diff --git a/app/javascript/flavours/glitch/features/account/components/header.jsx b/app/javascript/flavours/glitch/features/account/components/header.jsx index 43dbddb98..99722c3a6 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -152,7 +152,6 @@ class Header extends ImmutablePureComponent { const { account } = this.props; navigator.share({ - text: `${titleFromAccount(account)}\n${account.get('note_plain')}`, url: account.get('url'), }).catch((e) => { if (e.name !== 'AbortError') console.error(e); diff --git a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx index 67dfcb350..62c212991 100644 --- a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx @@ -128,7 +128,6 @@ class ActionBar extends PureComponent { handleShare = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }); }; @@ -160,6 +159,11 @@ class ActionBar extends PureComponent { } menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + + if ('share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare }); + } + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); menu.push(null); } @@ -199,10 +203,6 @@ class ActionBar extends PureComponent { } } - const shareButton = ('share' in navigator) && publicStatus && ( -
- ); - const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private'; let reblogTitle; @@ -221,7 +221,6 @@ class ActionBar extends PureComponent {
- {shareButton}