about summary refs log tree commit diff
path: root/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-06-06 18:21:23 +0300
committerGitHub <noreply@github.com>2025-06-06 08:21:23 -0700
commit487da69a15d3957651c19f4e273501258daefd0a (patch)
treef829007db7bf6d76ccb0754a36ae3f5043ef4e45 /src/components/PostControls/ShareMenu/ShareMenuItems.tsx
parent23a7bc50db1efc7cd219f7e03f7ed12fdaa94266 (diff)
downloadvoidsky-487da69a15d3957651c19f4e273501258daefd0a.tar.zst
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
Diffstat (limited to 'src/components/PostControls/ShareMenu/ShareMenuItems.tsx')
-rw-r--r--src/components/PostControls/ShareMenu/ShareMenuItems.tsx56
1 files changed, 15 insertions, 41 deletions
diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
index c090c3e2d..1c04f3174 100644
--- a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
+++ b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
@@ -14,6 +14,8 @@ import {isIOS} from '#/platform/detection'
 import {useProfileShadow} from '#/state/cache/profile-shadow'
 import {useSession} from '#/state/session'
 import * as Toast from '#/view/com/util/Toast'
+import {atoms as a} from '#/alf'
+import {Admonition} from '#/components/Admonition'
 import {useDialogControl} from '#/components/Dialog'
 import {SendViaChatDialog} from '#/components/dms/dialogs/ShareViaChatDialog'
 import {ArrowOutOfBoxModified_Stroke2_Corner2_Rounded as ArrowOutOfBoxIcon} from '#/components/icons/ArrowOutOfBox'
@@ -21,7 +23,6 @@ import {ChainLink_Stroke2_Corner0_Rounded as ChainLinkIcon} from '#/components/i
 import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
 import {PaperPlane_Stroke2_Corner0_Rounded as PaperPlaneIcon} from '#/components/icons/PaperPlane'
 import * as Menu from '#/components/Menu'
-import * as Prompt from '#/components/Prompt'
 import {useDevMode} from '#/storage/hooks/dev-mode'
 import {RecentChats} from './RecentChats'
 import {type ShareMenuItemsProps} from './ShareMenuItems.types'
@@ -30,11 +31,9 @@ let ShareMenuItems = ({
   post,
   onShare: onShareProp,
 }: ShareMenuItemsProps): React.ReactNode => {
-  const {hasSession, currentAccount} = useSession()
+  const {hasSession} = useSession()
   const {_} = useLingui()
   const navigation = useNavigation<NavigationProp>()
-  const pwiWarningShareControl = useDialogControl()
-  const pwiWarningCopyControl = useDialogControl()
   const sendViaChatControl = useDialogControl()
   const [devModeEnabled] = useDevMode()
 
@@ -52,9 +51,6 @@ let ShareMenuItems = ({
     )
   }, [postAuthor])
 
-  const showLoggedOutWarning =
-    postAuthor.did !== currentAccount?.did && hideInPWI
-
   const onSharePost = () => {
     logger.metric('share:press:nativeShare', {}, {statsig: true})
     const url = toShareUrl(href)
@@ -117,13 +113,7 @@ let ShareMenuItems = ({
           <Menu.Item
             testID="postDropdownShareBtn"
             label={_(msg`Share via...`)}
-            onPress={() => {
-              if (showLoggedOutWarning) {
-                pwiWarningShareControl.open()
-              } else {
-                onSharePost()
-              }
-            }}>
+            onPress={onSharePost}>
             <Menu.ItemText>
               <Trans>Share via...</Trans>
             </Menu.ItemText>
@@ -133,13 +123,7 @@ let ShareMenuItems = ({
           <Menu.Item
             testID="postDropdownShareBtn"
             label={_(msg`Copy link to post`)}
-            onPress={() => {
-              if (showLoggedOutWarning) {
-                pwiWarningCopyControl.open()
-              } else {
-                onCopyLink()
-              }
-            }}>
+            onPress={onCopyLink}>
             <Menu.ItemText>
               <Trans>Copy link to post</Trans>
             </Menu.ItemText>
@@ -147,6 +131,16 @@ let ShareMenuItems = ({
           </Menu.Item>
         </Menu.Group>
 
+        {hideInPWI && (
+          <Menu.Group>
+            <Menu.ContainerItem>
+              <Admonition type="warning" style={[a.flex_1, a.border_0, a.p_0]}>
+                <Trans>This post is only visible to logged-in users.</Trans>
+              </Admonition>
+            </Menu.ContainerItem>
+          </Menu.Group>
+        )}
+
         {devModeEnabled && (
           <Menu.Group>
             <Menu.Item
@@ -171,26 +165,6 @@ let ShareMenuItems = ({
         )}
       </Menu.Outer>
 
-      <Prompt.Basic
-        control={pwiWarningShareControl}
-        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={onSharePost}
-        confirmButtonCta={_(msg`Share anyway`)}
-      />
-
-      <Prompt.Basic
-        control={pwiWarningCopyControl}
-        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`Copy anyway`)}
-      />
-
       <SendViaChatDialog
         control={sendViaChatControl}
         onSelectChat={onSelectChatToShareTo}