on main help sign in
fix(tui): chat: fix compact mode details toggle
806d21eAyman Bagabas
internal/tui/page/chat/chat.go+12−8
@@ -273,7 +273,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
273 return p, p.cancel()
273 return p, p.cancel()
274 }
274 }
275 case key.Matches(msg, p.keyMap.Details):
275 case key.Matches(msg, p.keyMap.Details):
276− p.showDetails()
276+ p.toggleDetails()
277 return p, nil
277 return p, nil
278 }
278 }
279
279
@@ -415,12 +415,9 @@ func (p *chatPage) setCompactMode(compact bool) {
415 }
415 }
416 p.compact = compact
416 p.compact = compact
417 if compact {
417 if compact {
418− p.compact = true
419 p.sidebar.SetCompactMode(true)
418 p.sidebar.SetCompactMode(true)
420 } else {
419 } else {
421− p.compact = false
420+ p.setShowDetails(false)
422− p.showingDetails = false
423− p.sidebar.SetCompactMode(false)
424 }
421 }
425}
422}
426
423
@@ -525,12 +522,19 @@ func (p *chatPage) cancel() tea.Cmd {
525 return cancelTimerCmd()
522 return cancelTimerCmd()
526}
523}
527
524
528−func (p *chatPage) showDetails() {
525+func (p *chatPage) setShowDetails(show bool) {
526+ p.showingDetails = show
527+ p.header.SetDetailsOpen(p.showingDetails)
528+ if !p.compact {
529+ p.sidebar.SetCompactMode(false)
530+ }
531+}
532+
533+func (p *chatPage) toggleDetails() {
529 if p.session.ID == "" || !p.compact {
534 if p.session.ID == "" || !p.compact {
530 return
535 return
531 }
536 }
532− p.showingDetails = !p.showingDetails
533− p.header.SetDetailsOpen(p.showingDetails)
537+ p.setShowDetails(!p.showingDetails)
534}
538}
535
539
536func (p *chatPage) sendMessage(text string, attachments []message.Attachment) tea.Cmd {
540func (p *chatPage) sendMessage(text string, attachments []message.Attachment) tea.Cmd {