From b96643ea2a00980ced35b50d1d58c2593d735603 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 12 May 2021 03:13:17 +0300 Subject: [PATCH] Message List: Remove extra padding in channels --- src/components/middle/MessageList.scss | 10 ++++++---- src/components/middle/MessageList.tsx | 10 +++------- src/components/middle/MiddleColumn.tsx | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/middle/MessageList.scss b/src/components/middle/MessageList.scss index 132c11ba..960fabd8 100644 --- a/src/components/middle/MessageList.scss +++ b/src/components/middle/MessageList.scss @@ -44,17 +44,19 @@ } } - &.bottom-padding { + &.no-composer { + margin-bottom: 0; + .messages-container { padding-bottom: 1rem; } - &-big { + &.type-pinned { .messages-container { - padding-bottom: 4.75rem; + padding-bottom: 5rem; @media (max-width: 600px) { - padding-bottom: 3.5rem; + padding-bottom: 3.75rem; } } } diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index 21e83357..e563f6f6 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -30,7 +30,6 @@ import { isChatChannel, isChatPrivate, isOwnMessage, - getCanPostInChat, } from '../../modules/helpers'; import { compact, @@ -65,15 +64,14 @@ type OwnProps = { chatId: number; threadId: number; type: MessageListType; + canPost: boolean; onFabToggle: (show: boolean) => void; hasTools?: boolean; - bottomOffset: 'none' | 'small' | 'big'; }; type StateProps = { isChatLoaded?: boolean; isChannelChat?: boolean; - canPost?: boolean; isChatWithSelf?: boolean; messageIds?: number[]; messagesById?: Record; @@ -119,7 +117,6 @@ const MessageList: FC = ({ isChatLoaded, isChannelChat, canPost, - bottomOffset, isChatWithSelf, messageIds, messagesById, @@ -505,8 +502,8 @@ const MessageList: FC = ({ 'MessageList custom-scroll', !withUsers && 'no-avatars', isChannelChat && 'no-avatars', - (!canPost || bottomOffset !== 'none') && 'bottom-padding', - (bottomOffset !== 'none') && `bottom-padding-${bottomOffset}`, + !canPost && 'no-composer', + type === 'pinned' && 'type-pinned', isSelectModeActive && 'select-mode-active', hasFocusing && 'has-focusing', isScrolled && 'scrolled', @@ -758,7 +755,6 @@ export default memo(withGlobal( isRestricted, restrictionReason, isChannelChat: isChatChannel(chat), - canPost: getCanPostInChat(chat, threadId), isChatWithSelf: selectIsChatWithSelf(global, chatId), messageIds, messagesById, diff --git a/src/components/middle/MiddleColumn.tsx b/src/components/middle/MiddleColumn.tsx index c1ad3d06..b9c8f40c 100644 --- a/src/components/middle/MiddleColumn.tsx +++ b/src/components/middle/MiddleColumn.tsx @@ -234,9 +234,9 @@ const MiddleColumn: FC = ({ chatId={renderingChatId} threadId={renderingThreadId} type={renderingMessageListType} + canPost={renderingCanPost} hasTools={hasTools} onFabToggle={setIsFabShown} - bottomOffset={renderingCanPost ? 'none' : (isPinnedMessageList ? 'big' : 'small')} />
{renderingCanPost && (