From 312d2d9f4ca8b22b7f40aaf19aaba9fb605baff1 Mon Sep 17 00:00:00 2001 From: Aravind Date: Mon, 10 Aug 2026 14:47:19 +0530 Subject: [PATCH] fix mobile screen responsive --- .../ai-assistant/AssistantPanel.jsx | 49 +++++++++++++++++++ src/layouts/Layout.jsx | 22 ++++++--- src/pages/Overview.jsx | 6 +-- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/components/ai-assistant/AssistantPanel.jsx b/src/components/ai-assistant/AssistantPanel.jsx index 8ea8584..f839a30 100644 --- a/src/components/ai-assistant/AssistantPanel.jsx +++ b/src/components/ai-assistant/AssistantPanel.jsx @@ -10,6 +10,16 @@ const EXPANDED_WIDTH = 620; const GUTTER = 24; /** Expanded must never dominate: the dashboard stays the primary experience. */ const MAX_VIEWPORT_SHARE = 0.42; +/** + * Below this width there is no room for a column *beside* the dashboard — a + * 380px track on a 375px phone collapses `main` to nothing — so the panel + * becomes a bottom sheet over the page instead of an inline column. + * + * Deliberately Tailwind's `md` (768px), not `lg`: tablets already lay the + * inline column out acceptably, so they keep the existing behaviour and only + * phones switch to the sheet. + */ +const OVERLAY_BREAKPOINT = 768; /** Tracks viewport width so the expanded panel can be clamped on smaller screens. */ function useViewportWidth() { @@ -58,6 +68,45 @@ export function AssistantPanel({ stickyClassName, panelHeightClassName }) { const trackWidth = panelWidth + GUTTER; const easing = [0.65, 0, 0.35, 1]; + // Phone/small-tablet: a sheet over the dashboard rather than a column beside + // it. Same assistant, same props — only the container differs. + if (viewportWidth < OVERLAY_BREAKPOINT) { + return ( + + {isOpen && context && ( + <> + + + + + + )} + + ); + } + return ( {isOpen && context && ( diff --git a/src/layouts/Layout.jsx b/src/layouts/Layout.jsx index 4b9f95f..712ad89 100644 --- a/src/layouts/Layout.jsx +++ b/src/layouts/Layout.jsx @@ -123,7 +123,7 @@ export default function Layout() {
{/* Header */}
-
+
{/* Brand */}