Skip to content

Commit

Permalink
Merge branch 'master' into feature/parse-with-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec authored Dec 22, 2024
2 parents 5e5f574 + 4baae8f commit 813331f
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 16 deletions.
6 changes: 6 additions & 0 deletions frontend/src/ts/controllers/account-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { navigate } from "./route-controller";
import { FirebaseError } from "firebase/app";
import * as PSA from "../elements/psa";
import defaultResultFilters from "../constants/default-result-filters";
import { getActiveFunboxes } from "../test/funbox/list";

export const gmailProvider = new GoogleAuthProvider();
export const githubProvider = new GithubAuthProvider();
Expand Down Expand Up @@ -171,6 +172,11 @@ async function getDataAndInit(): Promise<boolean> {
);
await UpdateConfig.apply(snapshot.config);
UpdateConfig.saveFullConfigToLocalStorage(true);

//funboxes might be different and they wont activate on the account page
for (const fb of getActiveFunboxes()) {
fb.functions?.applyGlobalCSS?.();
}
}
AccountButton.loading(false);
TagController.loadActiveFromLocalStorage();
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/ts/controllers/input-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,14 @@ function isCharCorrect(char: string, charIndex: number): boolean {
char === "‘" ||
char === "'" ||
char === "ʼ" ||
char === "׳") &&
char === "׳" ||
char === "ʻ") &&
(originalChar === "’" ||
originalChar === "‘" ||
originalChar === "'" ||
originalChar === "ʼ" ||
originalChar === "׳")
originalChar === "׳" ||
originalChar === "ʻ")
) {
return true;
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/ts/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ export async function getUserResults(offset?: number): Promise<boolean> {
return false;
}

//another check in case user logs out while waiting for response
if (!isAuthenticated()) return false;

const results: SnapshotResult<Mode>[] = response.body.data.map((result) => {
if (result.bailedOut === undefined) result.bailedOut = false;
if (result.blindMode === undefined) result.blindMode = false;
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/ts/ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import * as AccountButton from "./elements/account-button";
import Konami from "konami";
import * as ServerConfiguration from "./ape/server-configuration";
import { getActiveFunboxes } from "./test/funbox/list";
import { loadPromise } from "./config";

$((): void => {
$(async (): Promise<void> => {
await loadPromise;
Misc.loadCSS("/css/slimselect.min.css", true);
Misc.loadCSS("/css/balloon.min.css", true);

Expand All @@ -19,11 +21,10 @@ $((): void => {
//to make sure the initial theme application doesnt animate the background color
$("body").css("transition", "background .25s, transform .05s");
MerchBanner.showIfNotClosedBefore();
setTimeout(() => {
for (const fb of getActiveFunboxes()) {
fb.functions?.applyGlobalCSS?.();
}
}, 500); //this approach will probably bite me in the ass at some point

for (const fb of getActiveFunboxes()) {
fb.functions?.applyGlobalCSS?.();
}

$("#app")
.css("opacity", "0")
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/ts/test/test-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function layoutfluid(): void {
function checkIfFailed(
wpmAndRaw: { wpm: number; raw: number },
acc: number
): void {
): boolean {
if (timerDebug) console.time("fail conditions");
TestInput.pushKeypressesToHistory();
TestInput.pushErrorToHistory();
Expand All @@ -143,16 +143,17 @@ function checkIfFailed(
SlowTimer.clear();
slowTimerCount = 0;
TimerEvent.dispatch("fail", "min speed");
return;
return true;
}
if (Config.minAcc === "custom" && acc < Config.minAccCustom) {
if (timer !== null) clearTimeout(timer);
SlowTimer.clear();
slowTimerCount = 0;
TimerEvent.dispatch("fail", "min accuracy");
return;
return true;
}
if (timerDebug) console.timeEnd("fail conditions");
return false;
}

function checkIfTimeIsUp(): void {
Expand Down Expand Up @@ -200,8 +201,8 @@ async function timerStep(): Promise<void> {
const acc = calculateAcc();
monkey(wpmAndRaw);
layoutfluid();
checkIfFailed(wpmAndRaw, acc);
checkIfTimeIsUp();
const failed = checkIfFailed(wpmAndRaw, acc);
if (!failed) checkIfTimeIsUp();
if (timerDebug) console.timeEnd("timer step -----------------------------");
}

Expand Down
1 change: 1 addition & 0 deletions frontend/static/languages/_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@
"code_lua",
"code_luau",
"code_latex",
"code_typst",
"code_matlab",
"code_sql",
"code_perl",
Expand Down
1 change: 1 addition & 0 deletions frontend/static/languages/_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
,"code_lua"
,"code_luau"
,"code_latex"
,"code_typst"
,"code_matlab"
,"code_sql"
,"code_perl"
Expand Down
50 changes: 50 additions & 0 deletions frontend/static/languages/code_typst.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "code_typst",
"noLazyMode": true,
"ligatures": false,
"words": [
"#use",
"#set par(justify: true)",
"#show",
"#set",
"#let",
"#par",
"#figure",
"#underline",
"#smallcaps",
"#grid",
"#box",
"#place",
"#import",
"#link",
"#lorem(50)",
"let",
"#{",
"}",
"#(",
")",
"#[",
"]",
"$",
"@",
"*",
"-",
"_",
"\\",
"/",
"//",
"floor(x)",
"cal(A)",
"NN",
"RR",
">",
"<",
">=",
"gt.eq.not",
"sum_(k=1)^oo",
"pi",
"&=",
"vec",
"mat"
]
}
1 change: 0 additions & 1 deletion frontend/static/languages/polish_2k.json
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,6 @@
"Bóg",
"wybrać",
"zjawisko",
"abugida",
"według",
"kara",
"czas",
Expand Down
24 changes: 24 additions & 0 deletions frontend/static/quotes/dutch.json
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,30 @@
"source": "Etty Hillesum",
"length": 95,
"id": 65
},
{
"text": "Geef al uw geld aan de arme mensen... als zij hetzelfde doen heb je het morgen misschien al terug.",
"source": "Herman Brusselmans",
"length": 98,
"id": 66
},
{
"text": "Schrap het woord 'ik' uit het taalgebruik en de hele mensheid staat met de mond vol tanden en het paniekzweet op het voorhoofd.",
"source": "Herman Brusselmans",
"length": 127,
"id": 67
},
{
"text": "Een James Bond-boek is stom maar opwindend, terwijl een meesterwerk van de Vlaamse literatuur even stom maar daarbij ook nog vervelend is.",
"source": "Louis Paul Boon",
"length": 138,
"id": 68
},
{
"text": "Ik ben absoluut tegen de puurheid van de taal. Als het iets wezenlijks meebrengt, moet je anglicismen, germanismen en gallicismen meteen cultiveren. Ik geloof niet in het uitgedunde, dat men voorhoudt als het enige Nederlands, ik irriteer me aan de Nederlandse overheersing.",
"source": "Hugo Claus",
"length": 274,
"id": 69
}
]
}
2 changes: 1 addition & 1 deletion frontend/static/quotes/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@
"length": 204
},
{
"text": "There are mysteries to the universe we were never meant to solve, but who we are and why we are here, are not among them, those answers we carry inside.",
"text": "There are mysteries to the universe we were never meant to solve. But who we are and why we are here, are not among them. Those answers we carry inside.",
"source": "Transformers: Age of Extinction",
"id": 192,
"length": 152
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const UserNameSchema = doesNotContainProfanity(
.max(16)
.regex(
/^[\da-zA-Z_-]+$/,
"Can only contain lower/uppercase letters, underscare and minus."
"Can only contain lower/uppercase letters, underscore and minus."
)
);

Expand Down

0 comments on commit 813331f

Please sign in to comment.