diff --git a/js/modules/signal.js b/js/modules/signal.js index 4ab8b9caf..6448a786c 100644 --- a/js/modules/signal.js +++ b/js/modules/signal.js @@ -104,9 +104,6 @@ const { MessageDetail, } = require('../../ts/components/conversation/MessageDetail'); const { Quote } = require('../../ts/components/conversation/Quote'); -const { - TimerNotification, -} = require('../../ts/components/conversation/TimerNotification'); const { TypingBubble, } = require('../../ts/components/conversation/TypingBubble'); @@ -287,7 +284,6 @@ exports.setup = (options = {}) => { MessageBody, MessageDetail, Quote, - TimerNotification, Types: { Message: MediaGalleryMessage, }, diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 4c8e09a1a..c2484217f 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -890,6 +890,12 @@ text-align: center; } +.module-timer-notification__contact { + font-family: 'Public Sans'; + font-weight: bold; + padding-inline-end: $session-margin-xs; +} + .module-timer-notification__icon-container { margin-inline-start: auto; margin-inline-end: auto; @@ -931,7 +937,6 @@ & > div { align-self: center; justify-self: center; - display: flex; align-items: center; justify-content: center; } diff --git a/ts/components/conversation/ContactName.tsx b/ts/components/conversation/ContactName.tsx index 02252f909..ecbe6900d 100644 --- a/ts/components/conversation/ContactName.tsx +++ b/ts/components/conversation/ContactName.tsx @@ -4,7 +4,7 @@ import classNames from 'classnames'; import { Emojify } from './Emojify'; import { LocalizerType } from '../../types/Util'; -interface Props { +type Props = { phoneNumber: string; name?: string; profileName?: string; @@ -13,48 +13,46 @@ interface Props { boldProfileName?: Boolean; compact?: Boolean; shouldShowPubkey: Boolean; -} +}; -export class ContactName extends React.Component { - public render() { - const { - phoneNumber, - name, - profileName, - i18n, - module, - boldProfileName, - compact, - shouldShowPubkey, - } = this.props; - const prefix = module ? module : 'module-contact-name'; +export const ContactName = (props: Props) => { + const { + phoneNumber, + name, + profileName, + i18n, + module, + boldProfileName, + compact, + shouldShowPubkey, + } = props; + const prefix = module ? module : 'module-contact-name'; - const title = name ? name : phoneNumber; - const shouldShowProfile = Boolean(profileName || name); - const styles = (boldProfileName - ? { - fontWeight: 'bold', - } - : {}) as React.CSSProperties; - const textProfile = profileName || name || i18n('anonymous'); - const profileElement = shouldShowProfile ? ( - - - - ) : null; + const title = name ? name : phoneNumber; + const shouldShowProfile = Boolean(profileName || name); + const styles = (boldProfileName + ? { + fontWeight: 'bold', + } + : {}) as React.CSSProperties; + const textProfile = profileName || name || i18n('anonymous'); + const profileElement = shouldShowProfile ? ( + + + + ) : null; - const pubKeyElement = shouldShowPubkey ? ( - - - - ) : null; + const pubKeyElement = shouldShowPubkey ? ( + + + + ) : null; - return ( - - {profileElement} - {shouldShowProfile ? ' ' : null} - {pubKeyElement} - - ); - } -} + return ( + + {profileElement} + {shouldShowProfile ? ' ' : null} + {pubKeyElement} + + ); +}; diff --git a/ts/components/conversation/GroupNotification.tsx b/ts/components/conversation/GroupNotification.tsx index 62efb4bf8..3799a4027 100644 --- a/ts/components/conversation/GroupNotification.tsx +++ b/ts/components/conversation/GroupNotification.tsx @@ -17,14 +17,13 @@ interface Change { contacts?: Array; } -interface Props { +type Props = { changes: Array; -} +}; // This component is used to display group updates in the conversation view. // This is a not a "notification" as the name suggests, but a message inside the conversation export const GroupNotification = (props: Props) => { - function renderChange(change: Change) { const { isMe, contacts, type, newName } = change; const { i18n } = window; @@ -93,7 +92,6 @@ export const GroupNotification = (props: Props) => { } } - const { changes } = props; return (
@@ -104,5 +102,4 @@ export const GroupNotification = (props: Props) => { ))}
); - -} +}; diff --git a/ts/components/conversation/TimerNotification.tsx b/ts/components/conversation/TimerNotification.tsx index b7c5a7919..588f62ad3 100644 --- a/ts/components/conversation/TimerNotification.tsx +++ b/ts/components/conversation/TimerNotification.tsx @@ -2,30 +2,34 @@ import React from 'react'; import { ContactName } from './ContactName'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; import { missingCaseError } from '../../util/missingCaseError'; import { SessionIcon, SessionIconSize, SessionIconType } from '../session/icon'; -interface Props { +type Props = { type: 'fromOther' | 'fromMe' | 'fromSync'; phoneNumber: string; profileName?: string; name?: string; disabled: boolean; timespan: string; -} +}; -export class TimerNotification extends React.Component { - public renderContents() { - const { phoneNumber, profileName, timespan, type, disabled } = this.props; +export const TimerNotification = (props: Props) => { + function renderContents() { + const { phoneNumber, profileName, timespan, type, disabled } = props; const changeKey = disabled ? 'disabledDisappearingMessages' : 'theyChangedTheTimer'; - const displayedPubkey = profileName - ? window.shortenPubkey(phoneNumber) - : phoneNumber; + const contact = ( + + {profileName || phoneNumber} + + ); switch (type) { case 'fromOther': @@ -33,19 +37,7 @@ export class TimerNotification extends React.Component { , - timespan, - ]} + components={[contact, timespan]} /> ); case 'fromMe': @@ -61,21 +53,19 @@ export class TimerNotification extends React.Component { } } - public render() { - return ( -
-
-
- -
- -
{this.renderContents()}
+ return ( +
+
+
+
+ +
{renderContents()}
- ); - } -} +
+ ); +};