refactor(thumbnail-card): migrate ThumbnailCard from Flow to TypeScript - #4762
Conversation
WalkthroughAdded TypeScript implementations for ChangesThumbnailCard composition
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/thumbnail-card/ThumbnailCard.tsx (1)
18-19: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winUse keyboard-event handler types for
onKeyDown.This
onKeyDownis registered on the title<div>, but the prop is typed as() => void. Change every thumbnail-card onKeyDown declaration to the keyboard-event handler type for theHTMLDivElementso callers can accessevent.key,preventDefault(), and propagation methods.
- TypeScript files:
React.KeyboardEventHandler<HTMLDivElement>- Flow files: import
SyntheticKeyboardEvent<HTMLDivElement>fromreactand use that type.</verification Result>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/thumbnail-card/ThumbnailCard.tsx` around lines 18 - 19, Update every thumbnail-card onKeyDown declaration to use the appropriate keyboard event handler type: use React.KeyboardEventHandler<HTMLDivElement> in ThumbnailCard.tsx and both ThumbnailCardDetails.tsx declarations, and import and use SyntheticKeyboardEvent<HTMLDivElement> in ThumbnailCard.js.flow and both ThumbnailCardDetails.js.flow declarations. Ensure handlers receive the keyboard event while preserving existing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/components/thumbnail-card/ThumbnailCard.tsx`:
- Around line 18-19: Update every thumbnail-card onKeyDown declaration to use
the appropriate keyboard event handler type: use
React.KeyboardEventHandler<HTMLDivElement> in ThumbnailCard.tsx and both
ThumbnailCardDetails.tsx declarations, and import and use
SyntheticKeyboardEvent<HTMLDivElement> in ThumbnailCard.js.flow and both
ThumbnailCardDetails.js.flow declarations. Ensure handlers receive the keyboard
event while preserving existing behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fa248e1d-5fc2-4e51-9a25-7f86cdc41114
⛔ Files ignored due to path filters (2)
src/components/thumbnail-card/__tests__/__snapshots__/ThumbnailCard.test.tsx.snapis excluded by!**/*.snapsrc/components/thumbnail-card/__tests__/__snapshots__/ThumbnailCardThumbnail.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (12)
src/components/thumbnail-card/ThumbnailCard.js.flowsrc/components/thumbnail-card/ThumbnailCard.stories.tsxsrc/components/thumbnail-card/ThumbnailCard.tsxsrc/components/thumbnail-card/ThumbnailCardDetails.js.flowsrc/components/thumbnail-card/ThumbnailCardDetails.tsxsrc/components/thumbnail-card/ThumbnailCardThumbnail.js.flowsrc/components/thumbnail-card/ThumbnailCardThumbnail.tsxsrc/components/thumbnail-card/__tests__/ThumbnailCard.test.tsxsrc/components/thumbnail-card/__tests__/ThumbnailCardDetails.test.tsxsrc/components/thumbnail-card/__tests__/ThumbnailCardThumbnail.test.tsxsrc/components/thumbnail-card/index.js.flowsrc/components/thumbnail-card/index.ts
💤 Files with no reviewable changes (2)
- src/components/thumbnail-card/ThumbnailCard.stories.tsx
- src/components/thumbnail-card/tests/ThumbnailCardDetails.test.tsx
a06d9b1 to
527e04c
Compare
Merge Queue Status
This pull request spent 12 minutes 14 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks Failing checks: HintYou may have to fix your CI before adding the pull request to the queue again. Requeued — the merge queue status continues in this comment ↓. |
8fdb286 to
97e8fc8
Compare
97e8fc8 to
38e7e9b
Compare
Merge Queue Status
This pull request spent 28 seconds in the queue, including 5 seconds running CI. Required conditions to merge
|
Convert ThumbnailCard component to TypeScript
This PR converts
src/components/thumbnail-cardfrom JavaScript with Flow to TypeScript.Changes
ThumbnailCard.js,ThumbnailCardDetails.js, andThumbnailCardThumbnail.jsto.tsxwith exportedThumbnailCardProps,ThumbnailCardDetailsProps, andThumbnailCardThumbnailPropsinterfacesindex.jstoindex.ts, re-exporting the component andThumbnailCardPropsThumbnailCard.stories.jstoThumbnailCard.stories.tsx__tests__/*.test.jsto*.test.tsx.js.flowfiles for backward compatibilityTesting
src/components/thumbnail-card; all 13 pass with snapshots matching previous outputyarn lint:tsandflow checkpassComponents/ThumbnailCard) that behavior is unchangedSummary by CodeRabbit
New Features
Refactor