about summary refs log tree commit diff
path: root/src/components/dms/ConvoMenu.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-09 09:07:57 -0700
committerGitHub <noreply@github.com>2024-05-09 09:07:57 -0700
commit2fe76333bc6161d78c9f9b43f4855ff6919de507 (patch)
treec33e1df9f7b2829df62173fd956e45a45c05cdc8 /src/components/dms/ConvoMenu.tsx
parent55ac287d5e822a24c201d6f756b2d0ab76df242c (diff)
downloadvoidsky-2fe76333bc6161d78c9f9b43f4855ff6919de507.tar.zst
[🐴] Add hover context menu for convo list on web (#3923)
* remove some unnecessary props

* add hover trigger on web for convo list

* lint

* use `UserAvatar` to not affect accessibility

* remove extra wrapper

* add `label`

* always show on mobile

* adjust size of dots

* make the message trigger dots the same size

* ❓
Diffstat (limited to 'src/components/dms/ConvoMenu.tsx')
-rw-r--r--src/components/dms/ConvoMenu.tsx50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/components/dms/ConvoMenu.tsx b/src/components/dms/ConvoMenu.tsx
index 263befd56..cac4eb4d9 100644
--- a/src/components/dms/ConvoMenu.tsx
+++ b/src/components/dms/ConvoMenu.tsx
@@ -1,5 +1,5 @@
 import React, {useCallback} from 'react'
-import {Keyboard, Pressable} from 'react-native'
+import {Keyboard, Pressable, View} from 'react-native'
 import {AppBskyActorDefs} from '@atproto/api'
 import {ChatBskyConvoDefs} from '@atproto-labs/api'
 import {msg, Trans} from '@lingui/macro'
@@ -32,17 +32,19 @@ let ConvoMenu = ({
   profile,
   onUpdateConvo,
   control,
-  hideTrigger,
   currentScreen,
   showMarkAsRead,
+  hideTrigger,
+  triggerOpacity,
 }: {
   convo: ChatBskyConvoDefs.ConvoView
   profile: AppBskyActorDefs.ProfileViewBasic
   onUpdateConvo?: (convo: ChatBskyConvoDefs.ConvoView) => void
   control?: Menu.MenuControlProps
-  hideTrigger?: boolean
   currentScreen: 'list' | 'conversation'
   showMarkAsRead?: boolean
+  hideTrigger?: boolean
+  triggerOpacity?: number
 }): React.ReactNode => {
   const navigation = useNavigation<NavigationProp>()
   const {_} = useLingui()
@@ -89,26 +91,28 @@ let ConvoMenu = ({
     <>
       <Menu.Root control={control}>
         {!hideTrigger && (
-          <Menu.Trigger label={_(msg`Chat settings`)}>
-            {({props, state}) => (
-              <Pressable
-                {...props}
-                onPress={() => {
-                  Keyboard.dismiss()
-                  // eslint-disable-next-line react/prop-types -- eslint is confused by the name `props`
-                  props.onPress()
-                }}
-                style={[
-                  a.p_sm,
-                  a.rounded_sm,
-                  (state.hovered || state.pressed) && t.atoms.bg_contrast_25,
-                  // make sure pfp is in the middle
-                  {marginLeft: -10},
-                ]}>
-                <DotsHorizontal size="lg" style={t.atoms.text} />
-              </Pressable>
-            )}
-          </Menu.Trigger>
+          <View style={{opacity: triggerOpacity}}>
+            <Menu.Trigger label={_(msg`Chat settings`)}>
+              {({props, state}) => (
+                <Pressable
+                  {...props}
+                  onPress={() => {
+                    Keyboard.dismiss()
+                    // eslint-disable-next-line react/prop-types -- eslint is confused by the name `props`
+                    props.onPress()
+                  }}
+                  style={[
+                    a.p_sm,
+                    a.rounded_full,
+                    (state.hovered || state.pressed) && t.atoms.bg_contrast_25,
+                    // make sure pfp is in the middle
+                    {marginLeft: -10},
+                  ]}>
+                  <DotsHorizontal size="md" style={t.atoms.text} />
+                </Pressable>
+              )}
+            </Menu.Trigger>
+          </View>
         )}
         <Menu.Outer>
           <Menu.Group>