Main Menu: Bring back animations toggle (#2209)
This commit is contained in:
parent
15e586d772
commit
349666c42c
@ -72,6 +72,7 @@ type StateProps =
|
|||||||
}
|
}
|
||||||
& Pick<GlobalState, 'connectionState' | 'isSyncing' | 'canInstall'>;
|
& Pick<GlobalState, 'connectionState' | 'isSyncing' | 'canInstall'>;
|
||||||
|
|
||||||
|
const ANIMATION_LEVEL_OPTIONS = [0, 1, 2];
|
||||||
const LEGACY_VERSION_URL = 'https://web.telegram.org/?legacy=1';
|
const LEGACY_VERSION_URL = 'https://web.telegram.org/?legacy=1';
|
||||||
const WEBK_VERSION_URL = 'https://web.telegram.org/k/';
|
const WEBK_VERSION_URL = 'https://web.telegram.org/k/';
|
||||||
|
|
||||||
@ -202,6 +203,17 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
|
|||||||
switchTheme(newTheme, animationLevel === ANIMATION_LEVEL_MAX);
|
switchTheme(newTheme, animationLevel === ANIMATION_LEVEL_MAX);
|
||||||
}, [animationLevel, setSettingOption, theme]);
|
}, [animationLevel, setSettingOption, theme]);
|
||||||
|
|
||||||
|
const handleAnimationLevelChange = useCallback((e: React.SyntheticEvent<HTMLElement>) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
const newLevel = animationLevel === 0 ? 2 : 0;
|
||||||
|
ANIMATION_LEVEL_OPTIONS.forEach((_, i) => {
|
||||||
|
document.body.classList.toggle(`animation-level-${i}`, newLevel === i);
|
||||||
|
});
|
||||||
|
|
||||||
|
setSettingOption({ animationLevel: newLevel });
|
||||||
|
}, [animationLevel, setSettingOption]);
|
||||||
|
|
||||||
const handleChangelogClick = useCallback(() => {
|
const handleChangelogClick = useCallback(() => {
|
||||||
window.open(BETA_CHANGELOG_URL, '_blank', 'noopener');
|
window.open(BETA_CHANGELOG_URL, '_blank', 'noopener');
|
||||||
}, []);
|
}, []);
|
||||||
@ -284,6 +296,17 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
|
|||||||
noAnimation
|
noAnimation
|
||||||
/>
|
/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
icon="animations"
|
||||||
|
onClick={handleAnimationLevelChange}
|
||||||
|
>
|
||||||
|
<span className="menu-item-name capitalize">{lang('Appearance.Animations').toLowerCase()}</span>
|
||||||
|
<Switcher
|
||||||
|
id="animations"
|
||||||
|
label="Toggle Animations"
|
||||||
|
checked={animationLevel > 0}
|
||||||
|
/>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon="help"
|
icon="help"
|
||||||
onClick={handleOpenTipsChat}
|
onClick={handleOpenTipsChat}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user