From cf1d5c66369f3e03dfc9806df4f39eb7cb96532a Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 2 May 2023 15:23:29 +0400 Subject: [PATCH] Message List: Tune the date position for full-width pinned messages (#3134) --- .../middle/HeaderPinnedMessage.module.scss | 3 --- src/components/middle/MiddleColumn.tsx | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/components/middle/HeaderPinnedMessage.module.scss b/src/components/middle/HeaderPinnedMessage.module.scss index 910e10c85..8872f4258 100644 --- a/src/components/middle/HeaderPinnedMessage.module.scss +++ b/src/components/middle/HeaderPinnedMessage.module.scss @@ -77,9 +77,6 @@ } @media (min-width: 1276px) { - transform: translate3d(0, 0, 0); - transition: opacity 0.15s ease, transform var(--layer-transition); - :global(#Main.right-column-open) & { padding-left: calc(var(--right-column-width) + 1rem); } diff --git a/src/components/middle/MiddleColumn.tsx b/src/components/middle/MiddleColumn.tsx index 67dcecafe..2c061bfdb 100644 --- a/src/components/middle/MiddleColumn.tsx +++ b/src/components/middle/MiddleColumn.tsx @@ -14,17 +14,16 @@ import type { import type { ThemeKey } from '../../types'; import { - MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN, MOBILE_SCREEN_MAX_WIDTH, MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, - SAFE_SCREEN_WIDTH_FOR_CHAT_INFO, ANIMATION_END_DELAY, DARK_THEME_BG_COLOR, LIGHT_THEME_BG_COLOR, SUPPORTED_IMAGE_CONTENT_TYPES, GENERAL_TOPIC_ID, TMP_CHAT_ID, + MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES, } from '../../config'; import { IS_ANDROID, IS_IOS, MASK_IMAGE_DISABLED } from '../../util/windowEnvironment'; import { DropAreaState } from './composer/DropArea'; @@ -106,6 +105,7 @@ type StateProps = { defaultBannedRights?: ApiChatBannedRights; hasPinned?: boolean; hasAudioPlayer?: boolean; + hasButtonInHeader?: boolean; pinnedMessagesCount?: number; theme: ThemeKey; customBackground?: string; @@ -156,6 +156,7 @@ const MiddleColumn: FC = ({ defaultBannedRights, hasPinned, hasAudioPlayer, + hasButtonInHeader, pinnedMessagesCount, customBackground, theme, @@ -221,14 +222,12 @@ const MiddleColumn: FC = ({ const closeAnimationDuration = isMobile ? LAYER_ANIMATION_DURATION_MS : undefined; const hasTools = hasPinned && ( windowWidth < MOBILE_SCREEN_MAX_WIDTH + || hasAudioPlayer || ( isRightColumnShown && windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN && windowWidth < SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN - ) || ( - windowWidth >= MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN - && windowWidth < SAFE_SCREEN_WIDTH_FOR_CHAT_INFO - && hasAudioPlayer ) + || (!isMobile && hasButtonInHeader && windowWidth < MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES) ); const renderingChatId = usePrevDuringAnimation(chatId, closeAnimationDuration); @@ -720,6 +719,7 @@ export default memo(withGlobal( || Boolean(!isPinnedMessageList && pinnedIds?.length) ), hasAudioPlayer: Boolean(audioMessage), + hasButtonInHeader: canStartBot || canRestartBot || canSubscribe || shouldSendJoinRequest, pinnedMessagesCount: pinnedIds ? pinnedIds.length : 0, shouldSkipHistoryAnimations, isChannel,