Skip to content

Commit

Permalink
fix(web): import on top of file
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Jan 29, 2019
1 parent d330533 commit 69a3474
Showing 1 changed file with 38 additions and 23 deletions.
61 changes: 38 additions & 23 deletions client/react-native/common/components/Screens/Chats/List.js
@@ -1,5 +1,13 @@
import React, { PureComponent } from 'react'
import { Avatar, EmptyList, Flex, Header, Screen, Text, Icon } from '../../Library'
import {
Avatar,
EmptyList,
Flex,
Header,
Screen,
Text,
Icon,
} from '../../Library'
import { BertyP2pKindInputKind } from '../../../graphql/enums.gen'
import { Pagination, QueryReducer, RelayContext } from '../../../relay'
import { borderBottom, marginLeft, padding } from '../../../styles'
Expand All @@ -9,6 +17,7 @@ import { parseEmbedded } from '../../../helpers/json'
import { conversation as utils } from '../../../utils'
import { withNamespaces } from 'react-i18next'
import I18n from 'i18next'
import { hook } from 'cavy'

class StateBadge extends PureComponent {
constructor (props) {
Expand All @@ -29,28 +38,28 @@ class StateBadge extends PureComponent {
const { other, context } = this.props
other.contact.devices.forEach(element => {
context.queries.Libp2PPing.fetch({ str: element.contactId })
.then(
(e) => {
console.log('fetch ret', e)
if (e.ret === true) {
this.setState({
color: colors.green,
})
}
.then(e => {
console.log('fetch ret', e)
if (e.ret === true) {
this.setState({
color: colors.green,
})
}
).catch(
(e) => console.warn('err', e)
)
})
.catch(e => console.warn('err', e))
})
}

render () {
return (<Icon style={{ color: this.state.color }} name={'material-checkbox-blank-circle'} />)
return (
<Icon
style={{ color: this.state.color }}
name={'material-checkbox-blank-circle'}
/>
)
}
}

import { hook } from 'cavy'

const Message = withNamespaces()(({ data, t, ...props }) => {
switch (data.kind) {
case BertyP2pKindInputKind.ConversationNewMessage:
Expand Down Expand Up @@ -139,15 +148,21 @@ const ItemBase = fragments.Conversation(({ data, navigation, t }) => {
>
<Flex.Rows size={1} align='center'>
<Avatar data={data} size={40} />
{data.members.length === 2
? <RelayContext.Consumer>
{context => <StateBadge
other={data.members.find(element => element.contact.status !== enums.BertyEntityContactInputStatus.Myself)}
// other={data.members}
context={context} />}
{data.members.length === 2 ? (
<RelayContext.Consumer>
{context => (
<StateBadge
other={data.members.find(
element =>
element.contact.status !==
enums.BertyEntityContactInputStatus.Myself
)}
// other={data.members}
context={context}
/>
)}
</RelayContext.Consumer>
: null
}
) : null}
</Flex.Rows>
<Flex.Rows size={7} align='stretch' justify='center' style={[marginLeft]}>
<Text color={colors.black} left middle bold={!isRead}>
Expand Down

0 comments on commit 69a3474

Please sign in to comment.