about summary refs log tree commit diff
path: root/src/view/shell
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/shell')
-rw-r--r--src/view/shell/Composer.tsx3
-rw-r--r--src/view/shell/Composer.web.tsx3
-rw-r--r--src/view/shell/desktop/LeftNav.tsx17
-rw-r--r--src/view/shell/index.tsx1
-rw-r--r--src/view/shell/index.web.tsx1
5 files changed, 24 insertions, 1 deletions
diff --git a/src/view/shell/Composer.tsx b/src/view/shell/Composer.tsx
index e87fea647..ac155887c 100644
--- a/src/view/shell/Composer.tsx
+++ b/src/view/shell/Composer.tsx
@@ -14,6 +14,7 @@ export const Composer = observer(
     onPost,
     onClose,
     quote,
+    mention,
   }: {
     active: boolean
     winHeight: number
@@ -21,6 +22,7 @@ export const Composer = observer(
     onPost?: ComposerOpts['onPost']
     onClose: () => void
     quote?: ComposerOpts['quote']
+    mention?: ComposerOpts['mention']
   }) => {
     const pal = usePalette('default')
     const initInterp = useAnimatedValue(0)
@@ -65,6 +67,7 @@ export const Composer = observer(
           onPost={onPost}
           onClose={onClose}
           quote={quote}
+          mention={mention}
         />
       </Animated.View>
     )
diff --git a/src/view/shell/Composer.web.tsx b/src/view/shell/Composer.web.tsx
index cf850aa4f..2effa0cca 100644
--- a/src/view/shell/Composer.web.tsx
+++ b/src/view/shell/Composer.web.tsx
@@ -15,6 +15,7 @@ export const Composer = observer(
     quote,
     onPost,
     onClose,
+    mention,
   }: {
     active: boolean
     winHeight: number
@@ -22,6 +23,7 @@ export const Composer = observer(
     quote: ComposerOpts['quote']
     onPost?: ComposerOpts['onPost']
     onClose: () => void
+    mention?: ComposerOpts['mention']
   }) => {
     const pal = usePalette('default')
 
@@ -40,6 +42,7 @@ export const Composer = observer(
             quote={quote}
             onPost={onPost}
             onClose={onClose}
+            mention={mention}
           />
         </View>
       </View>
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
diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx
index 7ab371d59..72e7facc8 100644
--- a/src/view/shell/index.tsx
+++ b/src/view/shell/index.tsx
@@ -68,6 +68,7 @@ const ShellInner = observer(() => {
         replyTo={store.shell.composerOpts?.replyTo}
         onPost={store.shell.composerOpts?.onPost}
         quote={store.shell.composerOpts?.quote}
+        mention={store.shell.composerOpts?.mention}
       />
       <ModalsContainer />
       <Lightbox />
diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx
index 5e3875268..16ed17a5b 100644
--- a/src/view/shell/index.web.tsx
+++ b/src/view/shell/index.web.tsx
@@ -49,6 +49,7 @@ const ShellInner = observer(() => {
         replyTo={store.shell.composerOpts?.replyTo}
         quote={store.shell.composerOpts?.quote}
         onPost={store.shell.composerOpts?.onPost}
+        mention={store.shell.composerOpts?.mention}
       />
       {!isDesktop && <BottomBarWeb />}
       <ModalsContainer />