Spaces:
Sleeping

axeronis commited on
Commit
68806fe
·
1 Parent(s): 2450a28

fix: chat back navigation, sidebar bottom padding, scroll lock CSS fixes

Browse files
frontend/app/chats/page.tsx CHANGED
@@ -69,6 +69,12 @@ function ChatsContent() {
69
  localStorage.setItem('last_lead_id', lead.id)
70
  }
71
 
 
 
 
 
 
 
72
  // Initial Selection from URL or LocalStorage or First Lead
73
  useEffect(() => {
74
  if (leads && leads.length > 0) {
@@ -80,9 +86,8 @@ function ChatsContent() {
80
 
81
  // If no valid target found (or ID invalid)
82
  if (!targetLead) {
83
- // On mobile/tablet, DO NOT auto-select the first lead. Show list instead.
84
- const isMobile = typeof window !== 'undefined' && window.innerWidth < 768
85
- if (isMobile) {
86
  return
87
  }
88
  targetLead = leads[0]
@@ -222,9 +227,8 @@ function ChatsContent() {
222
  onBack={() => {
223
  // Clear selection to return to list on mobile
224
  setSelectedLead(undefined)
225
- const params = new URLSearchParams(window.location.search)
226
- params.delete('leadId')
227
- router.replace(`?${params.toString()}`, { scroll: false })
228
  }}
229
  onToggleLeadsList={() => setIsLeadsListOpen(!isLeadsListOpen)}
230
  isLeadsListOpen={isLeadsListOpen}
 
69
  localStorage.setItem('last_lead_id', lead.id)
70
  }
71
 
72
+ // Track if mobile (client-side only)
73
+ const [isMobileView, setIsMobileView] = useState(false)
74
+ useEffect(() => {
75
+ setIsMobileView(window.innerWidth < 768)
76
+ }, [])
77
+
78
  // Initial Selection from URL or LocalStorage or First Lead
79
  useEffect(() => {
80
  if (leads && leads.length > 0) {
 
86
 
87
  // If no valid target found (or ID invalid)
88
  if (!targetLead) {
89
+ // On mobile, DO NOT auto-select the first lead. Show list instead.
90
+ if (isMobileView) {
 
91
  return
92
  }
93
  targetLead = leads[0]
 
227
  onBack={() => {
228
  // Clear selection to return to list on mobile
229
  setSelectedLead(undefined)
230
+ localStorage.removeItem('last_lead_id')
231
+ router.push('/chats')
 
232
  }}
233
  onToggleLeadsList={() => setIsLeadsListOpen(!isLeadsListOpen)}
234
  isLeadsListOpen={isLeadsListOpen}
frontend/app/globals.css CHANGED
@@ -680,4 +680,18 @@ input:-webkit-autofill:focus {
680
  .h-screen {
681
  height: 100dvh;
682
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  }
 
680
  .h-screen {
681
  height: 100dvh;
682
  }
683
+ }
684
+
685
+ /* Fix scroll lock when alternating between scrollable areas */
686
+ .overflow-y-auto,
687
+ .overflow-auto {
688
+ -webkit-overflow-scrolling: touch;
689
+ overscroll-behavior: contain;
690
+ }
691
+
692
+ /* Ensure touch events work properly on mobile nav */
693
+ nav,
694
+ aside,
695
+ .sidebar {
696
+ touch-action: pan-y;
697
  }
frontend/components/Sidebar.tsx CHANGED
@@ -146,7 +146,7 @@ export function Sidebar() {
146
  initial="hidden"
147
  animate="visible"
148
  variants={sidebarVariants}
149
- className="w-72 bg-md-surface-container-low flex flex-col relative shrink-0 h-screen sticky top-0"
150
  >
151
  {/* Logo Section */}
152
  <div className="p-6 relative z-50">
 
146
  initial="hidden"
147
  animate="visible"
148
  variants={sidebarVariants}
149
+ className="w-72 bg-md-surface-container-low flex flex-col relative shrink-0 h-screen sticky top-0 pb-20 md:pb-0"
150
  >
151
  {/* Logo Section */}
152
  <div className="p-6 relative z-50">