Forum Panel: Disable transitions if animation level is at min (#2821)

This commit is contained in:
Alexander Zinchuk 2023-03-19 22:31:17 -05:00
parent 487cde9176
commit 967888cefc
5 changed files with 35 additions and 1 deletions

View File

@ -52,6 +52,10 @@
.info { .info {
transition: opacity 0.3s ease, transform var(--layer-transition); transition: opacity 0.3s ease, transform var(--layer-transition);
:global(body.animation-level-0) & {
transition: none;
}
} }
.icon { .icon {

View File

@ -156,6 +156,10 @@
transform: translateX(-0.375rem) scaleY(0.5); transform: translateX(-0.375rem) scaleY(0.5);
transition: transform var(--layer-transition); transition: transform var(--layer-transition);
body.animation-level-0 & {
transition: none;
}
background: var(--color-primary); background: var(--color-primary);
z-index: 1; z-index: 1;
@ -206,12 +210,20 @@
.Badge-transition { .Badge-transition {
transition: opacity var(--layer-transition), transform var(--layer-transition); transition: opacity var(--layer-transition), transform var(--layer-transition);
body.animation-level-0 & {
transition: none;
}
} }
} }
.info { .info {
transition: opacity 300ms ease, transform var(--layer-transition); transition: opacity 300ms ease, transform var(--layer-transition);
body.animation-level-0 & {
transition: none;
}
.title .custom-emoji { .title .custom-emoji {
color: var(--color-primary); color: var(--color-primary);
} }

View File

@ -25,6 +25,10 @@
transition: transform var(--layer-transition); transition: transform var(--layer-transition);
transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0);
&.no-animation {
transition: none;
}
:global(.chat-list) { :global(.chat-list) {
position: relative; position: relative;
overflow-x: hidden; overflow-x: hidden;

View File

@ -9,7 +9,7 @@ import { MAIN_THREAD_ID } from '../../../api/types';
import { import {
GENERAL_TOPIC_ID, GENERAL_TOPIC_ID,
TOPICS_SLICE, TOPIC_HEIGHT_PX, TOPIC_LIST_SENSITIVE_AREA, TOPICS_SLICE, TOPIC_HEIGHT_PX, TOPIC_LIST_SENSITIVE_AREA, ANIMATION_LEVEL_MIN,
} from '../../../config'; } from '../../../config';
import { IS_TOUCH_ENV } from '../../../util/environment'; import { IS_TOUCH_ENV } from '../../../util/environment';
import { import {
@ -52,6 +52,7 @@ type StateProps = {
chat?: ApiChat; chat?: ApiChat;
currentTopicId?: number; currentTopicId?: number;
lastSyncTime?: number; lastSyncTime?: number;
animationLevel?: number;
}; };
const INTERSECTION_THROTTLE = 200; const INTERSECTION_THROTTLE = 200;
@ -64,6 +65,7 @@ const ForumPanel: FC<OwnProps & StateProps> = ({
lastSyncTime, lastSyncTime,
onTopicSearch, onTopicSearch,
onCloseAnimationEnd, onCloseAnimationEnd,
animationLevel,
}) => { }) => {
const { const {
closeForumPanel, openChatWithInfo, loadTopics, closeForumPanel, openChatWithInfo, loadTopics,
@ -91,6 +93,12 @@ const ForumPanel: FC<OwnProps & StateProps> = ({
closeForumPanel(); closeForumPanel();
}, [closeForumPanel]); }, [closeForumPanel]);
useEffect(() => {
if (animationLevel === ANIMATION_LEVEL_MIN && !isOpen) {
onCloseAnimationEnd?.();
}
}, [animationLevel, isOpen, onCloseAnimationEnd]);
const handleToggleChatInfo = useCallback(() => { const handleToggleChatInfo = useCallback(() => {
if (!chat) return; if (!chat) return;
openChatWithInfo({ id: chat.id, shouldReplaceHistory: true }); openChatWithInfo({ id: chat.id, shouldReplaceHistory: true });
@ -196,6 +204,7 @@ const ForumPanel: FC<OwnProps & StateProps> = ({
styles.root, styles.root,
isScrolled && styles.scrolled, isScrolled && styles.scrolled,
lang.isRtl && styles.rtl, lang.isRtl && styles.rtl,
animationLevel === ANIMATION_LEVEL_MIN && styles.noAnimation,
)} )}
onTransitionEnd={!isOpen ? onCloseAnimationEnd : undefined} onTransitionEnd={!isOpen ? onCloseAnimationEnd : undefined}
> >
@ -277,6 +286,7 @@ export default memo(withGlobal<OwnProps>(
chat, chat,
lastSyncTime: global.lastSyncTime, lastSyncTime: global.lastSyncTime,
currentTopicId: chatId === currentChatId ? currentThreadId : undefined, currentTopicId: chatId === currentChatId ? currentThreadId : undefined,
animationLevel: global.settings.byKey.animationLevel,
}; };
}, },
)(ForumPanel)); )(ForumPanel));

View File

@ -124,6 +124,10 @@
.Avatar { .Avatar {
transition: transform var(--layer-transition); transition: transform var(--layer-transition);
body.animation-level-0 & {
transition: none;
}
} }
.ListItem { .ListItem {