From ba0c571ed523972737816fdec367c95ff14d3bfe Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 12 Jul 2021 13:14:28 +0100 Subject: [PATCH 1/6] removed some unused bits --- src/sass/style.scss | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/sass/style.scss b/src/sass/style.scss index 7392722f2..049462ae0 100644 --- a/src/sass/style.scss +++ b/src/sass/style.scss @@ -1170,7 +1170,6 @@ label.checkbox { border: none; outline: none; font-size: 1rem; - font-family: var(--font); width: 100%; border-radius: var(--roundness); } @@ -1196,7 +1195,6 @@ label.checkbox { border: none; outline: none; font-size: 1rem; - font-family: var(--font); width: 100%; border-radius: var(--roundness); } @@ -3185,29 +3183,6 @@ key { grid-auto-columns: 1fr; gap: 0.5rem; grid-area: tabs; - - .tab { - will-change: color; - transition: 0.2s ease-in-out color; - outline: 0; - cursor: pointer; - padding: 0; - font-size: 1rem; - color: var(--sub-color); - text-align: left; - border: 0; - background: 0; - font-family: var(--font); - - &:first-child { - margin-right: 0.5rem; - } - - &.active, - &:hover { - color: var(--main-color); - } - } } .buttons { From 75774c9fb6e4accbd8f94ccfc4b7c70abc69721d Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 12 Jul 2021 13:19:27 +0100 Subject: [PATCH 2/6] added fallback to default font --- src/js/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/config.js b/src/js/config.js index 3e10c6cf9..9b821053f 100644 --- a/src/js/config.js +++ b/src/js/config.js @@ -1186,7 +1186,7 @@ export function setFontFamily(font, nosave) { config.fontFamily = font; document.documentElement.style.setProperty( "--font", - '"' + font.replace(/_/g, " ") + '"' + `"${font.replace(/_/g, " ")}", "Roboto Mono"` ); ChartController.setDefaultFontFamily(font); if (!nosave) saveToLocalStorage(); From 54735acbf61e9caab864f2adaa46e1ee112aec72 Mon Sep 17 00:00:00 2001 From: Aaron <79121360+UnrealApex@users.noreply.github.com> Date: Mon, 12 Jul 2021 05:21:01 -0700 Subject: [PATCH 3/6] Update CONTRIBUTING.md (#1622) * Renamed command line setting timer-progress bar * Added table of contents * Fixed some mistakes * More small changes * Update CONTRIBUTING.md * updated guidelines * Update CONTRIBUTING.md Note that one of the table of contents links is broken, fixing that later * Added missing sections in table of contents * Fixed typos * Fixed typos * Update CODE_OF_CONDUCT.md * Update CONTRIBUTING.md Co-authored-by: Jack --- CONTRIBUTING.md | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 024eacb37..cf7135a7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,43 +1,37 @@ # Contributing ### **Table of Contents** - - [Getting Started](#getting-started) - [Prerequisites](#prerequisites) - - [Prerequisite - Text Editor](#prerequisite---text-editor) - - [Prerequisite - Git ](#prerequisite---git ) - - [Prerequisite - NodeJS](#prerequisite---nodejs) - - [Prerequisite - Firebase Setup](#prerequisite---firebase) -- [Building and Running](#building-and-running-monkeytype) + - [Text Editor](#text-editor) + - [Git ](#git ) + - [NodeJS](#nodejs) + - [Firebase](#firebase) +- [Building and Running Monkeytype](#building-and-running-monkeytype) - [Standards and Guidelines](#standards-and-guidelines) - [Theme Guidelines](#theme-guidelines) - [Language Guidelines](#language-guidelines) - [Quote Guidelines](#quote-guidelines) - [Questions](#questions) - +---- ## Getting Started -When contributing to Monkeytype, it's good to know our best practices, tips, and tricks. First, Monkeytype is written in JavaScript; thus we assume you are comfortable in JavaScript or have basic knowledge of it. We use Prettier to format our code. Our backend is in NodeJS and we use Firebase to store our user data. - +When contributing to Monkeytype, it's good to know our best practices, tips, and tricks. First, Monkeytype is written in Javascript, CSS and HTML(in order of how much of the project is in what language); thus we assume you are comfortable in in these languages or have basic knowledge of them. Our backend is in NodeJS and we use Firebase to store our user data. We use Prettier to format our code. ### Prerequisites -While most contributions don't require that you install dependencies, there are a few minimum requirements you will need to meet to be able to run the project(this is useful and almost always necessary for tasks like creating features and fixing bugs, running the project is also useful if you are contributing a theme and want to view it on the site before you contribute it). You will need a computer with a stable internet connection, NodeJS with a version < 14 and Firebase, and a text editor. +While most contributions don't require that you install dependencies, there are a few minimum requirements you will need to meet to be able to run the project(this is useful and almost always necessary for tasks like creating features and fixing bugs, running the project is also useful if you are contributing a theme and want to view it on the site before you contribute it). You will need a computer with a stable internet connection, Git, NodeJS with a version < 14 and Firebase, and a text editor. -#### Prerequisite - Text Editor -If you are not a developer and wish to contribute themes, new languages, or quotes, having a text editor will make the process *much* easier. A popular and relatively lightweight editor is the free and open-source [Visual Studio Code](https://code.visualstudio.com/) or VS Code for short from Microsoft. Once you have downloaded the binary for your operating system, run the installer and follow the prompts. You will be given some options, but enabling them is just preference. Once you have VS Code installed, you are ready to start contributing. +#### Text Editor +If you are not a developer and wish to contribute themes, new languages, or quotes, having a text editor will make contributions *much* easier. A popular and relatively lightweight editor [Visual Studio Code](https://code.visualstudio.com/) or VS Code. Is is the free and open-source from Microsoft. Run the installer and follow the prompts. Once you have VS Code installed, you are ready to start contributing. -#### Prerequisite - Git -Git is optional but is one thing that is highly recommended. Monkeytype used the Git source control management system for its version control. Without Git, you will be limited to using GitHub's basic online editor for making commits or will need to make changes and copy-paste them into GitHub. You also won't be able to create save points in your code that you can revert to (`git revert [commit hash]`)Using Git allows you to make that process more seamless. Assuming you don't have experience with using a command line, I suggest installing [Sourcetree](https://www.sourcetreeapp.com/). You will be able to utilize the power of Git without needing to remember any cryptic commands. Note that using Git from a Git client won't give you access to its full functionality. Once you have downloaded Sourcetree, run the installer. If you don't have Git installed and get the option to install it in the Sourcetree installer, install it. Once you have completed that, you are one step closer to contributing your change. +#### Git +Git is optional but we *highly* recommend you use it. Monkeytype used the Git source control management system for its version control. Assuming you don't have experience typing commmands in the command line, we suggest installing [Sourcetree](https://www.sourcetreeapp.com/). You will be able to utilize the power of Git without needing to remember any cryptic commands. However using a Git client won't give you access to the full functionality of Git but provides an easy to understand graphical user interface(GUI). Once you have downloaded Sourcetree, run the installer. While installing Sourcetree, keep your eyes peeled for the option to also install Git with Sourcetree. This is the option you will need to look for in order to install Git. **Make sure to click yes in the installer to install Git with Sourcetree.** +#### NodeJS +The installation process of NodeJS is fairly simple, navigate to the NodeJS [website](https://nodejs.org/en/) and download the `xx.xx.x LTS`. Run the installer once the download has finished. -#### Prerequisite - NodeJS -Note that this section only covers the installation of NodeJS -The installation process of NodeJS is fairly simple, navigate to the NodeJS [website](https://nodejs.org/en/) and download the `xx.xx.x LTS`. Your operating system will be detected and the website will ask to save a binary relevant to your operating system. Run the binary and follow the installer. - -#### Prerequisite - Firebase - -Note that you will need to create a Firebase account to ensure the further steps are successful. +#### Firebase 1. Create a Firebase account if you already haven't done so. 1. [Create a new Firebase project.](https://console.firebase.google.com/u/0/) @@ -84,7 +78,7 @@ Note that you will need to create a Firebase account to ensure the further steps Once you have completed the above steps, you are ready to build and run Monkeytype. 1. Run `npm install` in the project root directory to install dependencies. -1. Run `npm run start:dev` to start a local dev server on port 5000. It will watch for changes and rebuild when you edit files in `src/` or `public/` directories. Use control c to abort it. +1. Run `npm run start:dev` to start a local dev server on [port 5000](http://localhost:5000). It will watch for changes and rebuild when you edit files in `src/` or `public/` directories. Use Ctrl+ C to abort it. - Run `firebase use {your-project-id}` if you run into any errors for this. ### Standards and Guidelines @@ -114,4 +108,4 @@ Following the guidelines below will increase your chance of getting your change ## Questions -If you have any questions, comments, concerns, or problems let me know on [GitHub](https://github.com/Miodec) or [Discord](https://discord.gg/monkeytype) in the `#development` channel. +If you have any questions, comments, concerns, or problems let me know on [GitHub](https://github.com/Miodec), [Discord](https://discord.gg/monkeytype) in the `#development` channel, or on Monkeytype's [GitHub discussions](https://github.com/Miodec/monkeytype/discussions). From 347c3eb7bec8f968373e5160f94293fd6c94bae5 Mon Sep 17 00:00:00 2001 From: Michael <67599521+kemonprogrammer@users.noreply.github.com> Date: Mon, 12 Jul 2021 12:21:31 +0000 Subject: [PATCH 4/6] Fix typos in german.json (#1615) by kemonprogrammer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Kerbs" to "Krebs" "–" to "-" --- static/quotes/german.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/quotes/german.json b/static/quotes/german.json index a38227777..ebe70db02 100644 --- a/static/quotes/german.json +++ b/static/quotes/german.json @@ -1590,7 +1590,7 @@ "id": 265 }, { - "text": "Es gibt nur eine Sache, die schlimmer ist, als an Krebs zu sterben – ein Kind zu haben, das an Kerbs sterben wird.", + "text": "Es gibt nur eine Sache, die schlimmer ist, als an Krebs zu sterben - ein Kind zu haben, das an Krebs sterben wird.", "source": "Das Schicksal ist ein mieser Verräter", "length": 114, "id": 266 From eb062779dd253d2523b912d78299fb5af6bd3612 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 12 Jul 2021 13:46:34 +0100 Subject: [PATCH 5/6] saving burst heatmap state. closes #1614 --- src/js/config.js | 11 +++ src/js/test/test-logic.js | 2 +- src/js/test/test-ui.js | 140 ++++++++++++++++++-------------------- 3 files changed, 79 insertions(+), 74 deletions(-) diff --git a/src/js/config.js b/src/js/config.js index 9b821053f..8b62b5592 100644 --- a/src/js/config.js +++ b/src/js/config.js @@ -125,6 +125,7 @@ let defaultConfig = { monkeyPowerLevel: "off", minBurst: "off", minBurstCustomSpeed: 100, + burstHeatmap: false, }; function isConfigKeyValid(name) { @@ -1548,6 +1549,15 @@ export function setMonkeyPowerLevel(level, nosave) { if (!nosave) saveToLocalStorage(); } +export function setBurstHeatmap(value, nosave) { + if (!value) { + value = false; + } + config.burstHeatmap = value; + TestUI.applyBurstHeatmap(); + if (!nosave) saveToLocalStorage(); +} + export function apply(configObj) { if (configObj == null || configObj == undefined) { Notifications.add("Could not apply config", -1, 3); @@ -1636,6 +1646,7 @@ export function apply(configObj) { setMonkey(configObj.monkey, true); setRepeatQuotes(configObj.repeatQuotes, true); setMonkeyPowerLevel(configObj.monkeyPowerLevel, true); + setBurstHeatmap(configObj.burstHeatmap, true); LanguagePicker.setActiveGroup(); diff --git a/src/js/test/test-logic.js b/src/js/test/test-logic.js index d57958e80..5ba485e5a 100644 --- a/src/js/test/test-logic.js +++ b/src/js/test/test-logic.js @@ -2010,7 +2010,7 @@ export function finish(difficultyFailed = false) { $("#words").empty(); ChartController.result.resize(); - if (TestUI.heatmapEnabled) { + if (Config.burstHeatmap) { TestUI.applyBurstHeatmap(); } $("#testModesNotice").addClass("hidden"); diff --git a/src/js/test/test-ui.js b/src/js/test/test-ui.js index 4b67ded80..8c72ee4de 100644 --- a/src/js/test/test-ui.js +++ b/src/js/test/test-ui.js @@ -790,12 +790,73 @@ export function toggleResultWords() { } } } -export let heatmapEnabled = false; -function toggleBurstHeatmap() { - if (!heatmapEnabled) { - applyBurstHeatmap(); + +export function applyBurstHeatmap() { + if (Config.burstHeatmap) { + $("#resultWordsHistory .heatmapLegend").removeClass("hidden"); + let min = Math.min(...TestStats.burstHistory); + let max = Math.max(...TestStats.burstHistory); + // let step = (max - min) / 5; + // let steps = [ + // { + // val: min, + // class: 'heatmap-0' + // }, + // { + // val: min + (step * 1), + // class: 'heatmap-1' + // }, + // { + // val: min + (step * 2), + // class: 'heatmap-2' + // }, + // { + // val: min + (step * 3), + // class: 'heatmap-3' + // }, + // { + // val: min + (step * 4), + // class: 'heatmap-4' + // }, + // ]; + let median = Misc.median(TestStats.burstHistory); + let adatm = []; + TestStats.burstHistory.forEach((burst) => { + adatm.push(Math.abs(median - burst)); + }); + let step = Misc.mean(adatm); + // let step = Misc.stdDev(TestStats.burstHistory)/2; + let steps = [ + { + val: 0, + class: "heatmap-0", + }, + { + val: median - step * 1.5, + class: "heatmap-1", + }, + { + val: median - step * 0.5, + class: "heatmap-2", + }, + { + val: median + step * 0.5, + class: "heatmap-3", + }, + { + val: median + step * 1.5, + class: "heatmap-4", + }, + ]; + $("#resultWordsHistory .words .word").each((index, word) => { + let wordBurstVal = parseInt($(word).attr("burst")); + let cls = ""; + steps.forEach((step) => { + if (wordBurstVal > step.val) cls = step.class; + }); + $(word).addClass(cls); + }); } else { - //clear all classes $("#resultWordsHistory .heatmapLegend").addClass("hidden"); $("#resultWordsHistory .words .word").removeClass("heatmap-0"); $("#resultWordsHistory .words .word").removeClass("heatmap-1"); @@ -803,73 +864,6 @@ function toggleBurstHeatmap() { $("#resultWordsHistory .words .word").removeClass("heatmap-3"); $("#resultWordsHistory .words .word").removeClass("heatmap-4"); } - heatmapEnabled = !heatmapEnabled; -} - -export function applyBurstHeatmap() { - $("#resultWordsHistory .heatmapLegend").removeClass("hidden"); - let min = Math.min(...TestStats.burstHistory); - let max = Math.max(...TestStats.burstHistory); - // let step = (max - min) / 5; - // let steps = [ - // { - // val: min, - // class: 'heatmap-0' - // }, - // { - // val: min + (step * 1), - // class: 'heatmap-1' - // }, - // { - // val: min + (step * 2), - // class: 'heatmap-2' - // }, - // { - // val: min + (step * 3), - // class: 'heatmap-3' - // }, - // { - // val: min + (step * 4), - // class: 'heatmap-4' - // }, - // ]; - let median = Misc.median(TestStats.burstHistory); - let adatm = []; - TestStats.burstHistory.forEach((burst) => { - adatm.push(Math.abs(median - burst)); - }); - let step = Misc.mean(adatm); - // let step = Misc.stdDev(TestStats.burstHistory)/2; - let steps = [ - { - val: 0, - class: "heatmap-0", - }, - { - val: median - step * 1.5, - class: "heatmap-1", - }, - { - val: median - step * 0.5, - class: "heatmap-2", - }, - { - val: median + step * 0.5, - class: "heatmap-3", - }, - { - val: median + step * 1.5, - class: "heatmap-4", - }, - ]; - $("#resultWordsHistory .words .word").each((index, word) => { - let wordBurstVal = parseInt($(word).attr("burst")); - let cls = ""; - steps.forEach((step) => { - if (wordBurstVal > step.val) cls = step.class; - }); - $(word).addClass(cls); - }); } export function highlightBadWord(index, showError) { @@ -908,7 +902,7 @@ $(".pageTest #copyWordsListButton").click(async (event) => { }); $(".pageTest #toggleBurstHeatmap").click(async (event) => { - toggleBurstHeatmap(); + UpdateConfig.setBurstHeatmap(!Config.burstHeatmap); }); $(document).on("mouseleave", "#resultWordsHistory .words .word", (e) => { From a5e4d89107b108d946735d48bbf12e909c1b14d4 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 12 Jul 2021 23:36:26 +0100 Subject: [PATCH 6/6] fixed theme buttons not responsive --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 9a728c5fb..43bcc1b84 100644 --- a/static/index.html +++ b/static/index.html @@ -3561,7 +3561,7 @@ -
+

theme