mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-18 03:26:07 +08:00
added pace caret: last closes #3113
This commit is contained in:
parent
f02649ae9f
commit
3da4eb45c0
7 changed files with 26 additions and 5 deletions
|
@ -76,7 +76,7 @@ const CONFIG_SCHEMA = joi.object({
|
|||
startGraphsAtZero: joi.boolean(),
|
||||
swapEscAndTab: joi.boolean(),
|
||||
showOutOfFocusWarning: joi.boolean(),
|
||||
paceCaret: joi.string().valid("off", "average", "pb", "custom"),
|
||||
paceCaret: joi.string().valid("off", "average", "pb", "last", "custom"),
|
||||
paceCaretCustomSpeed: joi.number().min(0),
|
||||
repeatedPace: joi.boolean(),
|
||||
pageWidth: joi.string().valid("100", "125", "150", "200", "max"),
|
||||
|
|
|
@ -355,7 +355,9 @@ export function setPaceCaret(
|
|||
nosave?: boolean
|
||||
): boolean {
|
||||
if (
|
||||
!isConfigValueValid("pace caret", val, [["custom", "off", "average", "pb"]])
|
||||
!isConfigValueValid("pace caret", val, [
|
||||
["custom", "off", "average", "pb", "last"],
|
||||
])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1492,6 +1492,15 @@ const commandsPaceCaret: MonkeyTypes.CommandsGroup = {
|
|||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "setPaceCaretLast",
|
||||
display: "last",
|
||||
configValue: "last",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setPaceCaret("last");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "setPaceCaretAverage",
|
||||
display: "average",
|
||||
|
|
|
@ -100,6 +100,8 @@ export async function update(): Promise<void> {
|
|||
? "average"
|
||||
: Config.paceCaret === "pb"
|
||||
? "pb"
|
||||
: Config.paceCaret === "last"
|
||||
? "last"
|
||||
: "custom"
|
||||
} pace${speed}</div>`
|
||||
);
|
||||
|
|
|
@ -77,7 +77,7 @@ export async function init(): Promise<void> {
|
|||
wpm = Math.round(wpm);
|
||||
} else if (Config.paceCaret === "custom") {
|
||||
wpm = Config.paceCaretCustomSpeed;
|
||||
} else if (TestState.isPaceRepeat == true) {
|
||||
} else if (Config.paceCaret === "last" || TestState.isPaceRepeat == true) {
|
||||
wpm = TestStats.lastTestWpm;
|
||||
}
|
||||
if (wpm === undefined || wpm < 1 || Number.isNaN(wpm)) {
|
||||
|
|
2
frontend/src/ts/types/types.d.ts
vendored
2
frontend/src/ts/types/types.d.ts
vendored
|
@ -92,7 +92,7 @@ declare namespace MonkeyTypes {
|
|||
|
||||
type SoundVolume = "0.1" | "0.5" | "1.0";
|
||||
|
||||
type PaceCaret = "off" | "average" | "pb" | "custom";
|
||||
type PaceCaret = "off" | "average" | "pb" | "last" | "custom";
|
||||
|
||||
type PageWidth = "100" | "125" | "150" | "200" | "max";
|
||||
|
||||
|
|
|
@ -1022,7 +1022,7 @@
|
|||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
average
|
||||
avg
|
||||
</div>
|
||||
<div
|
||||
class="button"
|
||||
|
@ -1032,6 +1032,14 @@
|
|||
>
|
||||
pb
|
||||
</div>
|
||||
<div
|
||||
class="button"
|
||||
paceCaret="last"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
last
|
||||
</div>
|
||||
<div
|
||||
class="button"
|
||||
paceCaret="custom"
|
||||
|
|
Loading…
Add table
Reference in a new issue