Skip to content

Commit

Permalink
fix(messenger): logic of description in conversation item
Browse files Browse the repository at this point in the history
Signed-off-by: clegirar <clemntgirard@gmail.com>
  • Loading branch information
clegirar committed Oct 14, 2020
1 parent 46a5061 commit cb864b6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions js/packages/components/main/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,17 @@ const ConversationsItem: React.FC<ConversationsItemProps> = (props) => {
type !== messengerpb.Conversation.Type.MultiMemberType &&
contactPublicKey.toString() === persistOpts.betabot.convPk.toString()
const isBetabotAdded = persistOpts && persistOpts.betabot.added

let description
if (isBetabot && !isBetabotAdded) {
description = 'Click here to add the Beta Bot!'
} else {
if (lastInte?.type === messengerpb.AppMessage.Type.TypeUserMessage) {
description = lastInte.payload.body
} else {
description = ''
}
}
console.log(isBetabot, isBetabotAdded, lastInte)
return !isIncoming ? (
<TouchableHighlight
underlayColor={color.light.grey}
Expand Down Expand Up @@ -483,13 +493,7 @@ const ConversationsItem: React.FC<ConversationsItemProps> = (props) => {
: text.color.grey,
]}
>
{lastInte?.type === messengerpb.AppMessage.Type.TypeUserMessage
? isBetabot && !isBetabotAdded
? 'Click here to add the Beta Bot!'
: lastInte.payload.body
: !isAccepted && type !== messengerpb.Conversation.Type.MultiMemberType
? 'Request is sent. Pending...'
: ''}
{description}
</Text>
</View>
</View>
Expand Down

0 comments on commit cb864b6

Please sign in to comment.