Skip to content

Commit 39d517c

Browse files
committed
fix(command-line): hide Firefox private-window shortcut hint (@d1rshan)
1 parent ed774cf commit 39d517c

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

frontend/src/ts/components/layout/footer/Keytips.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import { Conditional } from "../../common/Conditional";
66

77
export function Keytips(): JSXElement {
88
const userAgent = window.navigator.userAgent.toLowerCase();
9-
const modifierKey =
10-
userAgent.includes("mac") && !userAgent.includes("firefox")
11-
? "cmd"
12-
: "ctrl";
9+
const isFirefox = userAgent.includes("firefox");
10+
const modifierKey = userAgent.includes("mac") && !isFirefox ? "cmd" : "ctrl";
1311

1412
const commandKey = (): string =>
1513
getConfig.quickRestart === "esc" ? "tab" : "esc";
@@ -36,8 +34,20 @@ export function Keytips(): JSXElement {
3634
}
3735
/>
3836
<br />
39-
<kbd>{commandKey()}</kbd> or <kbd>{modifierKey}</kbd> + <kbd>shift</kbd>{" "}
40-
+ <kbd>p</kbd> - command line
37+
<Conditional
38+
if={isFirefox}
39+
then={
40+
<>
41+
<kbd>{commandKey()}</kbd> - command line
42+
</>
43+
}
44+
else={
45+
<>
46+
<kbd>{commandKey()}</kbd> or <kbd>{modifierKey}</kbd> +{" "}
47+
<kbd>shift</kbd> + <kbd>p</kbd> - command line
48+
</>
49+
}
50+
/>
4151
</div>
4252
</Show>
4353
);

frontend/src/ts/components/pages/AboutPage.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import { H2, H3 } from "../common/Headers";
2020

2121
export function AboutPage(): JSXElement {
2222
const isOpen = () => getActivePage() === "about";
23+
const isFirefox = window.navigator.userAgent
24+
.toLowerCase()
25+
.includes("firefox");
26+
const commandKey = (): string =>
27+
getConfig.quickRestart === "esc" ? "tab" : "esc";
2328

2429
const contributors = useQuery(() => ({
2530
...getContributorsQueryOptions(),
@@ -203,9 +208,20 @@ export function AboutPage(): JSXElement {
203208
<p>
204209
You can use <kbd>tab</kbd> and <kbd>enter</kbd> (or just{" "}
205210
<kbd>tab</kbd> if you have quick tab mode enabled) to restart the
206-
typing test. Open the command line by pressing <kbd>ctrl/cmd</kbd> +{" "}
207-
<kbd>shift</kbd> + <kbd>p</kbd> or <kbd>esc</kbd> - there you can
208-
access all the functionality you need without touching your mouse.
211+
typing test. Open the command line by pressing{" "}
212+
<Show
213+
when={isFirefox}
214+
fallback={
215+
<>
216+
<kbd>ctrl/cmd</kbd> + <kbd>shift</kbd> + <kbd>p</kbd> or{" "}
217+
<kbd>{commandKey()}</kbd>
218+
</>
219+
}
220+
>
221+
<kbd>{commandKey()}</kbd>
222+
</Show>{" "}
223+
- there you can access all the functionality you need without touching
224+
your mouse.
209225
</p>
210226
</section>
211227
<section>

frontend/src/ts/pages/settings.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -724,15 +724,13 @@ export async function update(
724724
CustomBackgroundFilter.updateUI();
725725

726726
const userAgent = window.navigator.userAgent.toLowerCase();
727-
const modifierKey =
728-
userAgent.includes("mac") && !userAgent.includes("firefox")
729-
? "cmd"
730-
: "ctrl";
727+
const isFirefox = userAgent.includes("firefox");
728+
const modifierKey = userAgent.includes("mac") && !isFirefox ? "cmd" : "ctrl";
731729

732730
const commandKey = Config.quickRestart === "esc" ? "tab" : "esc";
733731
qs(".pageSettings .tip")?.setHtml(`
734732
tip: You can also change all these settings quickly using the
735-
command line (<kbd>${commandKey}</kbd> or <kbd>${modifierKey}</kbd> + <kbd>shift</kbd> + <kbd>p</kbd>)`);
733+
command line (${isFirefox ? `<kbd>${commandKey}</kbd>` : `<kbd>${commandKey}</kbd> or <kbd>${modifierKey}</kbd> + <kbd>shift</kbd> + <kbd>p</kbd>`})`);
736734

737735
if (
738736
customLayoutFluidSelect !== undefined &&

0 commit comments

Comments
 (0)