TelegramPWA/src/util/perfomanceSettings.ts
Alexander Zinchuk 4f42b676ce Settings: Performance mode (#3045)
Co-authored-by: Alexander Zinchuk <alx.zinchuk@gmail.com>
2023-04-25 17:28:03 +04:00

24 lines
912 B
TypeScript

import type { PerformanceType } from '../types';
export function applyPerformanceSettings(performanceType: PerformanceType) {
const {
pageTransitions,
messageSendingAnimations,
mediaViewerAnimations,
messageComposerAnimations,
contextMenuAnimations,
contextMenuBlur,
rightColumnAnimations,
} = performanceType;
const root = document.body;
root.classList.toggle('no-page-transitions', !pageTransitions);
root.classList.toggle('no-message-sending-animations', !messageSendingAnimations);
root.classList.toggle('no-media-viewer-animations', !mediaViewerAnimations);
root.classList.toggle('no-message-composer-animations', !messageComposerAnimations);
root.classList.toggle('no-context-menu-animations', !contextMenuAnimations);
root.classList.toggle('no-menu-blur', !contextMenuBlur);
root.classList.toggle('no-right-column-animations', !rightColumnAnimations);
}