Skip to content

Conversation

@OpenStaxClaude
Copy link
Contributor

Summary

Port all 4 JavaScript files in src/app/layouts/default/header/menus/main-menu to TypeScript following the project's guidelines.

Changes

  • login-menu/login-menu.jslogin-menu/login-menu.tsx
  • login-menu/login-menu-with-dropdown.jslogin-menu/login-menu-with-dropdown.tsx
  • dropdown/dropdown.jsdropdown/dropdown.tsx
  • main-menu.jsmain-menu.tsx

Guidelines Followed

  • Avoided using any type
  • Preferred type over interface
  • Relied on type inference rather than explicit typing where possible
  • Used inline type definitions for function parameters
  • Kept line lengths under 120 characters
  • Each file ends with a newline

Test Plan

  • Build passes without type errors
  • No runtime errors in main menu functionality
  • Visual regression tests pass

Related to: https://openstax.atlassian.net/browse/CORE-1266

🤖 Generated with Claude Code

@OpenStaxClaude OpenStaxClaude marked this pull request as ready for review November 3, 2025 22:07
@RoyEJohnson RoyEJohnson force-pushed the port-main-menu-ts branch 2 times, most recently from 61372d3 to ffd4b88 Compare November 10, 2025 22:53
@RoyEJohnson RoyEJohnson force-pushed the port-main-menu-ts branch 5 times, most recently from 1012bbd to 58e60b6 Compare November 24, 2025 23:39
Copy link
Contributor

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(
Copy link
Contributor

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.

default: () => ({innerWidth: 1024})
}));

// Having it defined inline caused location updates on every call
Copy link
Contributor

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

@RoyEJohnson RoyEJohnson requested a review from jivey November 25, 2025 00:17
OpenStaxClaude and others added 3 commits November 25, 2025 09:27
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants