Update loading screen

This commit is contained in:
Bill 2021-09-30 03:46:58 -04:00
parent bba0d96495
commit 78001b6f30
3 changed files with 139 additions and 70 deletions

View File

@ -128,7 +128,7 @@ export const App: FC<{}> = props =>
<div className="nitro-app overflow-hidden"> <div className="nitro-app overflow-hidden">
<div id="nitro-alerts-container" /> <div id="nitro-alerts-container" />
{ (!isReady || isError) && <LoadingView isError={ isError } message={ message } /> } { (!isReady || isError) && <LoadingView isError={ isError } message={ message } /> }
<TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ (isReady && !isError) } timeout={ 300 }> <TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ (isReady && !isError) }>
<MainView /> <MainView />
</TransitionAnimation> </TransitionAnimation>
</div> </div>

View File

@ -1,75 +1,113 @@
.nitro-loading { .nitro-loading {
width: 100%; position: relative;
height: 100%; background: linear-gradient(to bottom, $white, 15%, $primary);
position: absolute;
.logo { .connecting-duck {
background: url('../../assets/images/nitro/nitro-light.svg') no-repeat center; position: absolute;
width: 45%; top: 0;
height: 45%; bottom: 0;
} margin: auto;
right: 0;
left: 0;
background: url('../../assets/images/loading/connecting-duck-spritesheet.png') no-repeat top left;
width: 235px;
height: 127px;
animation: 1.5s connecting-duck infinite step-end;
transform: scale(0.5);
.lds-ellipsis { &.01 {
display: inline-block; background-position: 0 0;
position: relative; }
width: 80px;
height: 80px;
div { &.02 {
position: absolute; background-position: 0 -132px;
top: 33px; width: 280px;
width: 13px; height: 151px;
height: 13px; }
border-radius: 50%;
background: #fff;
animation-timing-function: cubic-bezier(0, 1, 1, 0);
@keyframes lds-ellipsis1 { &.03 {
0% { background-position: 0 -288px;
transform: scale(0); width: 326px;
} height: 174px;
100% { }
transform: scale(1);
}
}
@keyframes lds-ellipsis3 { &.04 {
0% { background-position: 0 -467px;
transform: scale(1); }
}
100% {
transform: scale(0);
}
}
@keyframes lds-ellipsis2 { &.05 {
0% { background-position: 0 -599px;
transform: translate(0, 0); width: 280px;
} height: 151px;
100% { }
transform: translate(24px, 0);
}
}
&:nth-child(1) { &.06 {
left: 8px; background-position: 0 -755px;
animation: lds-ellipsis1 0.6s infinite; width: 326px;
} height: 174px;
}
&:nth-child(2) { &.07 {
left: 8px; background-position: 0 -934px;
animation: lds-ellipsis2 0.6s infinite; width: 190px;
} height: 104px;
&:nth-child(3) {
left: 32px;
animation: lds-ellipsis2 0.6s infinite;
}
&:nth-child(4) {
left: 56px;
animation: lds-ellipsis3 0.6s infinite;
}
} }
} }
.logo {
position: absolute;
top: 0;
bottom: 0;
margin: auto;
right: 0;
left: 0;
width: 35%;
height: 35%;
background: url('../../assets/images/nitro/nitro-light.svg') no-repeat center;
z-index: -1;
}
}
@keyframes connecting-duck {
0% {
background-position: 0 0;
width: 235px;
height: 127px;
}
15% {
background-position: 0 -132px;
width: 280px;
height: 151px;
}
30% {
background-position: 0 -288px;
width: 326px;
height: 174px;
}
45% {
background-position: 0 -467px;
width: 235px;
height: 127px;
}
60% {
background-position: 0 -599px;
width: 280px;
height: 151px;
}
75% {
background-position: 0 -755px;
width: 326px;
height: 174px;
}
90% {
background-position: 0 -934px;
width: 190px;
height: 104px;
}
} }

View File

@ -1,15 +1,46 @@
import { FC } from 'react'; import { FC, useEffect, useState } from 'react';
import { NitroLayoutFlexColumn } from '../../layout';
import { NitroLayoutBase } from '../../layout/base';
import { NotificationAlertType } from '../notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../notification-center/common/NotificationUtilities';
import { LoadingViewProps } from './LoadingView.types'; import { LoadingViewProps } from './LoadingView.types';
export const LoadingView: FC<LoadingViewProps> = props => export const LoadingView: FC<LoadingViewProps> = props =>
{ {
const { isError = false, message = '' } = props; const { isError = false, message = '' } = props;
const [ loadingShowing, setLoadingShowing ] = useState(false);
useEffect(() =>
{
if(!isError) return;
NotificationUtilities.simpleAlert(message, NotificationAlertType.DEFAULT, null, null, 'Connection Error');
}, [ isError, message ]);
useEffect(() =>
{
const timeout = setTimeout(() =>
{
setLoadingShowing(true);
}, 500);
return () =>
{
clearTimeout(timeout);
}
}, []);
return ( return (
<div className="nitro-loading d-flex flex-column justify-content-center align-items-center w-100 h-100"> <NitroLayoutFlexColumn className='position-relative nitro-loading justify-content-center align-items-center w-100 h-100'>
<div className="logo mb-4"></div> <NitroLayoutBase className="connecting-duck" />
{ message && message.length && (<div className="h4 m-0">{ message }</div>) } {/* <TransitionAnimation className="loading-area" type={ TransitionAnimationTypes.FADE_IN } inProp={ loadingShowing }>
{ !isError && (<div className="lds-ellipsis"><div></div><div></div><div></div><div></div></div>) } <NitroLayoutBase className="connecting-duck" />
</div> </TransitionAnimation> */}
{/* <TransitionAnimation className="loading-area" type={ TransitionAnimationTypes.FADE_IN } inProp={ !loadingShowing } timeout={ 500 }>
<NitroLayoutBase position="absolute" className="logo" />
</TransitionAnimation> */}
{ isError && (message && message.length) &&
<NitroLayoutBase className="m-auto bottom-3 fs-4 text-shadow" position="absolute">{ message }</NitroLayoutBase> }
</NitroLayoutFlexColumn>
); );
} }