diff --git a/frontend/src/ts/account/all-time-stats.ts b/frontend/src/ts/account/all-time-stats.ts deleted file mode 100644 index b8adecceb..000000000 --- a/frontend/src/ts/account/all-time-stats.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as DB from "../db"; -import * as DateTime from "../utils/date-and-time"; - -export function clear(): void { - $(".pageAccount .globalTimeTyping .val").text(`-`); - $(".pageAccount .globalTestsStarted .val").text(`-`); - $(".pageAccount .globalTestsCompleted .val").text(`-`); -} - -export function update(): void { - const snapshot = DB.getSnapshot(); - if (!snapshot) return; - if (snapshot.typingStats !== undefined) { - // let th = Math.floor(DB.getSnapshot().typingStats.time / 3600); - // let tm = Math.floor((DB.getSnapshot().typingStats.time % 3600) / 60); - // let ts = Math.floor((DB.getSnapshot().typingStats.time % 3600) % 60); - const seconds = snapshot?.typingStats?.timeTyping ?? 0; - let string = ""; - if (seconds === 0) { - string = "-"; - } else { - string = DateTime.secondsToString(Math.round(seconds), true, true); - } - $(".pageAccount .globalTimeTyping .val").text(string); - } - - if (snapshot.typingStats !== undefined) { - $(".pageAccount .globalTestsStarted .val").text( - snapshot.typingStats.startedTests as number - ); - - $(".pageAccount .globalTestsCompleted .val").text( - snapshot.typingStats.completedTests as number - ); - } -} diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index e46d285f2..b47ded356 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -5,7 +5,6 @@ import * as AccountButton from "../elements/account-button"; import * as Misc from "../utils/misc"; import * as JSONData from "../utils/json-data"; import * as Settings from "../pages/settings"; -import * as AllTimeStats from "../account/all-time-stats"; import * as DB from "../db"; import * as TestLogic from "../test/test-logic"; import * as Loader from "../elements/loader"; @@ -463,7 +462,6 @@ export function signOut(): void { Notifications.add("Signed out", 0, { duration: 2, }); - AllTimeStats.clear(); Settings.hideAccountSection(); void AccountButton.update(); navigate("/login"); @@ -582,7 +580,6 @@ async function signUp(): Promise { await updateProfile(createdAuthUser.user, { displayName: nname }); await sendVerificationEmail(); - AllTimeStats.clear(); $("nav .textButton.account .text").text(nname); LoginPage.hidePreloader(); await loadUser(createdAuthUser.user); diff --git a/frontend/src/ts/modals/google-sign-up.ts b/frontend/src/ts/modals/google-sign-up.ts index 0a32a472f..c2f5fafbe 100644 --- a/frontend/src/ts/modals/google-sign-up.ts +++ b/frontend/src/ts/modals/google-sign-up.ts @@ -9,7 +9,6 @@ import { import Ape from "../ape"; import { createErrorMessage } from "../utils/misc"; import * as LoginPage from "../pages/login"; -import * as AllTimeStats from "../account/all-time-stats"; import * as AccountController from "../controllers/account-controller"; import * as TestLogic from "../test/test-logic"; import * as CaptchaController from "../controllers/captcha-controller"; @@ -86,7 +85,6 @@ async function apply(): Promise { if (response.status === 200) { await updateProfile(signedInUser.user, { displayName: name }); await sendEmailVerification(signedInUser.user); - AllTimeStats.clear(); Notifications.add("Account created", 1); $("nav .textButton.account .text").text(name); LoginPage.enableInputs(); diff --git a/frontend/src/ts/pages/account.ts b/frontend/src/ts/pages/account.ts index aacc4eb99..cfe43a296 100644 --- a/frontend/src/ts/pages/account.ts +++ b/frontend/src/ts/pages/account.ts @@ -4,7 +4,6 @@ import * as ThemeColors from "../elements/theme-colors"; import * as ChartController from "../controllers/chart-controller"; import Config, * as UpdateConfig from "../config"; import * as MiniResultChart from "../account/mini-result-chart"; -import * as AllTimeStats from "../account/all-time-stats"; import * as PbTables from "../account/pb-tables"; import * as LoadingPage from "./loading"; import * as Focus from "../test/focus"; @@ -207,7 +206,6 @@ async function fillContent(): Promise { LoadingPage.updateBar(100); console.log("updating account page"); ThemeColors.update(); - AllTimeStats.update(); const snapshot = DB.getSnapshot(); if (!snapshot) return;