-
-
Notifications
You must be signed in to change notification settings - Fork 3k
refactor: use dom utils in animated-modal (@miodec) #7303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors modal and animated modal code to use the DOM utility wrapper (ElementWithUtils) instead of direct DOM manipulation and jQuery, improving code consistency and type safety.
Key Changes:
- Updated
AnimatedModalclass to useElementWithUtilsfor wrapper and modal elements - Added new utility methods to
ElementWithUtils:setChecked(),getChecked(),focus(), andselect() - Refactored 30+ modal files to use DOM utils for event handling, element queries, and DOM manipulation
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/src/ts/utils/dom.ts |
Added new utility methods for checked state, focus, and select functionality to ElementWithUtils class |
frontend/src/ts/utils/animated-modal.ts |
Converted wrapper and modal elements to use ElementWithUtils, updated event handlers and element queries |
frontend/src/ts/utils/simple-modal.ts |
Updated element types to ElementWithUtils and refactored button state management |
frontend/src/ts/modals/word-filter.ts |
Replaced querySelectorAll with qsa() method for button queries |
frontend/src/ts/modals/user-report.ts |
Refactored element queries and event handlers to use DOM utils |
frontend/src/ts/modals/support.ts |
Updated event handler to use .on() method |
frontend/src/ts/modals/streak-hour-offset.ts |
Replaced innerHTML with setHtml(), querySelector with qs(), and direct DOM manipulation with utility methods |
frontend/src/ts/modals/share-test-settings.ts |
Updated setup function signature and converted querySelectorAll to qsa() |
frontend/src/ts/modals/share-custom-theme.ts |
Replaced direct checked property access with setChecked() method |
frontend/src/ts/modals/save-custom-text.ts |
Updated event handlers to use .on() method and setup function signature |
frontend/src/ts/modals/register-captcha.ts |
Updated element query to use qs() method |
frontend/src/ts/modals/quote-submit.ts |
Added ElementWithUtils import and updated setup function signature |
frontend/src/ts/modals/quote-search.ts |
Refactored element queries, event handlers, and updated setup function signature |
frontend/src/ts/modals/quote-report.ts |
Updated setup function signature and event handler |
frontend/src/ts/modals/quote-rate.ts |
Converted querySelectorAll to qsa() and addEventListener to on() |
frontend/src/ts/modals/quote-approve.ts |
Updated event handler to use .on() method |
frontend/src/ts/modals/practise-words.ts |
Converted querySelectorAll to qsa() and event handlers to on() |
frontend/src/ts/modals/pb-tables.ts |
Replaced innerHTML with setText(), empty(), and appendHtml() methods |
frontend/src/ts/modals/mobile-test-config.ts |
Converted querySelectorAll to qsa() and addEventListener to on() |
frontend/src/ts/modals/last-signed-out-result.ts |
Replaced innerHTML with setHtml() method |
frontend/src/ts/modals/import-export-settings.ts |
Refactored element queries and attribute manipulation to use DOM utils |
frontend/src/ts/modals/google-sign-up.ts |
Updated event handler to use on() method |
frontend/src/ts/modals/forgot-password.ts |
Refactored element queries and value retrieval to use DOM utils |
frontend/src/ts/modals/edit-result-tags.ts |
Replaced querySelector with qs(), innerHTML with empty(), and appendChild with append() |
frontend/src/ts/modals/edit-profile.ts |
Updated event handler to use on() method |
frontend/src/ts/modals/edit-preset.ts |
Converted querySelector to qs() and addEventListener to on() |
frontend/src/ts/modals/dev-options.ts |
Refactored all querySelector calls to qs() and addEventListener to on() |
frontend/src/ts/modals/custom-word-amount.ts |
Updated element queries and event handlers to use DOM utils |
frontend/src/ts/modals/custom-text.ts |
Converted querySelectorAll to qsa() and addEventListener to on() |
frontend/src/ts/modals/custom-test-duration.ts |
Updated element queries and event handlers to use DOM utils |
frontend/src/ts/modals/custom-generator.ts |
Updated setup function signature and event handlers |
frontend/src/ts/modals/cookies.ts |
Refactored element queries, class manipulation, and checked state management |
frontend/src/ts/commandline/commandline.ts |
Replaced querySelector with qsr(), classList manipulation with addClass/removeClass, and textContent with setText() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this 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 33 out of 33 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this 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 33 out of 33 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Leonabcd123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to all other instances in modals/custom-text.ts.
Leonabcd123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Refactor