Skip to content

Commit

Permalink
fix: show command key tip correctly (fehmer) (#5234)
Browse files Browse the repository at this point in the history
* fix: show command key tip correctly

* add spaces

---------

Co-authored-by: Miodec <jack@monkeytype.com>
  • Loading branch information
fehmer and Miodec authored Mar 23, 2024
1 parent f3c6254 commit fc3ac84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
13 changes: 4 additions & 9 deletions frontend/src/ts/pages/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,17 +943,12 @@ export async function update(groupUpdate = true): Promise<void> {
const modifierKey = window.navigator.userAgent.toLowerCase().includes("mac")
? "cmd"
: "ctrl";
if (Config.quickRestart === "esc") {
$(".pageSettings .tip").html(`
tip: You can also change all these settings quickly using the
command line (<key>${modifierKey}</key>+<key>shift</key>+<key>p</key>)`);
} else {
$(".pageSettings .tip").html(`

const commandKey = Config.quickRestart === "esc" ? "tab" : "esc";
$(".pageSettings .tip").html(`
tip: You can also change all these settings quickly using the
command line (<key>esc</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key>)`);
}
command line (<key>${commandKey}</key> or <key>${modifierKey}</key> + <key>shift</key> + <key>p</key>)`);
}

function toggleSettingsGroup(groupName: string): void {
const groupEl = $(`.pageSettings .settingsGroup.${groupName}`);
groupEl.stop(true, true).slideToggle(250).toggleClass("slideup");
Expand Down
31 changes: 4 additions & 27 deletions frontend/src/ts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,10 @@ function updateKeytips(): void {
? "cmd"
: "ctrl";

if (Config.quickRestart === "esc") {
$(".pageSettings .tip").html(`
tip: You can also change all these settings quickly using the
command line (<key>${modifierKey}</key>+<key>shift</key>+<key>p</key>)`);
} else {
$(".pageSettings .tip").html(`
tip: You can also change all these settings quickly using the
command line (<key>esc</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key>)`);
}

if (Config.quickRestart === "esc") {
$("footer .keyTips").html(`
<key>esc</key> - restart test<br>
<key>tab</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key> - command line`);
} else if (Config.quickRestart === "tab") {
$("footer .keyTips").html(`
<key>tab</key> - restart test<br>
<key>esc</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key> - command line`);
} else if (Config.quickRestart === "enter") {
$("footer .keyTips").html(`
<key>enter</key> - restart test<br>
<key>esc</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key> - command line`);
} else {
$("footer .keyTips").html(`
<key>tab</key> + <key>enter</key> - restart test<br>
<key>esc</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key> - command line`);
}
const commandKey = Config.quickRestart === "esc" ? "tab" : "esc";
$("footer .keyTips").html(`
<key>${Config.quickRestart}</key> - restart test<br>
<key>${commandKey}</key> or <key>${modifierKey}</key>+<key>shift</key>+<key>p</key> - command line`);
}

if (isDevEnvironment()) {
Expand Down

0 comments on commit fc3ac84

Please sign in to comment.