Skip to content

Commit 54ec552

Browse files
OpenStaxClaudeclaude
authored andcommitted
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) Co-Authored-By: Claude <[email protected]>
1 parent 0c1ce24 commit 54ec552

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/app/layouts/default/header/menus/main-menu/login-menu/login-menu-with-dropdown.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import {useLocation} from 'react-router-dom';
33
import useUserContext from '~/contexts/user';
44
import linkHelper from '~/helpers/link';
55
import Dropdown, {MenuItem} from '../dropdown/dropdown';
6+
import type {WindowWithSettings} from '~/helpers/window-settings';
7+
import {assertDefined} from '~/helpers/data';
68

7-
const settings = (window as unknown as {SETTINGS: {accountHref: string}}).SETTINGS;
9+
const settings = (window as WindowWithSettings).SETTINGS;
810
const reqFacultyAccessLink = `${settings.accountHref}/i/signup/educator/cs_form`;
911
const profileLink = `${settings.accountHref}/profile`;
1012

@@ -21,7 +23,7 @@ function AccountItem() {
2123

2224

2325
export default function LoginMenuWithDropdown() {
24-
const {userModel} = useUserContext();
26+
const userModel = assertDefined(useUserContext().userModel);
2527

2628
// updates logoutLink
2729
useLocation();

src/app/layouts/default/header/menus/main-menu/main-menu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function SubjectsMenu() {
111111
);
112112
}
113113

114+
// eslint-disable-next-line complexity
114115
function navigateWithArrows(event: React.KeyboardEvent<HTMLUListElement>) {
115116
switch (event.key) {
116117
case 'ArrowRight':

0 commit comments

Comments
 (0)