From f57c85dc0d6121a2d2d5104d4e52f1495f049d0d Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 6 Oct 2020 15:45:27 +1100 Subject: [PATCH] hide pubkey when not needed on conversationHeader and listItem --- stylesheets/_modules.scss | 8 +++++++- ts/components/ConversationListItem.tsx | 7 ++++++- ts/components/conversation/ContactName.tsx | 2 +- ts/components/conversation/ConversationHeader.tsx | 11 +---------- ts/components/session/settings/SessionSettings.tsx | 2 -- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index c595ca77b..c3ac5b341 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -1112,7 +1112,7 @@ } .module-conversation-header__title { - margin-inline-start: 6px; + margin: 0px 20px; min-width: 0; font-size: 16px; @@ -1130,6 +1130,12 @@ align-items: center; -webkit-user-select: text; + + .module-contact-name__profile-name { + width: 100%; + overflow: hidden !important; + text-overflow: ellipsis; + } } .module-conversation-header__title__profile-name { diff --git a/ts/components/ConversationListItem.tsx b/ts/components/ConversationListItem.tsx index febf5e563..993ce5792 100644 --- a/ts/components/ConversationListItem.tsx +++ b/ts/components/ConversationListItem.tsx @@ -348,6 +348,11 @@ class ConversationListItem extends React.PureComponent { const displayedPubkey = profileName ? shortenedPubkey : phoneNumber; const displayName = isMe ? i18n('noteToSelf') : profileName; + let shouldShowPubkey = false; + if (!name || name.length === 0) { + shouldShowPubkey = true; + } + return (
{ module="module-conversation__user" i18n={window.i18n} boldProfileName={true} - shouldShowPubkey={false} + shouldShowPubkey={shouldShowPubkey} />
); diff --git a/ts/components/conversation/ContactName.tsx b/ts/components/conversation/ContactName.tsx index 0f3ab3414..02252f909 100644 --- a/ts/components/conversation/ContactName.tsx +++ b/ts/components/conversation/ContactName.tsx @@ -36,7 +36,7 @@ export class ContactName extends React.Component { fontWeight: 'bold', } : {}) as React.CSSProperties; - const textProfile = profileName || name || ''; + const textProfile = profileName || name || i18n('anonymous'); const profileElement = shouldShowProfile ? ( diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index c890cec6b..ba56d7fcf 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -179,16 +179,7 @@ class ConversationHeader extends React.Component { {text} ); - let title; - if (profileName) { - title = `${profileName}`; - } else { - if (name) { - title = `${name}`; - } else { - title = `User ${window.shortenPubkey(phoneNumber)}`; - } - } + const title = profileName || name || phoneNumber; return (
diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 5a3928e89..29193d1ca 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -583,8 +583,6 @@ export class SettingsView extends React.Component { title = window.i18n('anonymous'); } - title = `${title} ${window.shortenPubkey(blockedNumber)}`; - results.push({ id: blockedNumber, title,