From dd57147189182a62939a3b6dfb28281a316d166d Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 17 Aug 2020 17:43:05 +1000 Subject: [PATCH] chat: support hideAvatars and hideNicknames --- pkg/interface/src/apps/chat/components/lib/chat-message.tsx | 6 +++++- pkg/interface/src/apps/chat/components/lib/chat-window.tsx | 5 ++++- pkg/interface/src/apps/chat/components/lib/message.js | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/interface/src/apps/chat/components/lib/chat-message.tsx b/pkg/interface/src/apps/chat/components/lib/chat-message.tsx index 84b985417..3d8573927 100644 --- a/pkg/interface/src/apps/chat/components/lib/chat-message.tsx +++ b/pkg/interface/src/apps/chat/components/lib/chat-message.tsx @@ -15,7 +15,9 @@ export const ChatMessage = (props) => { group, association, contacts, - unreadRef + unreadRef, + hideAvatars, + hideNicknames } = props; // Render sigil if previous message is not by the same sender @@ -42,6 +44,8 @@ export const ChatMessage = (props) => { group={group} contacts={contacts} association={association} + hideNicknames={hideNicknames} + hideAvatars={hideAvatars} /> ); diff --git a/pkg/interface/src/apps/chat/components/lib/chat-window.tsx b/pkg/interface/src/apps/chat/components/lib/chat-window.tsx index 7e6302735..4035f5e6a 100644 --- a/pkg/interface/src/apps/chat/components/lib/chat-window.tsx +++ b/pkg/interface/src/apps/chat/components/lib/chat-window.tsx @@ -180,7 +180,10 @@ export class ChatWindow extends Component { nextMsg={messages[i + 1]} association={props.association} group={props.group} - contacts={props.contacts} /> + contacts={props.contacts} + hideAvatars={props.hideAvatars} + hideNicknames={props.hideNicknames} + /> )) } diff --git a/pkg/interface/src/apps/chat/components/lib/message.js b/pkg/interface/src/apps/chat/components/lib/message.js index 5f39bd5ec..cdf5010c3 100644 --- a/pkg/interface/src/apps/chat/components/lib/message.js +++ b/pkg/interface/src/apps/chat/components/lib/message.js @@ -51,7 +51,7 @@ const renderWithSigil = (props, timestamp) => { let color = '#000000'; let sigilClass = 'mix-blend-diff'; if (contact) { - name = (contact.nickname.length > 0 && !hideNicknames) + name = (contact.nickname.length > 0 && !props.hideNicknames) ? contact.nickname : `~${props.msg.author}`; color = `#${uxToHex(contact.color)}`; sigilClass = ''; @@ -70,7 +70,7 @@ const renderWithSigil = (props, timestamp) => { sigilClass={sigilClass} association={props.association} group={props.group} - hideAvatars={hideAvatars} + hideAvatars={props.hideAvatars} className="fl pr3 v-top bg-white bg-gray0-d" />