mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-10 17:04:49 +08:00
added a new loading page that will be visible instead of the test
the test will load only when everything is ready (the account data is fully loaded)
This commit is contained in:
parent
dd427d386e
commit
0620e1ed34
8 changed files with 28 additions and 4 deletions
|
@ -295,6 +295,7 @@ firebase.auth().onAuthStateChanged(function (user) {
|
|||
`<p class="accountVerificatinNotice" style="text-align:center">Your account is not verified. Click <a onClick="sendVerificationEmail()">here</a> to resend the verification email.`
|
||||
);
|
||||
}
|
||||
UI.setPageTransition(false);
|
||||
AccountButton.update();
|
||||
AccountButton.loading(true);
|
||||
Account.getDataAndInit();
|
||||
|
@ -324,6 +325,9 @@ firebase.auth().onAuthStateChanged(function (user) {
|
|||
if (VerificationController.data !== null) {
|
||||
VerificationController.verify(user);
|
||||
}
|
||||
}else{
|
||||
UI.setPageTransition(false);
|
||||
if($(".pageLoading").hasClass('active')) UI.changePage('');
|
||||
}
|
||||
let theme = Misc.findGetParameter("customTheme");
|
||||
if (theme !== null) {
|
||||
|
|
|
@ -65,6 +65,8 @@ export function getDataAndInit() {
|
|||
if (snap.refactored === false) {
|
||||
CloudFunctions.removeSmallTests({ uid: user.uid });
|
||||
}
|
||||
// if($(".pageAccount").hasClass('active')) update();
|
||||
if($(".pageLogin").hasClass('active')) UI.changePage('account');
|
||||
if (!UpdateConfig.changedBeforeDb) {
|
||||
if (Config.localStorageConfig === null) {
|
||||
AccountButton.loading(false);
|
||||
|
@ -142,6 +144,8 @@ export function getDataAndInit() {
|
|||
TagController.loadActiveFromLocalStorage();
|
||||
ResultTagsPopup.updateButtons();
|
||||
Settings.showAccountSection();
|
||||
UI.setPageTransition(false);
|
||||
if($(".pageLoading").hasClass('active')) UI.changePage('');
|
||||
})
|
||||
.catch((e) => {
|
||||
AccountButton.loading(false);
|
||||
|
|
|
@ -1794,7 +1794,7 @@ export function loadFromLocalStorage() {
|
|||
saveToLocalStorage(true);
|
||||
console.log("saving localStorage config");
|
||||
}
|
||||
TestLogic.restart(false, true);
|
||||
// TestLogic.restart(false, true);
|
||||
loadDone();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ Misc.getReleasesFromGitHub();
|
|||
$(document).ready(() => {
|
||||
RouteController.handleInitialPageClasses(window.location.pathname);
|
||||
if (window.location.pathname === "/") {
|
||||
$("#top .config").removeClass("hidden");
|
||||
// $("#top .config").removeClass("hidden");
|
||||
}
|
||||
$("body").css("transition", "all .25s, transform .05s");
|
||||
if (Config.quickTab) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as UI from "./ui";
|
|||
import Config from "./config";
|
||||
|
||||
let mappedRoutes = {
|
||||
"/": "pageTest",
|
||||
"/": "pageLoading",
|
||||
"/login": "pageLogin",
|
||||
"/settings": "pageSettings",
|
||||
"/about": "pageAbout",
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as Account from "./account";
|
|||
import * as Leaderboards from "./leaderboards";
|
||||
import * as Funbox from "./funbox";
|
||||
|
||||
export let pageTransition = false;
|
||||
export let pageTransition = true;
|
||||
|
||||
export function setPageTransition(val) {
|
||||
pageTransition = val;
|
||||
|
@ -108,6 +108,7 @@ export function swapElements(
|
|||
}
|
||||
|
||||
export function changePage(page) {
|
||||
console.log('change');
|
||||
if (pageTransition) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2585,6 +2585,16 @@ key {
|
|||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.pageLoading{
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
.preloader{
|
||||
font-size: 2rem;
|
||||
justify-self: center;
|
||||
color: var(--main-color);
|
||||
}
|
||||
}
|
||||
|
||||
.pageTest {
|
||||
position: relative;
|
||||
|
||||
|
|
|
@ -1099,6 +1099,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="middle">
|
||||
<div class="page pageLoading hidden">
|
||||
<div class="preloader">
|
||||
<i class="fas fa-fw fa-spin fa-circle-notch"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page pageTest hidden">
|
||||
<div id="typingTest">
|
||||
<div id="capsWarning" class="hidden">
|
||||
|
|
Loading…
Reference in a new issue