From d9f92fe076a2296af8b6dd2e528fe7412ea89464 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 4 Dec 2023 14:39:08 +0100 Subject: [PATCH] Story: Not run animation when forum is open (#4035) --- src/components/story/StoryToggler.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/story/StoryToggler.tsx b/src/components/story/StoryToggler.tsx index 380c0f5c0..8a60ea18a 100644 --- a/src/components/story/StoryToggler.tsx +++ b/src/components/story/StoryToggler.tsx @@ -4,7 +4,9 @@ import { getActions, withGlobal } from '../../global'; import type { ApiChat, ApiUser } from '../../api/types'; import { ANIMATION_END_DELAY, PREVIEW_AVATAR_COUNT } from '../../config'; -import { selectPerformanceSettingsValue, selectTabState } from '../../global/selectors'; +import { + selectIsForumPanelOpen, selectPerformanceSettingsValue, selectTabState, +} from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; import { animateClosing, animateOpening, ANIMATION_DURATION } from './helpers/ribbonAnimation'; @@ -26,6 +28,7 @@ interface StateProps { currentUserId: string; orderedPeerIds: string[]; isShown: boolean; + isForumPanelOpen?: boolean; withAnimation?: boolean; usersById: Record; chatsById: Record; @@ -40,6 +43,7 @@ function StoryToggler({ chatsById, canShow, isShown, + isForumPanelOpen, isArchived, withAnimation, }: OwnProps & StateProps) { @@ -69,7 +73,7 @@ function StoryToggler({ const { shouldRender, transitionClassNames } = useShowTransition(isVisible, undefined, undefined, 'slow'); useEffect(() => { - if (!withAnimation) return; + if (!withAnimation || isForumPanelOpen) return; if (isVisible) { dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY); animateClosing(isArchived); @@ -77,7 +81,7 @@ function StoryToggler({ dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY); animateOpening(isArchived); } - }, [isArchived, isVisible, withAnimation]); + }, [isArchived, isVisible, withAnimation, isForumPanelOpen]); if (!shouldRender) { return undefined; @@ -108,12 +112,14 @@ function StoryToggler({ export default memo(withGlobal((global, { isArchived }): StateProps => { const { orderedPeerIds: { archived, active } } = global.stories; const { storyViewer: { isRibbonShown, isArchivedRibbonShown } } = selectTabState(global); + const isForumPanelOpen = selectIsForumPanelOpen(global); const withAnimation = selectPerformanceSettingsValue(global, 'storyRibbonAnimations'); return { currentUserId: global.currentUserId!, orderedPeerIds: isArchived ? archived : active, isShown: isArchived ? !isArchivedRibbonShown : !isRibbonShown, + isForumPanelOpen, withAnimation, usersById: global.users.byId, chatsById: global.chats.byId,