Skip to content

Conversation

@fcasibu
Copy link
Contributor

@fcasibu fcasibu commented Dec 25, 2025

Description

Refactor frontend/ts/modals/* to replace jQuery (some still TODO). I've also modified dom.ts to add setValue for ElementsWithUtils<ElementWithValue> instance. Still trying to grep the whole flow/codebase, so usage of qsr or qs is uncertain (Probably use qsr always? Can find non-existing elements that way or developer error). There are a lot of atomic commits in this PR, feel free to squash.

While doing the refactor, also stumbled upon things that I have questions for (didn't made any changes to them), which I thought can be improved:

  • custom-generator.ts:146: The user is able to write minLength > maxLength. Is this behavior correct?
  • custom-test-duration.ts:99: It seems like parseInput, always expects a non nullable string, and we seem to always expect that #customTestDurationModal input to always exist (so I used qsr), which makes the conditions val !== null, !isNaN(val) seem to be unnecessary (val is never null or NaN, tbh also isFinite, and val >= 0 is the only valid condition)
  • custom-text.ts:169: These elements does not seem exist .randomWordsCheckbox, .replaceNewlineWithSpace, .typographyCheck, and .delimiterCheck (last two is just in a challenge file). Are they good to remove?
  • edit-preset.ts:146: Noticed that we're not updaitng the DOM, since for the most part, in the logic, we mostly use state.checkboxes, so no problem happens, but I think it is also a good idea to update the DOM to match current state? Either calling updateUI() here or just changing the checked value inline.
  • quote-rate.ts:89: getQuoteStats expects a quote but we're not really passing anything to it, so this essentially does nothing, since it returns immediately on !quote

Checks

  • Adding/modifying Typescript code?
    • I have used qs, qsa or qsr instead of JQuery selectors.
  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.

Related #7186

#7186

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Dec 25, 2025
@fcasibu fcasibu force-pushed the refactor/ts-modals-remove-jquery branch from e92798c to d0997c2 Compare December 25, 2025 12:18
@fcasibu fcasibu force-pushed the refactor/ts-modals-remove-jquery branch 2 times, most recently from c45226a to 83a24cb Compare December 26, 2025 12:50
@fcasibu fcasibu marked this pull request as ready for review December 26, 2025 12:52
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Dec 26, 2025
@fcasibu fcasibu force-pushed the refactor/ts-modals-remove-jquery branch from 83a24cb to e2f2cc7 Compare December 26, 2025 13:19
@github-actions github-actions bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jan 14, 2026
@fcasibu
Copy link
Contributor Author

fcasibu commented Jan 14, 2026

Not sure what's with this version-history conflict that's going on when the one in this PR are the changes to the one in latest master

@fcasibu fcasibu requested a review from Miodec January 14, 2026 14:08
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Jan 14, 2026
@Miodec
Copy link
Member

Miodec commented Jan 14, 2026

Not sure what's with this version-history conflict that's going on when the one in this PR are the changes to the one in latest master

Ill help you out here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

frontend/src/ts/modals/streak-hour-offset.ts:42

  • The state.offset is no longer being updated since the refactor removed setStateToInput() and related functions. This function always uses the initial value of 0 from state.offset instead of reading from the input element. Change to const inputValue = parseInt(modal.getModal().qs<HTMLInputElement>('input')?.getValue() ?? '0', 10); to read the current input value.
  const inputValue = state.offset;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Miodec Miodec added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for review Pull requests that require a review before continuing labels Jan 14, 2026
@Miodec
Copy link
Member

Miodec commented Jan 14, 2026

Some more comments for you to address

@github-actions github-actions bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jan 15, 2026
@fcasibu
Copy link
Contributor Author

fcasibu commented Jan 15, 2026

Thanks for the help @Miodec!

Done with the fixes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

frontend/src/ts/modals/streak-hour-offset.ts:42

  • The updatePreview function reads from state.offset, but this value is never updated after the refactor removed setStateToInput() and related logic. The function should read the offset value directly from the input element instead. Change line 42 to: const inputValue = parseInt(modal.getModal().qs<HTMLInputElement>(\"input\")?.getValue() ?? \"0\", 10);
function updatePreview(): void {
  const inputValue = state.offset;

frontend/src/ts/modals/streak-hour-offset.ts:13

  • The state object is no longer used after the refactor and should be removed entirely.
let state = {
  offset: 0,
};

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Jan 15, 2026
@github-actions github-actions bot removed the waiting for review Pull requests that require a review before continuing label Jan 15, 2026
@Miodec Miodec merged commit a6cd53c into monkeytypegame:master Jan 15, 2026
14 checks passed
@Miodec
Copy link
Member

Miodec commented Jan 15, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants