From 79546dc7990a98cdc992cb26b41235e9cec68173 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 4 Aug 2021 23:34:22 +0300 Subject: [PATCH] Message, Dialog: Various markup fixes, wider bubbles (#1356) --- src/components/middle/message/Message.scss | 17 ++++-- src/components/middle/message/Message.tsx | 8 ++- .../middle/message/_message-content.scss | 57 ++++++++++++++----- .../message/helpers/buildContentClassName.ts | 6 ++ src/components/ui/Modal.scss | 6 ++ 5 files changed, 74 insertions(+), 20 deletions(-) diff --git a/src/components/middle/message/Message.scss b/src/components/middle/message/Message.scss index ac9a6453..1d669046 100644 --- a/src/components/middle/message/Message.scss +++ b/src/components/middle/message/Message.scss @@ -14,7 +14,8 @@ --secondary-color: var(--color-text-secondary); --meta-safe-area-base: 2.25rem; --meta-safe-author-width: 0px; - --meta-safe-area-size: calc(var(--meta-safe-area-base) + var(--meta-safe-author-width)); + --meta-safe-area-extra-width: 0px; + --meta-safe-area-size: calc(var(--meta-safe-area-base) + var(--meta-safe-author-width) + var(--meta-safe-area-extra-width)); --deleting-translate-x: -50%; --select-message-scale: 0.9; --select-background-color: white; @@ -131,14 +132,22 @@ } &.has-views { - --meta-safe-area-size: calc(var(--meta-safe-area-base) + var(--meta-safe-author-width) + 4rem); + --meta-safe-area-extra-width: 4rem; } &.was-edited { - --meta-safe-area-size: calc(var(--meta-safe-area-base) + var(--meta-safe-author-width) + 2.5rem); + --meta-safe-area-extra-width: 2.5rem; &.has-views { - --meta-safe-area-size: calc(var(--meta-safe-area-base) + var(--meta-safe-author-width) + 7.5rem); + --meta-safe-area-extra-width: 7.5rem; + } + + html[lang=ru] & { + --meta-safe-area-extra-width: 3.5rem; + + &.has-views { + --meta-safe-area-extra-width: 8.5rem; + } } } diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index 27069a08..ca174630 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -334,6 +334,7 @@ const Message: FC = ({ hasThread, forceSenderName, hasComments: message.threadInfo && message.threadInfo.messagesCount > 0, + hasActionButton: canForward || canFocus, }); const withCommentButton = message.threadInfo && (!isInDocumentGroup || isLastInDocumentGroup) && messageListType === 'thread' && !noComments; @@ -580,6 +581,11 @@ const Message: FC = ({ ); const hasCustomAppendix = isLastInGroup && !textParts && !asForwarded && !hasThread; const shouldInlineMeta = !webPage && !animatedEmoji && textParts; + const textContentClass = buildClassName( + 'text-content', + shouldInlineMeta && 'with-meta', + outgoingStatus && 'with-outgoing-icon', + ); return (
@@ -688,7 +694,7 @@ const Message: FC = ({ )} {!animatedEmoji && textParts && ( -

+

{textParts} {shouldInlineMeta && ( .MessageMeta { position: relative; @@ -201,11 +216,23 @@ &.has-solid-background { padding: .3125rem .5rem .375rem; + .forwarded-message .text-content.with-meta { + &.with-outgoing-icon:last-child { + --meta-icon-width: .5rem; + } + + .MessageMeta { + bottom: -.25rem; + } + } + + .text-content.with-meta:last-child::after, .forwarded-message > .text-content:not(.with-meta):last-child::after { content: ''; display: inline-block; - width: var(--meta-safe-area-size); + width: calc(var(--meta-safe-area-size) + var(--meta-icon-width, 0px)); height: 1rem; + float: right; } } diff --git a/src/components/middle/message/helpers/buildContentClassName.ts b/src/components/middle/message/helpers/buildContentClassName.ts index 4e237a85..7d6a9fb3 100644 --- a/src/components/middle/message/helpers/buildContentClassName.ts +++ b/src/components/middle/message/helpers/buildContentClassName.ts @@ -16,6 +16,7 @@ export function buildContentClassName( hasThread, forceSenderName, hasComments, + hasActionButton, }: { hasReply?: boolean; customShape?: boolean | number; @@ -24,6 +25,7 @@ export function buildContentClassName( hasThread?: boolean; forceSenderName?: boolean; hasComments?: boolean; + hasActionButton?: boolean; } = {}, ) { const { @@ -41,6 +43,10 @@ export function buildContentClassName( classNames.push('text'); } + if (hasActionButton) { + classNames.push('has-action-button'); + } + if (customShape) { classNames.push('custom-shape'); if (video && video.isRound) { diff --git a/src/components/ui/Modal.scss b/src/components/ui/Modal.scss index 7179cf49..4f7fd817 100644 --- a/src/components/ui/Modal.scss +++ b/src/components/ui/Modal.scss @@ -8,6 +8,12 @@ } } + &.error { + .modal-content > div { + margin-top: 1rem; + } + } + &.narrow { .modal-dialog { max-width: 20rem;