Story: Not run animation when forum is open (#4035)
This commit is contained in:
parent
84084667be
commit
d9f92fe076
@ -4,7 +4,9 @@ import { getActions, withGlobal } from '../../global';
|
|||||||
import type { ApiChat, ApiUser } from '../../api/types';
|
import type { ApiChat, ApiUser } from '../../api/types';
|
||||||
|
|
||||||
import { ANIMATION_END_DELAY, PREVIEW_AVATAR_COUNT } from '../../config';
|
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 buildClassName from '../../util/buildClassName';
|
||||||
import { animateClosing, animateOpening, ANIMATION_DURATION } from './helpers/ribbonAnimation';
|
import { animateClosing, animateOpening, ANIMATION_DURATION } from './helpers/ribbonAnimation';
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ interface StateProps {
|
|||||||
currentUserId: string;
|
currentUserId: string;
|
||||||
orderedPeerIds: string[];
|
orderedPeerIds: string[];
|
||||||
isShown: boolean;
|
isShown: boolean;
|
||||||
|
isForumPanelOpen?: boolean;
|
||||||
withAnimation?: boolean;
|
withAnimation?: boolean;
|
||||||
usersById: Record<string, ApiUser>;
|
usersById: Record<string, ApiUser>;
|
||||||
chatsById: Record<string, ApiChat>;
|
chatsById: Record<string, ApiChat>;
|
||||||
@ -40,6 +43,7 @@ function StoryToggler({
|
|||||||
chatsById,
|
chatsById,
|
||||||
canShow,
|
canShow,
|
||||||
isShown,
|
isShown,
|
||||||
|
isForumPanelOpen,
|
||||||
isArchived,
|
isArchived,
|
||||||
withAnimation,
|
withAnimation,
|
||||||
}: OwnProps & StateProps) {
|
}: OwnProps & StateProps) {
|
||||||
@ -69,7 +73,7 @@ function StoryToggler({
|
|||||||
const { shouldRender, transitionClassNames } = useShowTransition(isVisible, undefined, undefined, 'slow');
|
const { shouldRender, transitionClassNames } = useShowTransition(isVisible, undefined, undefined, 'slow');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!withAnimation) return;
|
if (!withAnimation || isForumPanelOpen) return;
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);
|
dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);
|
||||||
animateClosing(isArchived);
|
animateClosing(isArchived);
|
||||||
@ -77,7 +81,7 @@ function StoryToggler({
|
|||||||
dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);
|
dispatchHeavyAnimationEvent(ANIMATION_DURATION + ANIMATION_END_DELAY);
|
||||||
animateOpening(isArchived);
|
animateOpening(isArchived);
|
||||||
}
|
}
|
||||||
}, [isArchived, isVisible, withAnimation]);
|
}, [isArchived, isVisible, withAnimation, isForumPanelOpen]);
|
||||||
|
|
||||||
if (!shouldRender) {
|
if (!shouldRender) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -108,12 +112,14 @@ function StoryToggler({
|
|||||||
export default memo(withGlobal<OwnProps>((global, { isArchived }): StateProps => {
|
export default memo(withGlobal<OwnProps>((global, { isArchived }): StateProps => {
|
||||||
const { orderedPeerIds: { archived, active } } = global.stories;
|
const { orderedPeerIds: { archived, active } } = global.stories;
|
||||||
const { storyViewer: { isRibbonShown, isArchivedRibbonShown } } = selectTabState(global);
|
const { storyViewer: { isRibbonShown, isArchivedRibbonShown } } = selectTabState(global);
|
||||||
|
const isForumPanelOpen = selectIsForumPanelOpen(global);
|
||||||
const withAnimation = selectPerformanceSettingsValue(global, 'storyRibbonAnimations');
|
const withAnimation = selectPerformanceSettingsValue(global, 'storyRibbonAnimations');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentUserId: global.currentUserId!,
|
currentUserId: global.currentUserId!,
|
||||||
orderedPeerIds: isArchived ? archived : active,
|
orderedPeerIds: isArchived ? archived : active,
|
||||||
isShown: isArchived ? !isArchivedRibbonShown : !isRibbonShown,
|
isShown: isArchived ? !isArchivedRibbonShown : !isRibbonShown,
|
||||||
|
isForumPanelOpen,
|
||||||
withAnimation,
|
withAnimation,
|
||||||
usersById: global.users.byId,
|
usersById: global.users.byId,
|
||||||
chatsById: global.chats.byId,
|
chatsById: global.chats.byId,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user