Skip to content

Phase 7.4b: Migrate Remaining Consumers & Remove Final .legacy Files - #3115

Open
OpenStaxClaude wants to merge 5 commits into
mainfrom
phase-7.4b-migrate-remaining-consumers
Open

Phase 7.4b: Migrate Remaining Consumers & Remove Final .legacy Files#3115
OpenStaxClaude wants to merge 5 commits into
mainfrom
phase-7.4b-migrate-remaining-consumers

Conversation

@OpenStaxClaude

@OpenStaxClaude OpenStaxClaude commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR builds on #3113 (Phase 7.4a) by migrating the remaining styled-components consumers and removing the final .legacy.ts files from the codebase.

Base branch: phase-7.4a-remove-legacy-files (PR #3113)
Related Jira ticket: CORE-2285

Background

PR #3113 removed most .legacy files but kept 2 files (Typography.legacy.ts and disablePrint.legacy.ts) because several components were still importing from them. This PR completes the migration by:

  1. Migrating the remaining consumers to plain CSS
  2. Removing the final .legacy files

Changes

Migrated Components (6 files)

PopUp Filter Components

All filter components were using textStyle (a styled-components css fragment that set color: ${theme.color.text.default}) and/or disablePrint (css fragment for @media print { display: none; }).

  • ChapterFilter.tsx

    • Removed textStyle import
    • Replaced ${textStyle} with direct color: ${theme.color.text.default}
    • Updated 2 styled components
  • ColorFilter.tsx

    • Removed textStyle import
    • Replaced ${textStyle} with direct color styling
    • Updated 1 styled component
  • Filters.tsx

    • Removed textStyle and disablePrint imports
    • Replaced ${textStyle} with direct color
    • Replaced ${disablePrint} with inline @media print { display: none; }
    • Updated 2 usages
  • FiltersList.tsx

    • Removed textStyle and disablePrint imports
    • Replaced both with direct CSS
    • Updated 3 styled components

Deleted Files (2 files)

  • Removed src/app/components/Typography/Typography.legacy.ts

    • Contained only the textStyle css fragment
    • All consumers migrated
  • Removed src/app/content/components/utils/disablePrint.legacy.ts

    • Contained only the disablePrint css fragment
    • All consumers migrated

Updated Module Exports (2 files)

  • Typography/index.ts

    • Removed textStyle re-export
    • Module now only exports plain CSS components and constants
  • disablePrint.ts

    • Removed disablePrint re-export
    • Module now only exports disablePrintClass constant

Code Statistics

  • Files deleted: 2 (.legacy files)
  • Files modified: 6 (consumer migrations)
  • Net lines removed: ~58 lines

Verification

  • ✅ Zero .legacy.ts files remain in codebase
  • ✅ All textStyle usages replaced with direct color styling
  • ✅ All disablePrint usages replaced with inline CSS
  • ⏳ CI will verify TypeScript compilation passes
  • ⏳ CI will run full test suite (unit, browser, screenshot tests)

Merge Order

This PR must be merged after #3113 since it's based on the phase-7.4a-remove-legacy-files branch.

🤖 Generated with Claude Code

@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 16:48 Inactive
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 18:12 Inactive
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from dc99ad3 to a4956b0 Compare July 30, 2026 18:18
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 18:18 Inactive
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from a4956b0 to b155876 Compare July 30, 2026 18:24
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 18:24 Inactive

@RoyEJohnson RoyEJohnson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you migrate popUp/FiltersList.tsx away from using styled-components?

@RoyEJohnson RoyEJohnson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you migrate popUp/FiltersList.tsx off of styled-components?

@OpenStaxClaude

Copy link
Copy Markdown
Contributor Author

I've migrated FiltersList.tsx away from styled-components to plain CSS, addressing the code review feedback.

Changes Made

New File

  • FiltersList.css - Contains all component styles that were previously in styled-components

Modified File

  • FiltersList.tsx - Migrated from styled-components to plain CSS classes

Migration Details

All styled-components have been replaced with plain React components using CSS classes:

  • StyledPlainButton.filters-list-close-button
  • ItemLabel.filters-list-item-label
  • FilterListItem.filters-list-item
  • StatusDiv.filters-list-status
  • FiltersList.filters-list

The component now uses the same pattern as other migrated components in the codebase:

  • Plain React functional components with CSS classes
  • Empty styled() wrappers for backward compatibility with component selectors in Filters.tsx
  • All styles defined in separate .css file

Removed Imports

  • css from styled-components (no longer needed)
  • theme (colors are now hardcoded in CSS)
  • hiddenButAccessible (CSS directly in .filters-list-status class)

CI will verify TypeScript compilation and all tests pass.

🤖 Generated with Claude Code

@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 18:42 Inactive
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from ac0040f to b95bfe3 Compare July 30, 2026 18:56
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 18:56 Inactive
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from b95bfe3 to 1e4d51c Compare July 30, 2026 19:18
@RoyEJohnson
RoyEJohnson requested a review from Copilot July 30, 2026 19:18
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 19:18 Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 completes the Phase 7.4b migration by removing the last styled-components “legacy” CSS-fragment exports (textStyle, disablePrint) and updating remaining popup filter consumers to use plain CSS (including adding a dedicated FiltersList.css).

Changes:

  • Migrates FiltersList styling from styled-components fragments to a plain CSS file and class-based styling.
  • Removes deprecated legacy exports and deletes the final .legacy.ts files (Typography.legacy.ts, disablePrint.legacy.ts).
  • Updates Jest snapshots across multiple popup/filter consumers to reflect new class names and generated styled-component identifiers.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/app/content/studyGuides/components/snapshots/Filters.spec.tsx.snap Snapshot updates reflecting new FiltersList markup/classes and CSS output.
src/app/content/practiceQuestions/components/snapshots/PracticeQuestionsPopup.spec.tsx.snap Snapshot updates for updated print selector / styled-components identifiers.
src/app/content/practiceQuestions/components/snapshots/Filters.spec.tsx.snap Snapshot updates for updated print selector / styled-components identifiers.
src/app/content/highlights/components/SummaryPopup/snapshots/Filters.spec.tsx.snap Snapshot updates reflecting new FiltersList markup/classes and CSS output.
src/app/content/components/utils/disablePrint.ts Removes deprecated re-export; leaves only disablePrintClass.
src/app/content/components/utils/disablePrint.legacy.ts Deletes legacy styled-components disablePrint fragment.
src/app/content/components/Topbar/snapshots/index.spec.tsx.snap Snapshot updates due to CSS output changes.
src/app/content/components/popUp/FiltersList.tsx Refactors FiltersList to plain React + class-based styling, keeping a styled wrapper for selector compatibility.
src/app/content/components/popUp/FiltersList.css New CSS stylesheet for FiltersList classes (close button, labels, container, etc.).
src/app/content/components/popUp/Filters.tsx Replaces textStyle and disablePrint fragment usage with direct color and inline print media CSS.
src/app/content/components/popUp/ColorFilter.tsx Replaces textStyle usage with direct color styling.
src/app/content/components/popUp/ChapterFilter.tsx Replaces textStyle usage with direct color styling.
src/app/content/components/popUp/snapshots/Filters.spec.tsx.snap Snapshot updates reflecting new FiltersList markup/classes and CSS output.
src/app/content/components/snapshots/AssignedTopBar.spec.tsx.snap Snapshot updates due to CSS output changes.
src/app/content/snapshots/routes.spec.tsx.snap Snapshot updates due to CSS output changes.
src/app/components/Typography/Typography.legacy.ts Deletes legacy styled-components textStyle fragment.
src/app/components/Typography/index.ts Removes legacy textStyle re-export and related guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/content/components/popUp/FiltersList.tsx
Comment thread src/app/content/components/popUp/FiltersList.tsx
Comment thread src/app/content/components/popUp/Filters.tsx
RoyEJohnson

This comment was marked as resolved.

@OpenStaxClaude

This comment was marked as resolved.

@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 19:29 Inactive
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from 0be3667 to ce90d6a Compare July 30, 2026 19:48
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 19:48 Inactive
@RoyEJohnson
RoyEJohnson requested a review from Copilot July 30, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 17 out of 17 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/app/content/components/popUp/FiltersList.tsx:160

  • FiltersListBase always prepends the filters-list class, but at least one consumer already passes className="filters-list" (e.g. studyGuides/components/Filters.tsx), which results in duplicated class tokens like "filters-list … filters-list" in the DOM/snapshots. This is harmless but noisy and can complicate class-based selectors.
    <ul
      className={classNames('filters-list', className)}
      aria-live='polite'
      aria-atomic='true'

Base automatically changed from phase-7.4a-remove-legacy-files to main July 30, 2026 20:36
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from ce90d6a to a210a79 Compare July 30, 2026 20:36
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 20:37 Inactive
@RoyEJohnson
RoyEJohnson marked this pull request as ready for review July 30, 2026 20:37
@RoyEJohnson
RoyEJohnson requested a review from a team as a code owner July 30, 2026 20:37
@RoyEJohnson
RoyEJohnson self-requested a review July 30, 2026 20:37
OpenStaxClaude and others added 4 commits July 30, 2026 15:39
…final .legacy files

This PR completes the styled-components to plain CSS migration by migrating the remaining consumers of legacy styled-components exports and removing the final .legacy files.

## Migrated Files (6 files)

### PopUp Filter Components
- **ChapterFilter.tsx**: Replaced `textStyle` css fragment with direct `color: ${theme.color.text.default}`
- **ColorFilter.tsx**: Replaced `textStyle` css fragment with direct color styling
- **Filters.tsx**: Replaced `textStyle` and `disablePrint` with direct CSS
- **FiltersList.tsx**: Replaced `textStyle` and `disablePrint` with direct CSS

All filter components now use direct theme color references instead of styled-components css fragments.

### Typography Module
- **Typography/index.ts**: Removed `textStyle` legacy re-export
- **Removed Typography.legacy.ts**: Deleted legacy css fragment file

### DisablePrint Utility
- **disablePrint.ts**: Removed `disablePrint` legacy re-export
- **Removed disablePrint.legacy.ts**: Deleted legacy css fragment file

## Changes Summary
- 2 .legacy files deleted (Typography.legacy.ts, disablePrint.legacy.ts)
- 6 files updated to remove styled-components css fragment usage
- Replaced `textStyle` (color: ${theme.color.text.default}) with direct color styling
- Replaced `disablePrint` (@media print { display: none; }) with inline CSS

## Verification
- ✅ Zero .legacy.ts files remain in codebase
- ✅ All styled-components css fragments replaced with direct CSS
- ⏳ CI will verify TypeScript compilation
- ⏳ CI will run full test suite

This PR builds on #3113 (Phase 7.4a) and must be merged after 7.4a.

Related to: CORE-2285

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit addresses the code review feedback by migrating the FiltersList component from styled-components to plain CSS, following the same pattern used in earlier migration phases.

Changes:
- Created FiltersList.css with all component styles
- Replaced styled-components with plain React components using CSS classes
- Removed unused imports (css from styled-components, theme, hiddenButAccessible)
- Kept styled() wrappers for backward compatibility with component selectors in Filters.tsx
- All styles now use direct CSS classes instead of styled-components

Components migrated:
- StyledPlainButton → .filters-list-close-button
- ItemLabel → .filters-list-item-label
- FilterListItem → .filters-list-item
- StatusDiv → .filters-list-status
- FiltersList → .filters-list

The component maintains the same visual appearance and functionality while removing all styled-components CSS-in-JS usage except for the empty styled() wrappers needed for backward compatibility.

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

snaps

Use classNames

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ession

This commit addresses the three issues raised by GitHub Copilot:

1. **Fixed StyledPlainButtonBase className override** (Comment 2/3)
   - StyledPlainButtonBase now properly merges styled-components' generated className
   - Changed from overwriting className to using classNames('filters-list-close-button', className)
   - This preserves backward compatibility with component selectors

2. **Fixed Filters.tsx color regression** (Comment 1/3)
   - Restored the correct toggle text color to theme.color.primary.gray.base
   - The previous change incorrectly used theme.color.text.default
   - Original code had textStyle (text.default) overridden by gray.base - we were missing the override

3. **FiltersListBase className handling** (Comment 3/3)
   - The classNames('filters-list', className) pattern is correct and matches other migrated components
   - This ensures base styles are always applied while preserving styled-components className

All changes maintain visual consistency with the original implementation while supporting the migration to plain CSS.

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

snaps

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@RoyEJohnson
RoyEJohnson force-pushed the phase-7.4b-migrate-remaining-consumers branch from a210a79 to 545421f Compare July 30, 2026 20:40
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 20:40 Inactive
@TomWoodward
TomWoodward temporarily deployed to rex-web-phase-7-4b-migr-aiukrh July 30, 2026 20:53 Inactive
@RoyEJohnson
RoyEJohnson requested a review from jivey July 30, 2026 23:06
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.

5 participants