From cfba5b19f49bdfe374019bcf42c24821b0f88087 Mon Sep 17 00:00:00 2001 From: "P. Douglas Reeder" Date: Tue, 8 Oct 2024 14:48:37 -0400 Subject: [PATCH] Invite using Web Share API: hides "Share in English" when locale is English --- src/react-components/room/InvitePopover.js | 25 +++++++++++-------- .../room/RoomSettingsSidebar.js | 12 +++++---- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/react-components/room/InvitePopover.js b/src/react-components/room/InvitePopover.js index 436666b12b..d47dcef0c5 100644 --- a/src/react-components/room/InvitePopover.js +++ b/src/react-components/room/InvitePopover.js @@ -18,6 +18,7 @@ import { ReactComponent as ShareIcon } from "../icons/Share.svg"; function InvitePopoverContent({ url, embed, inviteRequired, fetchingInvite, inviteUrl, revokeInvite, shareUrlHandler }) { const [isShareInEnglish, setIsShareInEnglish] = useState(false); + const intl = useIntl(); return ( {inviteRequired ? ( @@ -29,11 +30,13 @@ function InvitePopoverContent({ url, embed, inviteRequired, fetchingInvite, invi - } - checked={isShareInEnglish} - onChange={_event => setIsShareInEnglish(inEnglish => !inEnglish)} - /> + { ! intl?.locale?.startsWith?.('en') && + } + checked={isShareInEnglish} + onChange={_event => setIsShareInEnglish(inEnglish => !inEnglish)} + /> + } } @@ -47,11 +50,13 @@ function InvitePopoverContent({ url, embed, inviteRequired, fetchingInvite, invi - } - checked={isShareInEnglish} - onChange={_event => setIsShareInEnglish(inEnglish => !inEnglish)} - /> + { ! intl?.locale?.startsWith?.('en') && + } + checked={isShareInEnglish} + onChange={_event => setIsShareInEnglish(inEnglish => !inEnglish)} + /> + } } - } - checked={isShareInEnglish} - onChange={_event => setIsShareInEnglish(inEnglish => !inEnglish)} - /> + { ! intl?.locale?.startsWith?.('en') && + } + checked={isShareInEnglish} + onChange={_event => setIsShareInEnglish(inEnglish => !inEnglish)} + /> + } }