Added variety of msg on loading app

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-10-27 19:00:31 +05:30
parent 1fa1496d7f
commit 2e2b1c6f18
2 changed files with 19 additions and 1 deletions

View file

@ -15,9 +15,25 @@ import initMatrix from '../../../client/initMatrix';
function Client() { function Client() {
const [isLoading, changeLoading] = useState(true); const [isLoading, changeLoading] = useState(true);
const [loadingMsg, setLoadingMsg] = useState('Heating up');
useEffect(() => { useEffect(() => {
let counter = 0;
const iId = setInterval(() => {
const msgList = [
'Sometimes it takes a while...',
'Looks like you have a lot of stuff to heat up!',
];
if (counter === msgList.length - 1) {
setLoadingMsg(msgList[msgList.length - 1]);
clearInterval(iId);
return;
}
setLoadingMsg(msgList[counter]);
counter += 1;
}, 9000);
initMatrix.once('init_loading_finished', () => { initMatrix.once('init_loading_finished', () => {
clearInterval(iId);
changeLoading(false); changeLoading(false);
}); });
initMatrix.init(); initMatrix.init();
@ -30,7 +46,7 @@ function Client() {
<Text variant="b3">Logout</Text> <Text variant="b3">Logout</Text>
</button> </button>
<Spinner /> <Spinner />
<Text className="loading__message" variant="b2">Heating up</Text> <Text className="loading__message" variant="b2">{loadingMsg}</Text>
<div className="loading__appname"> <div className="loading__appname">
<Text variant="h2">Cinny</Text> <Text variant="h2">Cinny</Text>

View file

@ -27,6 +27,8 @@
} }
.loading__message { .loading__message {
margin-top: var(--sp-normal); margin-top: var(--sp-normal);
max-width: 350px;
text-align: center;
} }
.loading__appname { .loading__appname {
position: absolute; position: absolute;