Skip to content

fix(ui): add sidebar dismiss controls and improve 1080p chat responsiveness - #143

Open
sumitahmed wants to merge 2 commits into
CaviraOSS:mainfrom
sumitahmed:sumitahmed/fix-responsive-sidebars
Open

fix(ui): add sidebar dismiss controls and improve 1080p chat responsiveness#143
sumitahmed wants to merge 2 commits into
CaviraOSS:mainfrom
sumitahmed:sumitahmed/fix-responsive-sidebars

Conversation

@sumitahmed

Copy link
Copy Markdown

📝 Description

This PR resolves two key UI/UX responsiveness and layout issues in the chat interface:

  1. Chat History Sidebar Dismissal:

    • Replaced direct DOM class manipulation with controlled React state.
    • Added an explicit close () button in the history drawer header.
    • Added a click-outside backdrop overlay and Escape key listener to dismiss the drawer.
    • Automatically closes the drawer when navigating to a selected chat from the list.
  2. 1080p & Scaled Screen Responsiveness:

    • On 1080p screens (and displays with 125%/150% scaling), the chat column was heavily cramped between the left dock and right topics sidebar.
    • Made the right-hand "Important Topics" sidebar collapsible, allowing the main chat canvas to expand to full width on demand. Added a floating reopen pill to restore it anytime.
    • Added min-w-0 to the CSS Grid chat column to prevent grid blowouts caused by wide code snippets and ASCII diagrams.
    • Enhanced markdown preformatted blocks with overflow-x-auto max-w-full for clean horizontal scrolling.

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📖 Documentation update
  • 🎨 Style/UI changes
  • ♻️ Code refactoring
  • ⚡ Performance improvements
  • 🧪 Test updates
  • 🏗️ Build/CI changes

🧪 Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Testing details:

  • Ran npm run build at root and in frontend/ (tsc -b --noEmit && vite build) — passes with 0 errors.
  • Verified sidebar dismissal via header close button, backdrop click, and Escape key.
  • Verified auto-closing of the history drawer when clicking any chat item.
  • Tested responsive layout across standard 1080p and scaled viewports (1280px–1536px), confirming topics collapse/reopen works smoothly.
  • Confirmed ASCII diagrams and code blocks scroll cleanly without blowing out grid column widths.

📷 Screenshots (if applicable)

1. Chat History Sidebar (Before vs. After)

Before (No close button, no backdrop, traps chat view):
before 1
before 2

After (Added header with close button '✕' & click-outside backdrop):
after 1
after 2

📋 Code Review Checklist

  • Code follows the project's coding standards
  • Self-review of the code has been performed
  • Code is properly commented, particularly in hard-to-understand areas
  • Changes generate no new warnings
  • Any dependent changes have been merged and published

🔗 Related Issues

None

🚀 Deployment Notes

None (pure frontend UI enhancement; no new dependencies introduced).

💬 Additional Context

While working on this, I noticed a few other UI/UX areas that could be polished (such as replacing raw emojis with consistent SVG icons and unifying typography styles across pages).

I kept this PR strictly focused on the sidebar toggle and responsiveness issues, but if the team is interested, I'd be happy to work on those in follow-up PRs!

Copilot AI lite review requested due to automatic review settings September 4, 2026 10:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are a couple of concrete issues in the updated Sidebar implementation (duplicate chat-list fetching and a likely invalid Tailwind class) that should be corrected before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves the chat UI’s usability and responsiveness by making both the chat history drawer and the “Important Topics” sidebar dismissible/collapsible, while also hardening the layout against wide markdown/code content on 1080p/scaled viewports.

Changes:

  • Added a collapsible “Important Topics” sidebar with a floating reopen control, and tightened the chat layout to better fit 1080p/scaled screens.
  • Improved markdown rendering/layout behavior for wide content (tables/code/long words) to reduce grid blowouts and enable cleaner horizontal scrolling.
  • Reworked the chat history drawer interaction to support explicit close controls, click-outside dismissal, and Escape-to-dismiss behavior.
File summaries
File Description
frontend/src/pages/Chat.tsx Adds topics sidebar collapse/reopen behavior and adjusts chat column sizing for better responsiveness.
frontend/src/components/Sidebar.tsx Implements dismiss controls for the chat history drawer (backdrop click + Esc + close button).
frontend/src/components/Chat/MarkdownView.tsx Updates markdown element styling to improve wrapping and horizontal overflow behavior.
frontend/src/components/Chat/FlashCards.tsx Adds an optional collapse control to the topics sidebar header and refines sidebar layout.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/src/components/Sidebar.tsx Outdated
Comment on lines +19 to +28
@@ -20,32 +20,103 @@
getChats().then(data => setChats(data));
}, []);

// Fetch updated list whenever the drawer is toggled open
useEffect(() => {
if (isToggled) {
getChats().then(data => setChats(data));
}
}, [isToggled]);
Comment on lines +48 to +50
<div
className="fixed inset-0 bg-black/40 backdrop-blur-xs z-30 transition-opacity"
onClick={() => setIsToggled(false)}

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The sidebar now fetches chats on open but can show a misleading empty state while loading (and lacks error handling), and the markdown container’s overflow-hidden can clip wide content and defeat the intended horizontal scrolling behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

frontend/src/components/Chat/MarkdownView.tsx:51

  • overflow-hidden on the Markdown container can clip wide content (e.g., wide KaTeX display equations or other non-code elements) and prevents the parent overflow-x-auto wrapper in Chat.tsx from providing horizontal scrolling for those cases. Prefer allowing overflow (or using overflow-x-auto) while keeping the element shrinkable with min-w-0.
    frontend/src/components/Sidebar.tsx:53
  • The id value idk is non-descriptive and can make future DOM/CSS debugging harder. Since this component no longer relies on DOM lookups, consider renaming it to a semantic id (or removing it entirely).

This issue also appears on line 100 of the same file.

frontend/src/components/Sidebar.tsx:100

  • The id value idk0 is non-descriptive and can make future DOM/CSS debugging harder. Consider renaming it to a semantic id (or removing it entirely).
          id='idk0'
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment on lines 20 to +24
useEffect(() => {
getChats().then(data => setChats(data));
}, []);
if (isToggled) {
getChats().then(data => setChats(data));
}
}, [isToggled]);
Comment on lines +81 to +96
<div className="flex-1 overflow-y-auto space-y-1">
{chats?.chats?.length ? (
chats.chats.map((chat) => (
<Link
key={chat.id}
to={`/chat/?chatId=${chat.id}`}
onClick={() => setIsToggled(false)}
className='p-2.5 hover:text-stone-100 hover:bg-stone-900/90 rounded-xl block text-sm truncate border border-transparent hover:border-stone-800 transition-colors'
>
{chat.title || 'Untitled Chat'}
</Link>
))
) : (
<p className="text-xs text-stone-500 text-center py-6">No previous chats</p>
)}
</div>
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.

2 participants