chore: remove old, unused code

This commit is contained in:
Miodec 2024-06-16 18:18:11 +02:00
parent 3b4276bf7e
commit fe63d3f194
4 changed files with 0 additions and 43 deletions

View file

@ -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
);
}
}

View file

@ -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<void> {
await updateProfile(createdAuthUser.user, { displayName: nname });
await sendVerificationEmail();
AllTimeStats.clear();
$("nav .textButton.account .text").text(nname);
LoginPage.hidePreloader();
await loadUser(createdAuthUser.user);

View file

@ -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<void> {
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();

View file

@ -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<void> {
LoadingPage.updateBar(100);
console.log("updating account page");
ThemeColors.update();
AllTimeStats.update();
const snapshot = DB.getSnapshot();
if (!snapshot) return;