From 95a969b1470e2edcf9905dae8b64eb26d54f403c Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 10 Feb 2022 23:49:23 +0100 Subject: [PATCH] removed account dependency --- frontend/src/js/controllers/chart-controller.js | 5 +++-- frontend/src/js/pages/account.js | 8 +------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/frontend/src/js/controllers/chart-controller.js b/frontend/src/js/controllers/chart-controller.js index ab59ccdce..66806f202 100644 --- a/frontend/src/js/controllers/chart-controller.js +++ b/frontend/src/js/controllers/chart-controller.js @@ -2,7 +2,6 @@ import Chart from "chart.js"; import * as TestStats from "../test/test-stats"; import * as ThemeColors from "../elements/theme-colors"; import * as Misc from "../misc"; -import * as Account from "../pages/account"; import Config, * as UpdateConfig from "../config"; export let result = new Chart($("#wpmChart"), { @@ -162,6 +161,8 @@ export let result = new Chart($("#wpmChart"), { }, }); +export let accountHistoryActiveIndex; + export let accountHistory = new Chart($(".pageAccount #accountHistoryChart"), { type: "line", data: { @@ -247,7 +248,7 @@ export let accountHistory = new Chart($(".pageAccount #accountHistoryChart"), { return; }, afterLabel: function (tooltip) { - Account.setActiveChartIndex(tooltip.index); + accountHistoryActiveIndex = tooltip.index; return; }, }, diff --git a/frontend/src/js/pages/account.js b/frontend/src/js/pages/account.js index e765e4712..0ddd4cf26 100644 --- a/frontend/src/js/pages/account.js +++ b/frontend/src/js/pages/account.js @@ -1173,14 +1173,8 @@ $(".pageAccount .loadMoreButton").click((e) => { loadMoreLines(); }); -let activeChartIndex; - -export function setActiveChartIndex(index) { - activeChartIndex = index; -} - $(".pageAccount #accountHistoryChart").click((e) => { - let index = activeChartIndex; + let index = ChartController.accountHistoryActiveIndex; loadMoreLines(index); $([document.documentElement, document.body]).animate( {