From 487da69a15d3957651c19f4e273501258daefd0a Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 6 Jun 2025 18:21:23 +0300 Subject: Replace "Note about sharing" prompt with an inline hint (#8452) * add pwi warning to share menu, remove prompt * add pwi label to web, remove prompt * add an option to the PWI menu * conditionally reorder items on web --- .../PostControls/ShareMenu/ShareMenuItems.web.tsx | 133 ++++++++++----------- 1 file changed, 61 insertions(+), 72 deletions(-) (limited to 'src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx') diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx index 0da259678..8d52a2fdf 100644 --- a/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx +++ b/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx @@ -22,7 +22,6 @@ import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/i import {CodeBrackets_Stroke2_Corner0_Rounded as CodeBracketsIcon} from '#/components/icons/CodeBrackets' import {PaperPlane_Stroke2_Corner0_Rounded as Send} from '#/components/icons/PaperPlane' import * as Menu from '#/components/Menu' -import * as Prompt from '#/components/Prompt' import {useDevMode} from '#/storage/hooks/dev-mode' import {type ShareMenuItemsProps} from './ShareMenuItems.types' @@ -32,11 +31,10 @@ let ShareMenuItems = ({ timestamp, onShare: onShareProp, }: ShareMenuItemsProps): React.ReactNode => { - const {hasSession, currentAccount} = useSession() + const {hasSession} = useSession() const {gtMobile} = useBreakpoints() const {_} = useLingui() const navigation = useNavigation() - const loggedOutWarningPromptControl = useDialogControl() const embedPostControl = useDialogControl() const sendViaChatControl = useDialogControl() const [devModeEnabled] = useDevMode() @@ -56,9 +54,6 @@ let ShareMenuItems = ({ ) }, [postAuthor]) - const showLoggedOutWarning = - postAuthor.did !== currentAccount?.did && hideInPWI - const onCopyLink = () => { logger.metric('share:press:copyLink', {}, {statsig: true}) const url = toShareUrl(href) @@ -84,92 +79,86 @@ let ShareMenuItems = ({ shareText(postAuthor.did) } + const copyLinkItem = ( + + + Copy link to post + + + + ) + return ( <> - + {!hideInPWI && copyLinkItem} + + {hasSession && ( { - if (showLoggedOutWarning) { - loggedOutWarningPromptControl.open() - } else { - onCopyLink() - } + logger.metric('share:press:openDmSearch', {}, {statsig: true}) + sendViaChatControl.open() }}> - Copy link to post + Send via direct message - + + + )} + + {canEmbed && ( + { + logger.metric('share:press:embed', {}, {statsig: true}) + embedPostControl.open() + }}> + {_(msg`Embed post`)} + + )} + + {hideInPWI && ( + <> + {hasSession && } + {copyLinkItem} + + Note: This post is only visible to logged-in users. + + + )} - {hasSession && ( + {devModeEnabled && ( + <> + { - logger.metric('share:press:openDmSearch', {}, {statsig: true}) - sendViaChatControl.open() - }}> + testID="postAtUriShareBtn" + label={_(msg`Copy post at:// URI`)} + onPress={onShareATURI}> - Send via direct message + Copy post at:// URI - + - )} - - {canEmbed && ( { - logger.metric('share:press:embed', {}, {statsig: true}) - embedPostControl.open() - }}> - {_(msg`Embed post`)} - + testID="postAuthorDIDShareBtn" + label={_(msg`Copy author DID`)} + onPress={onShareAuthorDID}> + + Copy author DID + + - )} - - - {devModeEnabled && ( - <> - - - - - Copy post at:// URI - - - - - - Copy author DID - - - - )} - - {canEmbed && (