Clean up bold check

pull/388/head
Beaudan 6 years ago
parent 3ea3a394e7
commit 86e55e5dc6

@ -48,7 +48,9 @@ class LokiPublicServerAPI {
this.channels = []; this.channels = [];
} }
findOrCreateChannel(channelId, conversationId) { findOrCreateChannel(channelId, conversationId) {
let thisChannel = this.channels.find(channel => channel.channelId === channelId); let thisChannel = this.channels.find(
channel => channel.channelId === channelId
);
if (!thisChannel) { if (!thisChannel) {
thisChannel = new LokiPublicChannelAPI(this, channelId, conversationId); thisChannel = new LokiPublicChannelAPI(this, channelId, conversationId);
this.channels.push(thisChannel); this.channels.push(thisChannel);

@ -15,22 +15,30 @@ interface Props {
export class ContactName extends React.Component<Props> { export class ContactName extends React.Component<Props> {
public render() { public render() {
const { phoneNumber, name, profileName, i18n, module, boldProfileName } = this.props; const {
phoneNumber,
name,
profileName,
i18n,
module,
boldProfileName,
} = this.props;
const prefix = module ? module : 'module-contact-name'; const prefix = module ? module : 'module-contact-name';
const title = name ? name : phoneNumber; const title = name ? name : phoneNumber;
const shouldShowProfile = Boolean(profileName && !name); const shouldShowProfile = Boolean(profileName && !name);
const profileElement = shouldShowProfile ? const styles = (boldProfileName
(boldProfileName ? ( ? {
<span className={`${prefix}__profile-name`}> fontWeight: 'bold',
<b><Emojify text={profileName || ''} i18n={i18n} /></b> }
</span> : {}) as React.CSSProperties;
) : ( const profileElement = shouldShowProfile ? (
<span className={`${prefix}__profile-name`}> <span style={styles} className={`${prefix}__profile-name`}>
<b>
<Emojify text={profileName || ''} i18n={i18n} /> <Emojify text={profileName || ''} i18n={i18n} />
</span> </b>
)) </span>
: null; ) : null;
return ( return (
<span className={prefix} dir="auto"> <span className={prefix} dir="auto">

@ -307,7 +307,10 @@ export class Message extends React.PureComponent<Props, State> {
return ( return (
<div className="module-message__author"> <div className="module-message__author">
<ContactName <ContactName
phoneNumber={`(...${authorPhoneNumber.substring(authorPhoneNumber.length - 6, authorPhoneNumber.length)})`} phoneNumber={`(...${authorPhoneNumber.substring(
authorPhoneNumber.length - 6,
authorPhoneNumber.length
)})`}
name={authorName} name={authorName}
profileName={authorProfileName} profileName={authorProfileName}
module="module-message__author" module="module-message__author"

Loading…
Cancel
Save