From c664eb8f284a085f14b596fd2bd1044f83af3759 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Thu, 1 Oct 2026 12:28:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=B1=20feat:=20Give=20the=20Mobile=20Dr?= =?UTF-8?q?awer=20One=20Place=20for=20Each=20Control=20(#16248)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(client): Give the mobile drawer one place for each control The drawer put its two global destinations in opposite corners and repeated one of them under every panel. The marketplace was a bare icon in the top strip, the hardest thing there to notice; new chat was a large footer button sitting under prompts, memories and MCP settings alike, none of which it has anything to do with; and the close toggle wore the chat header's bordered plate beside two flat icons, so the row read as one control and two afterthoughts. They swap. New chat takes the icon slot beside the panel switcher, which is where the drawer keeps what means the same thing whichever panel is showing, and its click behaviour moves with it into a component of its own rather than staying behind in the footer. The marketplace becomes a full-width entry above the panel content, labelled, in the list where someone already looks for somewhere to go, and outside the scroller so it stays put while the panels change under it. The toggle drops to `ghost` like its neighbours. The footer is left with search alone and stands down entirely on a panel that has nothing to search, rather than taking its padding out of the list above it. The drawer now carries a text colour beside its background. Only the panel nav set one, so the header strip, the new marketplace row and the footer all inherited black from the document and rendered near-invisible in dark mode, except where a control happened to name a token itself. That was hidden while the toggle wore `header-action`, which brought its own. * fix(client): Keep the mobile drawer clear of the home indicator and apart from its scrim The footer now renders a safe-area spacer when search is absent, so panel content no longer runs under the system gesture area on panels with nothing to search. The marketplace row uses the Button's `row` size instead of restyling it, which drops its new lint suppression. The scrim paints the theme's `bg-scrim` role (80% by default) on its own layer, which separates the drawer by 3:1 in both light palettes, and in dark mode the drawer draws a `border-xheavy` edge, since no scrim opacity separates two near-black surfaces. The scrim's focus ring is checked in the browser instead of by class name. * fix(client): Paint the mobile scrim's focus indicator above its fill The scrim's theme fill sits on its own layer, which painted over the button's inset focus ring, so a keyboard user focusing the scrim with the chat strip on saw almost none of it. The indicator now draws on a layer above the fill, in two tones: at the theme's 80% scrim a single dark ring reaches only 2.3:1 on the light palettes' mid-gray, so a surface band carries it in light and the focus ring in dark. The scenarios check, in all four palettes, that the topmost layer at the scrim's edge carries an indicator with a tone at 3:1 against the fill. * fix(client): Keep the mobile drawer close toggle on the header's control The drawer's close toggle is the chat header's open toggle flipping state, so it keeps the header-action surface and size it shares with that control rather than going flat like its new neighbours. (cherry picked from commit 0da898786c8e06967847d995e1dc6759d916aaeb) Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16248 --- .../components/Nav/AgentMarketplaceButton.tsx | 79 ++-- .../__tests__/AgentMarketplaceButton.spec.tsx | 67 +++ .../UnifiedSidebar/UnifiedSidebar.tsx | 19 +- .../__tests__/drawerPaint.spec.tsx | 1 + .../UnifiedSidebar/mobile/BottomBar.tsx | 84 +--- .../UnifiedSidebar/mobile/Header.tsx | 6 +- .../UnifiedSidebar/mobile/NewChat.tsx | 74 ++++ .../UnifiedSidebar/mobile/Scrim.tsx | 20 +- .../mobile/__tests__/BottomBar.spec.tsx | 119 ++---- .../mobile/__tests__/Header.spec.tsx | 67 +-- .../mobile/__tests__/NewChat.spec.tsx | 103 +++++ .../mobile/__tests__/Scrim.spec.tsx | 16 - .../scenarios/mobile-drawer-controls.spec.ts | 388 ++++++++++++++++++ eslint-suppressions.json | 5 +- 14 files changed, 811 insertions(+), 237 deletions(-) create mode 100644 client/src/components/Nav/__tests__/AgentMarketplaceButton.spec.tsx create mode 100644 client/src/components/UnifiedSidebar/mobile/NewChat.tsx create mode 100644 client/src/components/UnifiedSidebar/mobile/__tests__/NewChat.spec.tsx create mode 100644 e2e/specs/mock/scenarios/mobile-drawer-controls.spec.ts diff --git a/client/src/components/Nav/AgentMarketplaceButton.tsx b/client/src/components/Nav/AgentMarketplaceButton.tsx index a9416d7cba..7729cfbc0e 100644 --- a/client/src/components/Nav/AgentMarketplaceButton.tsx +++ b/client/src/components/Nav/AgentMarketplaceButton.tsx @@ -2,13 +2,22 @@ import { Link } from 'react-router-dom'; import { LayoutGrid } from 'lucide-react'; import { Button, TooltipAnchor } from '@librechat/client'; import { useLocalize, useShowMarketplace } from '~/hooks'; +import { cn } from '~/utils'; interface AgentMarketplaceButtonProps { /** Which way the tooltip opens: the desktop rail is a left edge, the mobile - * drawer header is a top edge. */ + * drawer header is a top edge. Ignored by the `row` layout, which has no + * tooltip to place. */ side?: 'right' | 'bottom'; /** Mobile dismisses the drawer on navigation; the desktop rail stays put. */ onNavigate?: () => void; + /** + * `icon` is the rail's square, labelled by a tooltip. `row` is a full-width + * entry carrying its own label, for the mobile drawer: an icon in a header + * strip is the easiest thing there to miss, and the list it now heads is + * where someone already looks for somewhere to go. + */ + layout?: 'icon' | 'row'; } /** Agent Marketplace entry in the sidebar. Self-gated on marketplace @@ -16,6 +25,7 @@ interface AgentMarketplaceButtonProps { export default function AgentMarketplaceButton({ side = 'right', onNavigate, + layout = 'icon', }: AgentMarketplaceButtonProps) { const localize = useLocalize(); const showAgentMarketplace = useShowMarketplace(); @@ -24,33 +34,46 @@ export default function AgentMarketplaceButton({ return null; } + const isRow = layout === 'row'; + + /** Composed through the shared button so the focus ring, hover fill and theme + * timing come from the primitive rather than being restated: a hand-rolled + * version of this had no focus ring at all. `asChild` keeps it a router Link, + * so modifier- and middle-clicks still open the marketplace in a new tab, and + * those stay on the current page and so must not dismiss. */ + const button = ( + + ); + + if (isRow) { + return button; + } + return ( - - { - if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey) { - return; - } - onNavigate?.(); - }} - > -