From ec40dd00758925c97c3c5d5ccb0c2d77fd17fafc Mon Sep 17 00:00:00 2001 From: Thomas Petersen Date: Thu, 7 May 2026 15:51:52 -0400 Subject: [PATCH] fix(desktop): center header title when sidebar is collapsed Co-authored-by: Cursor --- desktop/src/features/chat/ui/ChatHeader.tsx | 75 ++++++++++++++------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/desktop/src/features/chat/ui/ChatHeader.tsx b/desktop/src/features/chat/ui/ChatHeader.tsx index 102569732c..7b3a3fc602 100644 --- a/desktop/src/features/chat/ui/ChatHeader.tsx +++ b/desktop/src/features/chat/ui/ChatHeader.tsx @@ -11,6 +11,8 @@ import { import type * as React from "react"; import type { ChannelType, ChannelVisibility } from "@/shared/api/types"; +import { cn } from "@/shared/lib/cn"; +import { useSidebar } from "@/shared/ui/sidebar"; type ChatHeaderProps = { actions?: React.ReactNode; @@ -72,36 +74,63 @@ export function ChatHeader({ statusBadge, }: ChatHeaderProps) { const trimmedDescription = description.trim(); + const { isMobile, state } = useSidebar(); + const centerTitle = state === "collapsed" && !isMobile; + const titleContent = ( +
+ +

+ {title} +

+ {statusBadge ? ( +
+ {statusBadge} +
+ ) : null} +
+ ); return (
-
-
- -

- {title} -

- {statusBadge ? ( -
- {statusBadge} -
- ) : null} -
-
+ {centerTitle ?
: null} - {actions ?
{actions}
: null} + {centerTitle ? ( + titleContent + ) : ( +
{titleContent}
+ )} + + {actions ? ( +
+ {actions} +
+ ) : centerTitle ? ( +
+ ) : null}
); }