Message List: Tune the date position for full-width pinned messages (#3134)

This commit is contained in:
Alexander Zinchuk 2023-05-02 15:23:29 +04:00
parent 1e6f16ab33
commit cf1d5c6636
2 changed files with 6 additions and 9 deletions

View File

@ -77,9 +77,6 @@
} }
@media (min-width: 1276px) { @media (min-width: 1276px) {
transform: translate3d(0, 0, 0);
transition: opacity 0.15s ease, transform var(--layer-transition);
:global(#Main.right-column-open) & { :global(#Main.right-column-open) & {
padding-left: calc(var(--right-column-width) + 1rem); padding-left: calc(var(--right-column-width) + 1rem);
} }

View File

@ -14,17 +14,16 @@ import type {
import type { ThemeKey } from '../../types'; import type { ThemeKey } from '../../types';
import { import {
MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN,
MOBILE_SCREEN_MAX_WIDTH, MOBILE_SCREEN_MAX_WIDTH,
MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,
SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,
SAFE_SCREEN_WIDTH_FOR_CHAT_INFO,
ANIMATION_END_DELAY, ANIMATION_END_DELAY,
DARK_THEME_BG_COLOR, DARK_THEME_BG_COLOR,
LIGHT_THEME_BG_COLOR, LIGHT_THEME_BG_COLOR,
SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_IMAGE_CONTENT_TYPES,
GENERAL_TOPIC_ID, GENERAL_TOPIC_ID,
TMP_CHAT_ID, TMP_CHAT_ID,
MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES,
} from '../../config'; } from '../../config';
import { IS_ANDROID, IS_IOS, MASK_IMAGE_DISABLED } from '../../util/windowEnvironment'; import { IS_ANDROID, IS_IOS, MASK_IMAGE_DISABLED } from '../../util/windowEnvironment';
import { DropAreaState } from './composer/DropArea'; import { DropAreaState } from './composer/DropArea';
@ -106,6 +105,7 @@ type StateProps = {
defaultBannedRights?: ApiChatBannedRights; defaultBannedRights?: ApiChatBannedRights;
hasPinned?: boolean; hasPinned?: boolean;
hasAudioPlayer?: boolean; hasAudioPlayer?: boolean;
hasButtonInHeader?: boolean;
pinnedMessagesCount?: number; pinnedMessagesCount?: number;
theme: ThemeKey; theme: ThemeKey;
customBackground?: string; customBackground?: string;
@ -156,6 +156,7 @@ const MiddleColumn: FC<OwnProps & StateProps> = ({
defaultBannedRights, defaultBannedRights,
hasPinned, hasPinned,
hasAudioPlayer, hasAudioPlayer,
hasButtonInHeader,
pinnedMessagesCount, pinnedMessagesCount,
customBackground, customBackground,
theme, theme,
@ -221,14 +222,12 @@ const MiddleColumn: FC<OwnProps & StateProps> = ({
const closeAnimationDuration = isMobile ? LAYER_ANIMATION_DURATION_MS : undefined; const closeAnimationDuration = isMobile ? LAYER_ANIMATION_DURATION_MS : undefined;
const hasTools = hasPinned && ( const hasTools = hasPinned && (
windowWidth < MOBILE_SCREEN_MAX_WIDTH windowWidth < MOBILE_SCREEN_MAX_WIDTH
|| hasAudioPlayer
|| ( || (
isRightColumnShown && windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN isRightColumnShown && windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN
&& windowWidth < SAFE_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); const renderingChatId = usePrevDuringAnimation(chatId, closeAnimationDuration);
@ -720,6 +719,7 @@ export default memo(withGlobal<OwnProps>(
|| Boolean(!isPinnedMessageList && pinnedIds?.length) || Boolean(!isPinnedMessageList && pinnedIds?.length)
), ),
hasAudioPlayer: Boolean(audioMessage), hasAudioPlayer: Boolean(audioMessage),
hasButtonInHeader: canStartBot || canRestartBot || canSubscribe || shouldSendJoinRequest,
pinnedMessagesCount: pinnedIds ? pinnedIds.length : 0, pinnedMessagesCount: pinnedIds ? pinnedIds.length : 0,
shouldSkipHistoryAnimations, shouldSkipHistoryAnimations,
isChannel, isChannel,