chore(angular-react): Migrate ContactDetailComponent to React#13
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
chore(angular-react): Migrate ContactDetailComponent to React#13devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
feat: port logic from Angular to React feat: translate template to JSX feat: wire up inputs, events, and dependencies Migrates ContactDetailComponent from Angular to React: - ContactService.getContact → getContact prop - ActivatedRoute params → contactId prop - MatDialog.open → onOpenFeedDialog callback prop - ngOnInit loadContact → useEffect with cleanup - *ngIf loading/contact/null states → conditional JSX returns - mat-card → div card with inline styles - phoneNumber pipe → formatPhoneNumber utility (TODO) - routerLink → onNavigateBack callback - setTimeout for dialog preserved as-is Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Buttons (back and feed) are now rendered whenever loading is complete, matching the Angular original's *ngIf='!isLoading' behavior. Previously they were only visible when a contact was found. Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a React functional component (
ContactDetailComponent.tsx) as a 1:1 port of the existing AngularContactDetailComponent. The original Angular component is not removed. This is an additive-only change — no existing files are modified.Migration mapping:
ActivatedRoute.params['id']contactIdpropContactService.getContact()getContactcallback propMatDialog.open()onOpenFeedDialogcallback proprouter.navigatebackonNavigateBackcallback propngOnInit+loadContact()useEffectwith cancellation flagmat-card/ Material layoutphoneNumberpipeformatPhoneNumber(TODO)Updates since last revision
!isLoading, matching the Angular template's*ngIf="!isLoading"which wraps the buttons independently of whether a contact was found. Previously the buttons were only rendered inside the contact-found branch, making them disappear when the contact was null.Review & Testing Checklist for Human
react/react-domin itspackage.jsonand no TSX support intsconfig.json. The file will not compile as-is. Decide whether to add React as a dependency or treat this as a reference artifact.formatPhoneNumberis a no-op stub (line 27-29) — it returns the raw string unchanged. The Angular version used aphoneNumberpipe. Verify this placeholder is acceptable or add a real formatter.getContactinuseEffectdeps (line 76) — if the parent doesn't wrapgetContactinuseCallback, the effect will re-fire on every render, causing infinite fetch loops.setTimeoutbefore opening dialog (line 84-86) — this was carried over from the Angular source. Confirm this delay is intentional and not an Angular-specific workaround that can be dropped in React.Suggested test plan: Add
reactandreact-domas dev dependencies, then render<ContactDetailComponent>in a test harness with a mockgetContactthat resolves, rejects, and returnsnull. Verify the three states (loading → contact card, loading → not found, loading → error) render correctly, and confirm the back/feed buttons are visible in both the found and not-found states.Notes
cancelledflag inuseEffectprevents stale state updates on unmount (replacing Angular's subscription cleanup).Link to Devin session: https://app.devin.ai/sessions/885a7571c31c498d8aeb31891081a88e
Requested by: @lburgers