From 487da69a15d3957651c19f4e273501258daefd0a Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
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<NavigationProp>()
-  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 = (
+    <Menu.Item
+      testID="postDropdownShareBtn"
+      label={_(msg`Copy link to post`)}
+      onPress={onCopyLink}>
+      <Menu.ItemText>
+        <Trans>Copy link to post</Trans>
+      </Menu.ItemText>
+      <Menu.ItemIcon icon={ChainLinkIcon} position="right" />
+    </Menu.Item>
+  )
+
   return (
     <>
       <Menu.Outer>
-        <Menu.Group>
+        {!hideInPWI && copyLinkItem}
+
+        {hasSession && (
           <Menu.Item
-            testID="postDropdownShareBtn"
-            label={_(msg`Copy link to post`)}
+            testID="postDropdownSendViaDMBtn"
+            label={_(msg`Send via direct message`)}
             onPress={() => {
-              if (showLoggedOutWarning) {
-                loggedOutWarningPromptControl.open()
-              } else {
-                onCopyLink()
-              }
+              logger.metric('share:press:openDmSearch', {}, {statsig: true})
+              sendViaChatControl.open()
             }}>
             <Menu.ItemText>
-              <Trans>Copy link to post</Trans>
+              <Trans>Send via direct message</Trans>
             </Menu.ItemText>
-            <Menu.ItemIcon icon={ChainLinkIcon} position="right" />
+            <Menu.ItemIcon icon={Send} position="right" />
+          </Menu.Item>
+        )}
+
+        {canEmbed && (
+          <Menu.Item
+            testID="postDropdownEmbedBtn"
+            label={_(msg`Embed post`)}
+            onPress={() => {
+              logger.metric('share:press:embed', {}, {statsig: true})
+              embedPostControl.open()
+            }}>
+            <Menu.ItemText>{_(msg`Embed post`)}</Menu.ItemText>
+            <Menu.ItemIcon icon={CodeBracketsIcon} position="right" />
           </Menu.Item>
+        )}
+
+        {hideInPWI && (
+          <>
+            {hasSession && <Menu.Divider />}
+            {copyLinkItem}
+            <Menu.LabelText style={{maxWidth: 220}}>
+              <Trans>Note: This post is only visible to logged-in users.</Trans>
+            </Menu.LabelText>
+          </>
+        )}
 
-          {hasSession && (
+        {devModeEnabled && (
+          <>
+            <Menu.Divider />
             <Menu.Item
-              testID="postDropdownSendViaDMBtn"
-              label={_(msg`Send via direct message`)}
-              onPress={() => {
-                logger.metric('share:press:openDmSearch', {}, {statsig: true})
-                sendViaChatControl.open()
-              }}>
+              testID="postAtUriShareBtn"
+              label={_(msg`Copy post at:// URI`)}
+              onPress={onShareATURI}>
               <Menu.ItemText>
-                <Trans>Send via direct message</Trans>
+                <Trans>Copy post at:// URI</Trans>
               </Menu.ItemText>
-              <Menu.ItemIcon icon={Send} position="right" />
+              <Menu.ItemIcon icon={ClipboardIcon} position="right" />
             </Menu.Item>
-          )}
-
-          {canEmbed && (
             <Menu.Item
-              testID="postDropdownEmbedBtn"
-              label={_(msg`Embed post`)}
-              onPress={() => {
-                logger.metric('share:press:embed', {}, {statsig: true})
-                embedPostControl.open()
-              }}>
-              <Menu.ItemText>{_(msg`Embed post`)}</Menu.ItemText>
-              <Menu.ItemIcon icon={CodeBracketsIcon} position="right" />
+              testID="postAuthorDIDShareBtn"
+              label={_(msg`Copy author DID`)}
+              onPress={onShareAuthorDID}>
+              <Menu.ItemText>
+                <Trans>Copy author DID</Trans>
+              </Menu.ItemText>
+              <Menu.ItemIcon icon={ClipboardIcon} position="right" />
             </Menu.Item>
-          )}
-        </Menu.Group>
-
-        {devModeEnabled && (
-          <>
-            <Menu.Divider />
-            <Menu.Group>
-              <Menu.Item
-                testID="postAtUriShareBtn"
-                label={_(msg`Copy post at:// URI`)}
-                onPress={onShareATURI}>
-                <Menu.ItemText>
-                  <Trans>Copy post at:// URI</Trans>
-                </Menu.ItemText>
-                <Menu.ItemIcon icon={ClipboardIcon} position="right" />
-              </Menu.Item>
-              <Menu.Item
-                testID="postAuthorDIDShareBtn"
-                label={_(msg`Copy author DID`)}
-                onPress={onShareAuthorDID}>
-                <Menu.ItemText>
-                  <Trans>Copy author DID</Trans>
-                </Menu.ItemText>
-                <Menu.ItemIcon icon={ClipboardIcon} position="right" />
-              </Menu.Item>
-            </Menu.Group>
           </>
         )}
       </Menu.Outer>
 
-      <Prompt.Basic
-        control={loggedOutWarningPromptControl}
-        title={_(msg`Note about sharing`)}
-        description={_(
-          msg`This post is only visible to logged-in users. It won't be visible to people who aren't signed in.`,
-        )}
-        onConfirm={onCopyLink}
-        confirmButtonCta={_(msg`Share anyway`)}
-      />
-
       {canEmbed && (
         <EmbedDialog
           control={embedPostControl}
-- 
cgit 1.4.1

