mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-03 20:40:48 +08:00
moved glarses into its own state module
fixes 1 circular dependency part of #2462
This commit is contained in:
parent
8b6e52e721
commit
58ac17fa1e
4 changed files with 18 additions and 15 deletions
|
@ -11,7 +11,7 @@ Chart.plugins.register(chartAnnotation);
|
|||
import * as DB from "./db";
|
||||
import * as Misc from "./misc";
|
||||
import Config from "./config";
|
||||
import { toggleGlarses } from "./test/test-logic";
|
||||
import { enable } from "./states/glarses-mode";
|
||||
import "./test/caps-warning";
|
||||
import "./popups/support-popup";
|
||||
import "./popups/contact-popup";
|
||||
|
@ -37,7 +37,7 @@ global.snapshot = DB.getSnapshot;
|
|||
global.config = Config;
|
||||
// global.addnotif = Notifications.add;
|
||||
|
||||
global.glarsesMode = toggleGlarses;
|
||||
global.glarsesMode = enable;
|
||||
|
||||
global.stats = TestStats.getStats;
|
||||
|
||||
|
|
13
frontend/src/js/states/glarses-mode.js
Normal file
13
frontend/src/js/states/glarses-mode.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
let glarsesMode = false;
|
||||
|
||||
export function get() {
|
||||
return glarsesMode;
|
||||
}
|
||||
|
||||
export function enable() {
|
||||
glarsesMode = true;
|
||||
console.log(
|
||||
"Glarses Mode On - test result will be hidden. You can check the stats in the console (here)"
|
||||
);
|
||||
console.log("To disable Glarses Mode refresh the page.");
|
||||
}
|
|
@ -9,7 +9,7 @@ import * as DB from "../db";
|
|||
import * as TodayTracker from "./today-tracker";
|
||||
import * as PbCrown from "./pb-crown";
|
||||
import * as QuoteRatePopup from "../popups/quote-rate-popup";
|
||||
import * as TestLogic from "./test-logic";
|
||||
import * as GlarsesMode from "./../states/glarses-mode";
|
||||
import * as TestInput from "./test-input";
|
||||
import * as Notifications from "../elements/notifications";
|
||||
|
||||
|
@ -624,7 +624,7 @@ export function update(
|
|||
$("#result .stats .infoAndTags").removeClass("hidden");
|
||||
}
|
||||
|
||||
if (TestLogic.glarsesMode) {
|
||||
if (GlarsesMode.get()) {
|
||||
$("#middle #result .noStressMessage").remove();
|
||||
$("#middle #result").prepend(`
|
||||
|
||||
|
@ -690,7 +690,7 @@ export function update(
|
|||
},
|
||||
125
|
||||
);
|
||||
if (Config.alwaysShowWordsHistory && !TestLogic.glarsesMode) {
|
||||
if (Config.alwaysShowWordsHistory && !GlarsesMode.get()) {
|
||||
TestUI.toggleResultWords();
|
||||
}
|
||||
Keymap.hide();
|
||||
|
|
|
@ -47,18 +47,8 @@ import * as ModesNotice from "./../elements/modes-notice";
|
|||
|
||||
const objecthash = require("node-object-hash")().hash;
|
||||
|
||||
export let glarsesMode = false;
|
||||
|
||||
let failReason = "";
|
||||
|
||||
export function toggleGlarses() {
|
||||
glarsesMode = true;
|
||||
console.log(
|
||||
"Glarses Mode On - test result will be hidden. You can check the stats in the console (here)"
|
||||
);
|
||||
console.log("To disable Glarses Mode refresh the page.");
|
||||
}
|
||||
|
||||
export let notSignedInLastResult = null;
|
||||
|
||||
export function clearNotSignedInResult() {
|
||||
|
|
Loading…
Reference in a new issue