Skip to content

Conversation

OpenStaxClaude
Copy link
Contributor

@OpenStaxClaude OpenStaxClaude commented Oct 9, 2025

Summary

Converted all remaining JavaScript files in src/app/pages/details directory to TypeScript as requested in CORE-1287.

Files Converted

Desktop view modules:

  • desktop-view.jsdesktop-view.tsx
  • details-tab.jsdetails-tab.tsx
  • videos-tab.jsvideos-tab.tsx
  • partners.jspartners.tsx
  • import-instructor-resource-tab.jsimport-instructor-resource-tab.ts
  • import-student-resource-tab.jsimport-student-resource-tab.ts

Phone view modules:

  • phone-view.jsphone-view.tsx
  • details-pane.jsdetails-pane.tsx
  • student-resources-pane.jsstudent-resources-pane.tsx
  • instructor-resources-pane.jsinstructor-resources-pane.tsx

Guidelines Followed

All conversions adhere to the TypeScript best practices specified in the ticket:

  • ✅ Avoided using any type
  • ✅ Preferred type to interface
  • ✅ Relied on type inference rather than explicit typing where possible
  • ✅ Used inline type definitions for function parameters
  • ✅ Kept line lengths to under 120 characters

Changes Made

  • Added proper TypeScript type annotations for all function parameters and return types
  • Imported types from existing TypeScript files (context.tsx, resource-box-utils.tsx, etc.)
  • Defined inline types for component props following the project's pattern
  • Maintained all existing functionality - this is a pure type conversion with no behavioral changes

Test Plan

  • Verify the application builds successfully
  • Test desktop view navigation between tabs (Book details, Instructor resources, Student resources, Videos)
  • Test phone view accordion functionality
  • Verify resource boxes display correctly on both desktop and mobile
  • Test partner cards display and navigation
  • Verify Polish language book pages render correctly

🤖 Generated with Claude Code

@RoyEJohnson RoyEJohnson force-pushed the CORE-1287-port-js-to-ts branch 2 times, most recently from 65d1634 to 584cdf5 Compare October 15, 2025 19:31
@RoyEJohnson RoyEJohnson self-assigned this Oct 15, 2025
@RoyEJohnson RoyEJohnson requested a review from jivey October 15, 2025 20:39
@RoyEJohnson RoyEJohnson force-pushed the CORE-1287-port-js-to-ts branch 2 times, most recently from 94c0dff to 852f593 Compare October 15, 2025 21:22
Copy link
Contributor

Choose a reason for hiding this comment

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

The first commit shows the JS->TS changes, and there are a few more changes in the 2nd commit.

@RoyEJohnson RoyEJohnson force-pushed the CORE-1287-port-js-to-ts branch from 852f593 to 2e6d867 Compare October 15, 2025 21:45
Copy link
Contributor

Choose a reason for hiding this comment

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

Small file, so the changes were too much to show as changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changes are shown in the individual commits, but there are changes in each of the commits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even the first commit shows it as a delete-and-create. Sorry. :(

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, even the first commit has it as delete-and-create (the first commit was pretty much just Claude doing the types)

OpenStaxClaude and others added 3 commits October 16, 2025 10:28
Converted all remaining JavaScript files in src/app/pages/details to TypeScript:

Desktop view modules:
- desktop-view.js → desktop-view.tsx
- details-tab.js → details-tab.tsx
- videos-tab.js → videos-tab.tsx
- partners.js → partners.tsx
- import-*.js → import-*.ts

Phone view modules:
- phone-view.js → phone-view.tsx
- details-pane.js → details-pane.tsx
- student-resources-pane.js → student-resources-pane.tsx
- instructor-resources-pane.js → instructor-resources-pane.tsx

All conversions follow TypeScript best practices:
- Avoided using 'any' type
- Preferred 'type' to 'interface'
- Used type inference where possible
- Inline type definitions for function parameters
- Line lengths kept under 120 characters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Port remaining book details page modules from JS to TS

Converted all remaining JavaScript files in src/app/pages/details to TypeScript:

Desktop view modules:
- desktop-view.js → desktop-view.tsx
- details-tab.js → details-tab.tsx
- videos-tab.js → videos-tab.tsx
- partners.js → partners.tsx
- import-*.js → import-*.ts

Phone view modules:
- phone-view.js → phone-view.tsx
- details-pane.js → details-pane.tsx
- student-resources-pane.js → student-resources-pane.tsx
- instructor-resources-pane.js → instructor-resources-pane.tsx

All conversions follow TypeScript best practices:
- Avoided using 'any' type
- Preferred 'type' to 'interface'
- Used type inference where possible
- Inline type definitions for function parameters
- Line lengths kept under 120 characters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Revert to JS (loaders)

Co-Authored-By: Claude <noreply@anthropic.com>
@RoyEJohnson RoyEJohnson force-pushed the CORE-1287-port-js-to-ts branch from 2e6d867 to f0ec3e6 Compare October 16, 2025 15:28
Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

Left some minor comments about types

freeStuffStudent: StuffContent;
freeStuffInstructor: StuffContent;
videos: VideoContent[];
videos: [VideoContent[]] | never[];
Copy link
Member

Choose a reason for hiding this comment

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

This type seems odd, but maybe only because the CMS data shape is odd?

<Option condition={model.cheggLink}>
<a href={model.cheggLink} data-track="Chegg Reader">
<Option condition={model.cheggLink ?? false}>
<a href={model.cheggLink as string} data-track="Chegg Reader">
Copy link
Member

Choose a reason for hiding this comment

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

The type for this property seems confusing - it could be null, but not here? Do we need an assertString helper?

link={webviewLink}
variant="View online"
warning={model.contentWarningText}
warning={model.contentWarningText ?? undefined}
Copy link
Member

Choose a reason for hiding this comment

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

Not a big deal but I wonder if it would be nice to align the component types to the model so we don't have to do this

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