about summary refs log tree commit diff
path: root/src/components/dms/ActionsWrapper.tsx
blob: 385086d7cd9bfaa0102edb2cb6387f947100e42a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import {View} from 'react-native'
import {ChatBskyConvoDefs} from '@atproto/api'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'

import {atoms as a} from '#/alf'
import {MessageContextMenu} from '#/components/dms/MessageContextMenu'

export function ActionsWrapper({
  message,
  isFromSelf,
  children,
}: {
  message: ChatBskyConvoDefs.MessageView
  isFromSelf: boolean
  children: React.ReactNode
}) {
  const {_} = useLingui()

  return (
    <MessageContextMenu message={message}>
      {trigger =>
        // will always be true, since this file is platform split
        trigger.isNative && (
          <View style={[a.flex_1, a.relative]}>
            {/* {isNative && (
              <View
                style={[
                  a.rounded_full,
                  a.absolute,
                  {bottom: '100%'},
                  isFromSelf ? a.right_0 : a.left_0,
                  t.atoms.bg,
                  a.flex_row,
                  a.shadow_lg,
                  a.py_xs,
                  a.px_md,
                  a.gap_md,
                  a.mb_xs,
                ]}>
                {['👍', '😆', '❤️', '👀', '😢'].map(emoji => (
                  <Text key={emoji} style={[a.text_center, {fontSize: 32}]}>
                    {emoji}
                  </Text>
                ))}
              </View>
            )} */}
            <View
              style={[
                {maxWidth: '80%'},
                isFromSelf
                  ? [a.self_end, a.align_end]
                  : [a.self_start, a.align_start],
              ]}
              accessible={true}
              accessibilityActions={[
                {name: 'activate', label: _(msg`Open message options`)},
              ]}
              onAccessibilityAction={trigger.control.open}>
              {children}
            </View>
          </View>
        )
      }
    </MessageContextMenu>
  )
}