-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: UI Issues in Data Fetch Scroll, Text Area Overflow, and User Profile Navigation in notes tab #9919
base: develop
Are you sure you want to change the base?
Conversation
…in EncounterNotesTab
WalkthroughThe pull request introduces enhancements to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/pages/Encounters/tabs/EncounterNotesTab.tsx (2)
428-435
: Consider improving scroll behavior for better UXWhile the current implementation fixes the automatic scrolling issue, consider adding a "scroll to bottom" button that appears when new messages arrive and the user has scrolled up. This would give users more control over the scroll behavior.
useEffect(() => { if ( messagesData && !messagesLoading && !isFetchingNextPage && (messagesData.pages.length === 1 || scrollToBottom) ) { messagesEndRef.current?.scrollIntoView(); setScrollToBottom(false); } }, [selectedThread, messagesData, messagesLoading, isFetchingNextPage]); + +const [showScrollButton, setShowScrollButton] = useState(false); + +useEffect(() => { + const handleScroll = (e: Event) => { + const element = e.target as HTMLElement; + const isScrolledUp = element.scrollHeight - element.scrollTop > element.clientHeight + 100; + setShowScrollButton(isScrolledUp); + }; + + const scrollArea = document.querySelector('.scroll-area'); + scrollArea?.addEventListener('scroll', handleScroll); + return () => scrollArea?.removeEventListener('scroll', handleScroll); +}, []);
648-648
: Consider using a CSS variable for the max heightWhile the max-height constraint effectively prevents text area overflow, consider using a CSS variable for better maintainability and consistency across the application.
-className="max-h-[150px]" +className="max-h-[var(--textarea-max-height)]"Add this to your CSS:
:root { --textarea-max-height: 150px; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/Encounters/tabs/EncounterNotesTab.tsx
(10 hunks)
🔇 Additional comments (2)
src/pages/Encounters/tabs/EncounterNotesTab.tsx (2)
141-145
: LGTM: User profile navigation implementationThe implementation successfully addresses the unresponsive user avatar and username issue by adding click handlers that navigate to the user's profile page.
Also applies to: 163-166, 186-189
616-625
: LGTM: Loading indicator implementationThe new loading indicator provides clear feedback during data fetching without disrupting the scroll position, effectively addressing the loading skeleton issue mentioned in the PR objectives.
Proposed Changes
Fixes UI Issues in Data Fetch Scroll, Text Area Overflow, and User Profile Navigation #9918
Scroll Behavior on Data Fetch:
Loading...
appears without forcing the component to scroll to the bottom.Resizable Input Text Area Overflow:
Unresponsive User Avatar and Username:
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit