-
Notifications
You must be signed in to change notification settings - Fork 5
Port main-menu files to TypeScript #2791
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
base: main
Are you sure you want to change the base?
Conversation
61372d3 to
ffd4b88
Compare
1012bbd to
58e60b6
Compare
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.
The changes are actually minimal apart from prettier. See the first commit.
| function LoginLink() { | ||
| // It's not used directly, but loginLink changes when it does | ||
| useLocation(); | ||
| const addressHinkyQAIssue = React.useCallback( |
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.
This was a very old kludge and TS said it was not legal. I saw no problems arise from removing it.
58e60b6 to
2590897
Compare
| default: () => ({innerWidth: 1024}) | ||
| })); | ||
|
|
||
| // Having it defined inline caused location updates on every call |
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.
Better to mock routing with MemoryRouter
- Port all 4 files in src/app/layouts/default/header/menus/main-menu to .tsx - Add type annotations following guidelines: avoid any, prefer type over interface - Use inline type definitions for function parameters - Rely on type inference where possible - Keep line lengths under 120 characters Related to CORE-1266 🤖 Generated with [Claude Code](https://claude.com/claude-code) Port main-menu JS files to TypeScript - Port all 4 files in src/app/layouts/default/header/menus/main-menu to .tsx - Add type annotations following guidelines: avoid any, prefer type over interface - Use inline type definitions for function parameters - Rely on type inference where possible - Keep line lengths under 120 characters Related to CORE-1266 🤖 Generated with [Claude Code](https://claude.com/claude-code) Fix lint issues Fix window.SETTINGS type assertion Use double type assertion via unknown to properly convert Window type. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Fix TypeScript type issues in main-menu files - Make children props optional to handle JSX children - Add type assertion for window.SETTINGS - Add explicit types for filter/map callbacks - Use index as fallback key in map operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Fix window.SETTINGS type assertion Use double type assertion via unknown to properly convert Window type. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Fix TypeScript type issues in main-menu files - Make children props optional to handle JSX children - Add type assertion for window.SETTINGS - Add explicit types for filter/map callbacks - Use index as fallback key in map operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) lint issues related to dropdown Co-Authored-By: Claude <noreply@anthropic.com>
main-menu/dropdown main-menu login menu "hinkyQAIssue" came from years ago; the solution wasn't legal. use-navigate-by-key adjusted Test coverage: menu-expander
2590897 to
84c2ae7
Compare
Summary
Port all 4 JavaScript files in
src/app/layouts/default/header/menus/main-menuto TypeScript following the project's guidelines.Changes
login-menu/login-menu.js→login-menu/login-menu.tsxlogin-menu/login-menu-with-dropdown.js→login-menu/login-menu-with-dropdown.tsxdropdown/dropdown.js→dropdown/dropdown.tsxmain-menu.js→main-menu.tsxGuidelines Followed
anytypetypeoverinterfaceTest Plan
Related to: https://openstax.atlassian.net/browse/CORE-1266
🤖 Generated with Claude Code