refactor(web): split member.tsx into hooks and components - #78
Open
naasanov wants to merge 1 commit into
Open
Conversation
member.tsx had grown to 1235 lines holding the chat, the composer, patient controls, referrals and checklists. Split it along the boundaries main already established with ChecklistWidget/useChecklists/CollapsibleSection: hooks own the Firestore subscriptions, components own their own UI and handlers. useChat.ts message state, live listener, pagination, read receipts usePatientProfile.ts patient doc subscription, current user, social workers ChatPanel.tsx chat column MessageBubble.tsx one message + chunk grouping ChatComposer.tsx textarea, image picker, send PatientControls.tsx assignment / status / verify-deny format_datetime.ts shared message timestamp + person name formatters member.tsx is now a 156-line layout shell. Strictly behavior-preserving: no bug fixes and no cleanups. In particular the live-listener bug that discards older paginated pages moves across unchanged, with a comment pointing at #77 — fixing it here would have made this diff unreviewable. The ad-hoc date formatters in _index.tsx and calendar.tsx were left alone rather than folded into format_datetime.ts; their output differs (year vs no year, time vs no time), so unifying them would change what renders. Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Prep work for the chat transcript export (#73). Pure refactor — no behavior changes, so the transcript PR stacked on top stays reviewable.
member.tsxhad reached 1235 lines holding the chat, the composer, patient controls, referrals and checklists. This splits it along the boundariesmainalready established withChecklistWidget/useChecklists/CollapsibleSection: hooks own the Firestore subscriptions, components own their own UI and handlers.hooks/useChat.tshooks/usePatientProfile.tscomponents/ChatPanel.tsxcomponents/MessageBubble.tsxcomponents/ChatComposer.tsxcomponents/PatientControls.tsxutils/format_datetime.tsmember.tsxends as a 156-line layout shell.Deliberately not done here
The live-listener bug is carried across unchanged. The
onSnapshothandler replaces the whole message list with only the newest page, discarding older pages loaded byloadOlderMessages. It's filed as #77 with a comment pointing at it from the new code. Fixing it inside a 1000-line move would have made this diff impossible to review — and #77 needs human confirmation of the repro first.The ad-hoc date formatters in
_index.tsxandcalendar.tsxwere left alone. They looked like duplicates offormatMessageDateTimebut aren't: one renders date-only with a year, another a full weekday with no time, the third date+time with no year. Unifying them would have changed what renders in three places.Verification
npm run typecheck,npm run lint,npm run buildall clean.Behavior preservation was checked mechanically as well as by hand: every one of the 129 string literals in the original
member.tsxstill appears somewhere in the new file set.