about summary refs log tree commit diff
path: root/src/view/shell/desktop/LeftNav.tsx
diff options
context:
space:
mode:
authorAnsh <anshnanda10@gmail.com>2023-08-22 11:01:00 -0700
committerGitHub <noreply@github.com>2023-08-22 11:01:00 -0700
commit16b265a86164e682486a3d8fa51bfa18d51bb945 (patch)
tree672a87170b11d9c9a6b7990f5b828da469981062 /src/view/shell/desktop/LeftNav.tsx
parent3aadc43c896e1c54552387f028a476d7d8ec2d3c (diff)
downloadvoidsky-16b265a86164e682486a3d8fa51bfa18d51bb945.tar.zst
[APP-834] Allow @ing someone in post directly from profile (#1241)
* setup `initMention` for mobile

* setup creating post with profile tagged on web
Diffstat (limited to 'src/view/shell/desktop/LeftNav.tsx')
-rw-r--r--src/view/shell/desktop/LeftNav.tsx17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx
index 700857bbe..b37befba6 100644
--- a/src/view/shell/desktop/LeftNav.tsx
+++ b/src/view/shell/desktop/LeftNav.tsx
@@ -150,7 +150,22 @@ const NavItem = observer(
 
 function ComposeBtn() {
   const store = useStores()
-  const onPressCompose = () => store.shell.openComposer({})
+  const {getState} = useNavigation()
+
+  const getProfileHandle = () => {
+    const {routes} = getState()
+    const currentRoute = routes[routes.length - 1]
+    if (currentRoute.name === 'Profile') {
+      const {name: handle} =
+        currentRoute.params as CommonNavigatorParams['Profile']
+      if (handle === store.me.handle) return undefined
+      return handle
+    }
+    return undefined
+  }
+
+  const onPressCompose = () =>
+    store.shell.openComposer({mention: getProfileHandle()})
 
   return (
     <TouchableOpacity