From 6980cc7f3765be34cb24e7a6c28fd65298d20642 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 16 Apr 2024 17:22:55 +0100 Subject: Hide translate/copy text options when `!no-unauthenticated` (#3573) * hide translate/copy text options when no-pwi * only do this for no-unauth * always show if logged in * swap order of OR --- src/view/com/util/forms/PostDropdownBtn.tsx | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/view/com/util/forms/PostDropdownBtn.tsx b/src/view/com/util/forms/PostDropdownBtn.tsx index 31032396f..32520182e 100644 --- a/src/view/com/util/forms/PostDropdownBtn.tsx +++ b/src/view/com/util/forms/PostDropdownBtn.tsx @@ -172,7 +172,7 @@ let PostDropdownBtn = ({ hidePost({uri: postUri}) }, [postUri, hidePost]) - const shouldShowLoggedOutWarning = React.useMemo(() => { + const hideInPWI = React.useMemo(() => { return !!postAuthor.labels?.find( label => label.val === '!no-unauthenticated', ) @@ -183,7 +183,7 @@ let PostDropdownBtn = ({ shareUrl(url) }, [href]) - const canEmbed = isWeb && gtMobile && !shouldShowLoggedOutWarning + const canEmbed = isWeb && gtMobile && !hideInPWI return ( @@ -215,27 +215,31 @@ let PostDropdownBtn = ({ - - {_(msg`Translate`)} - - + {(!hideInPWI || hasSession) && ( + <> + + {_(msg`Translate`)} + + - - {_(msg`Copy post text`)} - - + + {_(msg`Copy post text`)} + + + + )} { - if (shouldShowLoggedOutWarning) { + if (hideInPWI) { loggedOutWarningPromptControl.open() } else { onSharePost() -- cgit 1.4.1