Spaces:
Running

axeronis commited on
Commit
d9dfc5e
·
1 Parent(s): d1dbc46

feat: enable 2-column chat layout for tablets (md+ breakpoint)

Browse files
frontend/app/chats/page.tsx CHANGED
@@ -89,8 +89,8 @@ function ChatsContent() {
89
 
90
  // If no valid target found (or ID invalid)
91
  if (!targetLead && !selectedLead) {
92
- // On mobile, DO NOT auto-select the first lead. Show list instead.
93
- if (isMobileView) return
94
  targetLead = leads[0]
95
  }
96
 
@@ -235,10 +235,10 @@ function ChatsContent() {
235
  {/* Left Column: Leads List */}
236
  <div className={cn(
237
  "h-full border-r border-white/10 flex flex-col transition-all duration-300 z-10 bg-background shrink-0",
238
- // Desktop: Fixed width on large screens
239
- "lg:w-[320px] xl:w-[380px]",
240
- // Mobile: Full width if no lead selected, else hidden
241
- selectedLead ? "hidden lg:flex" : "w-full flex"
242
  )}>
243
  {/* List Container - Let LeadsList handle internal scrolling */}
244
  <div className="flex-1 min-h-0">
@@ -262,8 +262,8 @@ function ChatsContent() {
262
  <div className={cn(
263
  "flex-1 h-full flex flex-col relative z-10 bg-surface transition-all duration-300",
264
  // Mobile: Show only when lead selected
265
- // Desktop: Always show
266
- selectedLead ? "flex" : "hidden lg:flex"
267
  )}>
268
  {selectedLead ? (
269
  <ChatWindow
 
89
 
90
  // If no valid target found (or ID invalid)
91
  if (!targetLead && !selectedLead) {
92
+ // On small mobile, DO NOT auto-select the first lead. Show list instead.
93
+ if (window.innerWidth < 768) return
94
  targetLead = leads[0]
95
  }
96
 
 
235
  {/* Left Column: Leads List */}
236
  <div className={cn(
237
  "h-full border-r border-white/10 flex flex-col transition-all duration-300 z-10 bg-background shrink-0",
238
+ // Mobile/Tablet: Width starts from md (768px)
239
+ "md:w-[320px] xl:w-[380px]",
240
+ // Mobile: Full width if no lead selected, else hidden. Tablet/Desktop: Always show.
241
+ selectedLead ? "hidden md:flex" : "w-full flex"
242
  )}>
243
  {/* List Container - Let LeadsList handle internal scrolling */}
244
  <div className="flex-1 min-h-0">
 
262
  <div className={cn(
263
  "flex-1 h-full flex flex-col relative z-10 bg-surface transition-all duration-300",
264
  // Mobile: Show only when lead selected
265
+ // Tablet/Desktop: Always show
266
+ selectedLead ? "flex" : "hidden md:flex"
267
  )}>
268
  {selectedLead ? (
269
  <ChatWindow
frontend/components/ChatWindow/ChatHeader.tsx CHANGED
@@ -39,18 +39,18 @@ export function ChatHeader({
39
 
40
  {/* Left: Lead Info */}
41
  <div className="flex items-center gap-3 overflow-hidden">
42
- {/* Back Button (Mobile/Tablet only) */}
43
  <button
44
  onClick={onBack}
45
- className="lg:hidden p-2 -ml-2 text-slate-400 hover:text-white hover:bg-white/10 rounded-full transition-colors"
46
  >
47
  <ArrowLeft className="w-5 h-5" />
48
  </button>
49
 
50
- {/* Desktop Toggle */}
51
  <button
52
  onClick={onToggleLeadsList}
53
- className="hidden lg:flex p-2 -ml-2 text-slate-400 hover:text-indigo-400 hover:bg-white/5 rounded-lg transition-all"
54
  title={isLeadsListOpen ? "Скрыть список" : "Показать список"}
55
  >
56
  {isLeadsListOpen ? <ArrowLeft className="w-5 h-5" /> : <MoreVertical className="w-5 h-5 rotate-90" />}
@@ -141,10 +141,10 @@ export function ChatHeader({
141
  </button>
142
  </div>
143
 
144
- {/* AI Summary Button - Hidden on lg+ where ClientCard is visible */}
145
  <button
146
  onClick={onOpenMobileDrawer}
147
- className="lg:hidden p-2 text-slate-400 hover:text-indigo-400 hover:bg-white/5 rounded-lg transition-all"
148
  title="Посмотреть AI-анализ"
149
  >
150
  <Brain className="w-5 h-5" />
 
39
 
40
  {/* Left: Lead Info */}
41
  <div className="flex items-center gap-3 overflow-hidden">
42
+ {/* Back Button (Phone only) */}
43
  <button
44
  onClick={onBack}
45
+ className="md:hidden p-2 -ml-2 text-slate-400 hover:text-white hover:bg-white/10 rounded-full transition-colors"
46
  >
47
  <ArrowLeft className="w-5 h-5" />
48
  </button>
49
 
50
+ {/* Tablet/Desktop Toggle */}
51
  <button
52
  onClick={onToggleLeadsList}
53
+ className="hidden md:flex p-2 -ml-2 text-slate-400 hover:text-indigo-400 hover:bg-white/5 rounded-lg transition-all"
54
  title={isLeadsListOpen ? "Скрыть список" : "Показать список"}
55
  >
56
  {isLeadsListOpen ? <ArrowLeft className="w-5 h-5" /> : <MoreVertical className="w-5 h-5 rotate-90" />}
 
141
  </button>
142
  </div>
143
 
144
+ {/* AI Summary Button - Hidden on md+ where ClientCard is visible or layout is dual-col */}
145
  <button
146
  onClick={onOpenMobileDrawer}
147
+ className="md:hidden p-2 text-slate-400 hover:text-indigo-400 hover:bg-white/5 rounded-lg transition-all"
148
  title="Посмотреть AI-анализ"
149
  >
150
  <Brain className="w-5 h-5" />