History

Prevent ChatView header overflow with long thread titles

- add `min-w-0` to ChatView container wrappers to allow proper flex shrinking - make thread title truncatable with `truncate` and `title` tooltip - keep action controls fixed-width with `shrink-0` to preserve header layout

Julius Marminge committed 9 months ago

Commit 7a5dd621 parent f64c26e1 file · +7 −5Browse files

Unified · Split

apps/web/src/components/ChatView.tsx+7−5
@@ -969,7 +969,7 @@ export default function ChatView() { · 968 unmodified lines
969 // Empty state: no active thread969 // Empty state: no active thread
970 if (!activeThread) {970 if (!activeThread) {
971 return (971 return (
972 <div className="flex min-h-0 flex-1 flex-col bg-background text-muted-foreground/40">972 <div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-muted-foreground/40">
973 {isElectron && (973 {isElectron && (
974 <div className="drag-region flex h-[52px] shrink-0 items-center border-b border-border px-5">974 <div className="drag-region flex h-[52px] shrink-0 items-center border-b border-border px-5">
975 <span className="text-xs text-muted-foreground/50">No active thread</span>975 <span className="text-xs text-muted-foreground/50">No active thread</span>
@@ -985,7 +985,7 @@ export default function ChatView() { · 9 unmodified lines
985 }985 }
986 986
987 return (987 return (
988 <div className="flex min-h-0 flex-1 flex-col bg-background">988 <div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background">
989 {/* Top bar */}989 {/* Top bar */}
990 <header990 <header
991 className={`flex items-center justify-between border-b border-border px-5 ${isElectron ? "drag-region h-[52px]" : "py-3"}`}991 className={`flex items-center justify-between border-b border-border px-5 ${isElectron ? "drag-region h-[52px]" : "py-3"}`}
@@ -1304,11 +1304,13 @@ const ChatHeader = memo(function ChatHeader({ · 312 unmodified lines
1304}: ChatHeaderProps) {1304}: ChatHeaderProps) {
1305 return (1305 return (
1306 <>1306 <>
1307 <div className="flex items-center gap-3">1307 <div className="flex min-w-0 flex-1 items-center gap-3">
1308 <h2 className="text-sm font-medium text-foreground">{activeThreadTitle}</h2>1308 <h2 className="truncate text-sm font-medium text-foreground" title={activeThreadTitle}>
1309 {activeThreadTitle}
1310 </h2>
1309 {activeProjectName && <Badge variant="outline">{activeProjectName}</Badge>}1311 {activeProjectName && <Badge variant="outline">{activeProjectName}</Badge>}
1310 </div>1312 </div>
1311 <div className="flex items-center gap-3">1313 <div className="shrink-0 flex items-center gap-3">
1312 {activeProjectName && <OpenInPicker keybindings={keybindings} />}1314 {activeProjectName && <OpenInPicker keybindings={keybindings} />}
1313 {activeProjectName && <GitActionsControl api={api} gitCwd={gitCwd} />}1315 {activeProjectName && <GitActionsControl api={api} gitCwd={gitCwd} />}
1314 <Button1316 <Button