/
Item.js
68 lines (62 loc) · 2.36 KB
/
Item.js
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
68
import React, { PureComponent } from 'react'
import { enums, fragments } from '../../../../graphql'
import { Avatar, Flex, Text } from '../../../Library'
import { borderBottom, marginLeft, padding } from '../../../../styles'
import { colors } from '../../../../constants'
import { showContact } from '../../../../helpers/contacts'
import { withNavigation } from 'react-navigation'
import ActionsUnknown from '../../../Library/ContactIdentityActions/ActionsUnknown'
import ActionsReceived from '../../../Library/ContactIdentityActions/ActionsReceived'
import ActionsSent from '../../../Library/ContactIdentityActions/ActionsSent'
import { withNamespaces } from 'react-i18next'
const Item = fragments.Contact(
class Item extends PureComponent {
async showDetails () {
const { data, context, navigation } = this.props
return showContact({ data, context, navigation })
}
render () {
const { data, ignoreMyself, t } = this.props
const { overrideDisplayName, displayName, status } = data
if (
ignoreMyself &&
status === enums.BertyEntityContactInputStatus.Myself
) {
return null
}
return (
<Flex.Cols
align='center'
style={[{ height: 72 }, padding, borderBottom]}
onPress={() => this.showDetails()}
>
<Flex.Cols size={1} align='center'>
<Avatar data={data} size={40} />
<Flex.Rows size={3} justify='start' style={[marginLeft]}>
<Text color={colors.fakeBlack} left ellipsed>
{overrideDisplayName || displayName}
</Text>
<Text color={colors.subtleGrey} left ellipsed tiny>
{t(
`contacts.statuses.${
enums.ValueBertyEntityContactInputStatus[status]
}`
)}
</Text>
</Flex.Rows>
</Flex.Cols>
{status === enums.BertyEntityContactInputStatus.Unknown && (
<ActionsUnknown data={data} />
)}
{status === enums.BertyEntityContactInputStatus.RequestedMe && (
<ActionsReceived data={data} />
)}
{status === enums.BertyEntityContactInputStatus.IsRequested && (
<ActionsSent data={data} />
)}
</Flex.Cols>
)
}
}
)
export default withNavigation(withNamespaces()(Item))