From 7b7a80a2dd67bb1adb8802aa1ce05a224f2fb6fd Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 22 Aug 2022 12:57:03 +1000 Subject: [PATCH] fix: add new designs of typing message settings with animation --- stylesheets/_session.scss | 2 +- .../SessionMessagesListContainer.tsx | 11 ---- ts/components/conversation/TypingBubble.tsx | 3 -- .../settings/SessionSettingListItem.tsx | 50 +++++++++++++++---- ts/components/settings/SessionSettings.tsx | 2 - .../settings/section/CategoryPrivacy.tsx | 14 ++++++ 6 files changed, 56 insertions(+), 26 deletions(-) diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index abc6a0775..c5c7a5d9e 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -192,7 +192,7 @@ textarea { &.brand { min-width: 165px; - height: 45px; + height: 34px; align-items: center; padding: 0px var(--margins-lg); font-size: $session-font-md; diff --git a/ts/components/conversation/SessionMessagesListContainer.tsx b/ts/components/conversation/SessionMessagesListContainer.tsx index 02508dfd6..e7e5663b0 100644 --- a/ts/components/conversation/SessionMessagesListContainer.tsx +++ b/ts/components/conversation/SessionMessagesListContainer.tsx @@ -7,8 +7,6 @@ import { connect } from 'react-redux'; import { SessionMessagesList } from './SessionMessagesList'; import autoBind from 'auto-bind'; -import { ConversationTypeEnum } from '../../models/conversationAttributes'; -import { getConversationController } from '../../session/conversations'; import { quotedMessageToAnimate, ReduxConversationType, @@ -93,13 +91,6 @@ class SessionMessagesListContainerInner extends React.Component { return null; } - let displayedName = null; - if (conversation.type === ConversationTypeEnum.PRIVATE) { - displayedName = getConversationController().getContactProfileNameOrShortenedPubKey( - conversationKey - ); - } - return (
{ data-testid="messages-container" > diff --git a/ts/components/conversation/TypingBubble.tsx b/ts/components/conversation/TypingBubble.tsx index 20e78f905..9f9dbe999 100644 --- a/ts/components/conversation/TypingBubble.tsx +++ b/ts/components/conversation/TypingBubble.tsx @@ -5,9 +5,6 @@ import styled from 'styled-components'; import { ConversationTypeEnum } from '../../models/conversationAttributes'; interface TypingBubbleProps { - avatarPath?: string; - pubkey: string; - displayedName: string | null; conversationType: ConversationTypeEnum; isTyping: boolean; } diff --git a/ts/components/settings/SessionSettingListItem.tsx b/ts/components/settings/SessionSettingListItem.tsx index aadc29dc6..6c4253d2d 100644 --- a/ts/components/settings/SessionSettingListItem.tsx +++ b/ts/components/settings/SessionSettingListItem.tsx @@ -32,12 +32,24 @@ const StyledInfo = styled.div` padding-inline-end: var(--margins-lg); `; -const SettingsTitleAndDescription = (props: { title?: string; description?: string }) => { +const StyledDescriptionContainer = styled(StyledDescription)` + display: flex; + align-items: center; +`; + +const SettingsTitleAndDescription = (props: { + title?: string; + description?: string; + childrenDescription?: React.ReactNode; +}) => { + const { description, childrenDescription, title } = props; return ( - {props.title} - - {props.description && {props.description}} + {title} + + {description && {description}} + <>{childrenDescription} + ); }; @@ -46,13 +58,20 @@ export const SessionSettingsItemWrapper = (props: { inline: boolean; title?: string; description?: string; + isTypingMessageItem?: boolean; children?: React.ReactNode; + childrenDescription?: React.ReactNode; }) => { - const ComponentToRender = props.inline ? StyledSettingItemInline : StyledSettingItem; + const { inline, children, description, title, childrenDescription } = props; + const ComponentToRender = inline ? StyledSettingItemInline : StyledSettingItem; return ( - -
{props.children}
+ +
{children}
); }; @@ -79,11 +98,24 @@ export const SessionToggleWithDescription = (props: { active: boolean; onClickToggle: () => void; confirmationDialogParams?: SessionConfirmDialogProps; + childrenDescription?: React.ReactNode; // if set, those elements will be appended next to description field (only used for typing message settings as of now) }) => { - const { title, description, active, onClickToggle, confirmationDialogParams } = props; + const { + title, + description, + active, + onClickToggle, + confirmationDialogParams, + childrenDescription, + } = props; return ( - + { + return ( + <> + + + + + ); +}; + export const SettingsCategoryPrivacy = (props: { hasPassword: boolean | null; onPasswordUpdated: (action: string) => void; @@ -68,6 +81,7 @@ export const SettingsCategoryPrivacy = (props: { title={window.i18n('typingIndicatorsSettingTitle')} description={window.i18n('typingIndicatorsSettingDescription')} active={Boolean(window.getSettingValue(SettingsKey.settingsTypingIndicator))} + childrenDescription={} /> {