Skip to content

Commit fb11861

Browse files
Merge branch 'monkeytypegame:master' into master
2 parents 8ae76df + 4d4ffb7 commit fb11861

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1060
-1071
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
### Checks
66

7-
- [ ] Adding/modifying Typescript code?
8-
- [ ] I have used `qs`, `qsa` or `qsr` instead of JQuery selectors.
97
- [ ] Adding quotes?
108
- [ ] Make sure to include translations for the quotes in the description (or another comment) so we can verify their content.
119
- [ ] Adding a language?

docs/CONTRIBUTING_ADVANCED.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ If you are on a UNIX system and you get a spawn error, run npm with `sudo`.
150150

151151
Code formatting is enforced by [Prettier](https://prettier.io/docs/en/install.html), which automatically runs every time you make a commit.
152152

153-
We are currently in the process of converting from JQuery to vanilla JS. When submitting new code, please use the `qs`, `qsa` and `qsr` helper functions. These return a class with a lot of JQuery-like methods. You can read how they work and import them from `frontend/src/ts/utils/dom.ts`.
154-
155153
For guidelines on commit messages, adding themes, languages, or quotes, please refer to [CONTRIBUTING.md](./CONTRIBUTING.md). Following these guidelines will increase the chances of getting your change accepted.
156154

157155
## Questions

frontend/__tests__/__harness__/setup-jquery.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

frontend/__tests__/test/layout-emulator.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ describe("LayoutEmulator", () => {
1313
updateAltGrState(event);
1414
});
1515

16-
const createEvent = (
17-
code: string,
18-
type: string,
19-
): JQuery.KeyboardEventBase =>
16+
const createEvent = (code: string, type: string): KeyboardEvent =>
2017
({
2118
code,
2219
type,
23-
}) as JQuery.KeyboardEventBase;
20+
}) as KeyboardEvent;
2421

2522
it("should set isAltGrPressed to true on AltRight keydown", () => {
2623
const event = createEvent("AltRight", "keydown");

frontend/__tests__/utils/dom.jsdom-spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe("dom", () => {
2626
handler({
2727
target: e.target,
2828
childTarget: e.childTarget,
29-
//@ts-expect-error will be added later, check TODO on the ChildEvent
3029
currentTarget: e.currentTarget,
3130
}),
3231
);
@@ -130,10 +129,6 @@ describe("dom", () => {
130129
await userEvent.click(clickTarget);
131130

132131
//THEN
133-
134-
//This is the same behavior as jQuery `.on` with selector.
135-
//The handler will be called two times,
136-
//It does NOT call on the <section> or the parent element itself
137132
expect(handler).toHaveBeenCalledTimes(2);
138133

139134
//First call is for childTarget inner2 (grand child of parent)

frontend/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"hangul-js": "0.2.6",
4848
"howler": "2.2.3",
4949
"idb": "8.0.3",
50-
"jquery": "3.7.1",
5150
"konami": "1.7.0",
5251
"lz-ts": "1.1.2",
5352
"modern-screenshot": "4.6.5",
@@ -73,7 +72,6 @@
7372
"@types/chartjs-plugin-trendline": "1.0.1",
7473
"@types/damerau-levenshtein": "1.0.0",
7574
"@types/howler": "2.2.7",
76-
"@types/jquery": "3.5.14",
7775
"@types/node": "24.9.1",
7876
"@types/object-hash": "3.0.6",
7977
"@types/subset-font": "1.4.3",

frontend/src/styles/index.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
}
1616
}
1717

18+
// the screenshotting library has some issues with css layers
19+
@import "fonts";
20+
1821
@layer custom-styles {
19-
@import "buttons", "fonts", "404", "ads", "account", "animations", "caret",
22+
@import "buttons", "404", "ads", "account", "animations", "caret",
2023
"commandline", "core", "inputs", "keymap", "login", "monkey", "nav",
2124
"notifications", "popups", "profile", "scroll", "settings",
2225
"account-settings", "leaderboards", "test", "loading", "friends",

frontend/src/styles/vendor.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import "normalize.css" layer(normalize);
1+
@import "fontawesome-5"; // the screenshotting library has some issues with css layers
22

3+
@import "normalize.css" layer(normalize);
34
@layer vendor {
4-
@import "fontawesome-5";
55
@import "slim-select/styles";
66
@import "balloon-css/src/balloon";
77
}

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,14 @@ import { getFocus } from "../../../signals/core";
44
import { showModal } from "../../../stores/modals";
55
import { Button } from "../../common/Button";
66

7+
import { Keytips } from "./Keytips";
78
import { ThemeIndicator } from "./ThemeIndicator";
89
import { VersionButton } from "./VersionButton";
910

1011
export function Footer(): JSXElement {
1112
return (
1213
<footer class="text-sub relative text-xs">
13-
<div
14-
class="mb-8 text-center leading-loose transition-opacity"
15-
classList={{
16-
"opacity-0": getFocus(),
17-
}}
18-
>
19-
<kbd>tab</kbd> and <kbd>enter</kbd> - restart test
20-
<br />
21-
<kbd>ctrl/cmd</kbd> + <kbd>shift</kbd> + <kbd>p</kbd> or <kbd>esc</kbd>{" "}
22-
- command line
23-
</div>
14+
<Keytips />
2415

2516
<div
2617
class="-m-2 flex justify-between gap-8 transition-opacity"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { JSXElement, Show } from "solid-js";
2+
3+
import { getConfig } from "../../../signals/config";
4+
import { getFocus } from "../../../signals/core";
5+
import { Conditional } from "../../common/Conditional";
6+
7+
export function Keytips(): JSXElement {
8+
const userAgent = window.navigator.userAgent.toLowerCase();
9+
const modifierKey =
10+
userAgent.includes("mac") && !userAgent.includes("firefox")
11+
? "cmd"
12+
: "ctrl";
13+
14+
const commandKey = (): string =>
15+
getConfig.quickRestart === "esc" ? "tab" : "esc";
16+
17+
return (
18+
<Show when={getConfig.showKeyTips}>
19+
<div
20+
class="mb-8 text-center leading-loose transition-opacity"
21+
classList={{
22+
"opacity-0": getFocus(),
23+
}}
24+
>
25+
<Conditional
26+
if={getConfig.quickRestart === "off"}
27+
then={
28+
<>
29+
<kbd>tab</kbd> + <kbd>enter</kbd> - restart test
30+
</>
31+
}
32+
else={
33+
<>
34+
<kbd>{getConfig.quickRestart}</kbd> - restart test
35+
</>
36+
}
37+
/>
38+
<br />
39+
<kbd>{commandKey()}</kbd> or <kbd>{modifierKey}</kbd> + <kbd>shift</kbd>{" "}
40+
+ <kbd>p</kbd> - command line
41+
</div>
42+
</Show>
43+
);
44+
}

0 commit comments

Comments
 (0)