Message List: Remove extra padding in channels

This commit is contained in:
Alexander Zinchuk 2021-05-12 03:13:17 +03:00
parent f06ef4bd41
commit b96643ea2a
3 changed files with 10 additions and 12 deletions

View File

@ -44,17 +44,19 @@
} }
} }
&.bottom-padding { &.no-composer {
margin-bottom: 0;
.messages-container { .messages-container {
padding-bottom: 1rem; padding-bottom: 1rem;
} }
&-big { &.type-pinned {
.messages-container { .messages-container {
padding-bottom: 4.75rem; padding-bottom: 5rem;
@media (max-width: 600px) { @media (max-width: 600px) {
padding-bottom: 3.5rem; padding-bottom: 3.75rem;
} }
} }
} }

View File

@ -30,7 +30,6 @@ import {
isChatChannel, isChatChannel,
isChatPrivate, isChatPrivate,
isOwnMessage, isOwnMessage,
getCanPostInChat,
} from '../../modules/helpers'; } from '../../modules/helpers';
import { import {
compact, compact,
@ -65,15 +64,14 @@ type OwnProps = {
chatId: number; chatId: number;
threadId: number; threadId: number;
type: MessageListType; type: MessageListType;
canPost: boolean;
onFabToggle: (show: boolean) => void; onFabToggle: (show: boolean) => void;
hasTools?: boolean; hasTools?: boolean;
bottomOffset: 'none' | 'small' | 'big';
}; };
type StateProps = { type StateProps = {
isChatLoaded?: boolean; isChatLoaded?: boolean;
isChannelChat?: boolean; isChannelChat?: boolean;
canPost?: boolean;
isChatWithSelf?: boolean; isChatWithSelf?: boolean;
messageIds?: number[]; messageIds?: number[];
messagesById?: Record<number, ApiMessage>; messagesById?: Record<number, ApiMessage>;
@ -119,7 +117,6 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
isChatLoaded, isChatLoaded,
isChannelChat, isChannelChat,
canPost, canPost,
bottomOffset,
isChatWithSelf, isChatWithSelf,
messageIds, messageIds,
messagesById, messagesById,
@ -505,8 +502,8 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
'MessageList custom-scroll', 'MessageList custom-scroll',
!withUsers && 'no-avatars', !withUsers && 'no-avatars',
isChannelChat && 'no-avatars', isChannelChat && 'no-avatars',
(!canPost || bottomOffset !== 'none') && 'bottom-padding', !canPost && 'no-composer',
(bottomOffset !== 'none') && `bottom-padding-${bottomOffset}`, type === 'pinned' && 'type-pinned',
isSelectModeActive && 'select-mode-active', isSelectModeActive && 'select-mode-active',
hasFocusing && 'has-focusing', hasFocusing && 'has-focusing',
isScrolled && 'scrolled', isScrolled && 'scrolled',
@ -758,7 +755,6 @@ export default memo(withGlobal<OwnProps>(
isRestricted, isRestricted,
restrictionReason, restrictionReason,
isChannelChat: isChatChannel(chat), isChannelChat: isChatChannel(chat),
canPost: getCanPostInChat(chat, threadId),
isChatWithSelf: selectIsChatWithSelf(global, chatId), isChatWithSelf: selectIsChatWithSelf(global, chatId),
messageIds, messageIds,
messagesById, messagesById,

View File

@ -234,9 +234,9 @@ const MiddleColumn: FC<StateProps & DispatchProps> = ({
chatId={renderingChatId} chatId={renderingChatId}
threadId={renderingThreadId} threadId={renderingThreadId}
type={renderingMessageListType} type={renderingMessageListType}
canPost={renderingCanPost}
hasTools={hasTools} hasTools={hasTools}
onFabToggle={setIsFabShown} onFabToggle={setIsFabShown}
bottomOffset={renderingCanPost ? 'none' : (isPinnedMessageList ? 'big' : 'small')}
/> />
<div className={buildClassName('middle-column-footer', !renderingCanPost && 'no-composer')}> <div className={buildClassName('middle-column-footer', !renderingCanPost && 'no-composer')}>
{renderingCanPost && ( {renderingCanPost && (