UI Loader: Fixes for preload animation

This commit is contained in:
Alexander Zinchuk 2022-09-15 10:17:52 +02:00
parent df3cadf5a1
commit d0ba24a328
3 changed files with 21 additions and 11 deletions

View File

@ -1,7 +1,8 @@
.root { .bg {
height: 100%; height: 100%;
background-color: var(--theme-background-color); background-color: var(--theme-background-color);
background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
@ -48,8 +49,12 @@
height: 100%; height: 100%;
z-index: var(--z-ui-loader-mask); z-index: var(--z-ui-loader-mask);
display: flex; display: flex;
}
@media (min-width: 600px) { .main {
flex: 1;
@media (min-width: 926px) {
display: grid; display: grid;
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr;
grid-template-rows: 100%; grid-template-rows: 100%;
@ -62,6 +67,7 @@
min-width: 12rem; min-width: 12rem;
width: 33vw; width: 33vw;
max-width: 26.5rem; max-width: 26.5rem;
height: 100%;
@media (min-width: 926px) { @media (min-width: 926px) {
max-width: 40vw; max-width: 40vw;
@ -89,10 +95,10 @@
.middle { .middle {
flex: 3; flex: 3;
border-left: 1px solid var(--color-borders); border-left: 1px solid var(--color-borders);
border-right: 1px solid var(--color-borders);
position: relative; position: relative;
z-index: 1; z-index: 1;
overflow: hidden; overflow: hidden;
background-size: cover !important;
@media (max-width: 1275px) { @media (max-width: 1275px) {
border-right: none; border-right: none;
@ -116,5 +122,5 @@
.blank { .blank {
flex: 1; flex: 1;
background: var(--color-background); background-color: var(--color-background);
} }

View File

@ -29,6 +29,7 @@ import monkeyPath from '../../assets/monkey.svg';
export type UiLoaderPage = export type UiLoaderPage =
'main' 'main'
| 'lock' | 'lock'
| 'inactive'
| 'authCode' | 'authCode'
| 'authPassword' | 'authPassword'
| 'authPhoneNumber' | 'authPhoneNumber'
@ -89,6 +90,8 @@ const preloadTasks = {
preloadFonts(), preloadFonts(),
preloadImage(lockPreviewPath), preloadImage(lockPreviewPath),
]), ]),
inactive: () => {
},
}; };
const UiLoader: FC<OwnProps & StateProps> = ({ const UiLoader: FC<OwnProps & StateProps> = ({
@ -144,21 +147,23 @@ const UiLoader: FC<OwnProps & StateProps> = ({
return ( return (
<div <div
id="UiLoader" id="UiLoader"
className={styles.root} className={styles.bg}
style={`--theme-background-color: ${theme === 'dark' ? DARK_THEME_BG_COLOR : LIGHT_THEME_BG_COLOR}`} style={`--theme-background-color: ${theme === 'dark' ? DARK_THEME_BG_COLOR : LIGHT_THEME_BG_COLOR}`}
> >
{children} {children}
{shouldRenderMask && !shouldSkipHistoryAnimations && Boolean(page) && ( {shouldRenderMask && !shouldSkipHistoryAnimations && Boolean(page) && (
<div className={buildClassName(styles.mask, transitionClassNames)}> <div className={buildClassName(styles.mask, transitionClassNames)}>
{page === 'main' ? ( {page === 'main' ? (
<> <div className={styles.main}>
<div <div
className={styles.left} className={styles.left}
style={leftColumnWidth ? `width: ${leftColumnWidth}px` : undefined} style={leftColumnWidth ? `width: ${leftColumnWidth}px` : undefined}
/> />
<div className={buildClassName(styles.middle, transitionClassNames)} /> <div className={buildClassName(styles.middle, styles.bg)} />
{isRightColumnShown && <div className={styles.right} />} {isRightColumnShown && <div className={styles.right} />}
</> </div>
) : (page === 'inactive' || page === 'lock') ? (
<div className={buildClassName(styles.blank, styles.bg)} />
) : ( ) : (
<div className={styles.blank} /> <div className={styles.blank} />
)} )}

View File

@ -8,7 +8,6 @@ import type { GlobalState } from '../../global/types';
import { LOCAL_TGS_URLS } from '../common/helpers/animatedAssets'; import { LOCAL_TGS_URLS } from '../common/helpers/animatedAssets';
import useLang from '../../hooks/useLang'; import useLang from '../../hooks/useLang';
import buildClassName from '../../util/buildClassName';
import { decryptSession } from '../../util/passcode'; import { decryptSession } from '../../util/passcode';
import useShowTransition from '../../hooks/useShowTransition'; import useShowTransition from '../../hooks/useShowTransition';
import useTimeout from '../../hooks/useTimeout'; import useTimeout from '../../hooks/useTimeout';
@ -55,7 +54,7 @@ const LockScreen: FC<OwnProps & StateProps> = ({
const [validationError, setValidationError] = useState<string>(''); const [validationError, setValidationError] = useState<string>('');
const [shouldShowPasscode, setShouldShowPasscode] = useState(false); const [shouldShowPasscode, setShouldShowPasscode] = useState(false);
const [isSignOutDialogOpen, openSignOutConfirmation, closeSignOutConfirmation] = useFlag(false); const [isSignOutDialogOpen, openSignOutConfirmation, closeSignOutConfirmation] = useFlag(false);
const { transitionClassNames, shouldRender } = useShowTransition(isLocked); const { shouldRender } = useShowTransition(isLocked);
useTimeout( useTimeout(
resetInvalidUnlockAttempts, resetInvalidUnlockAttempts,
@ -115,7 +114,7 @@ const LockScreen: FC<OwnProps & StateProps> = ({
} }
return ( return (
<div className={buildClassName(styles.container, transitionClassNames)}> <div className={styles.container}>
<div className={styles.wrapper} dir={lang.isRtl ? 'rtl' : undefined}> <div className={styles.wrapper} dir={lang.isRtl ? 'rtl' : undefined}>
<AnimatedIconWithPreview <AnimatedIconWithPreview
tgsUrl={LOCAL_TGS_URLS.Lock} tgsUrl={LOCAL_TGS_URLS.Lock}