on main help sign in
Merge pull request #210 from charmbracelet/charm-373
859e95aKujtim Hoxha
internal/tui/page/chat/chat.go+12−8
@@ -275,7 +275,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
275 return p, p.cancel()
275 return p, p.cancel()
276 }
276 }
277 case key.Matches(msg, p.keyMap.Details):
277 case key.Matches(msg, p.keyMap.Details):
278− p.showDetails()
278+ p.toggleDetails()
279 return p, nil
279 return p, nil
280 }
280 }
281
281
@@ -446,12 +446,9 @@ func (p *chatPage) setCompactMode(compact bool) {
446 }
446 }
447 p.compact = compact
447 p.compact = compact
448 if compact {
448 if compact {
449− p.compact = true
450 p.sidebar.SetCompactMode(true)
449 p.sidebar.SetCompactMode(true)
451 } else {
450 } else {
452− p.compact = false
451+ p.setShowDetails(false)
453− p.showingDetails = false
454− p.sidebar.SetCompactMode(false)
455 }
452 }
456}
453}
457
454
@@ -558,12 +555,19 @@ func (p *chatPage) cancel() tea.Cmd {
558 return cancelTimerCmd()
555 return cancelTimerCmd()
559}
556}
560
557
561−func (p *chatPage) showDetails() {
558+func (p *chatPage) setShowDetails(show bool) {
559+ p.showingDetails = show
560+ p.header.SetDetailsOpen(p.showingDetails)
561+ if !p.compact {
562+ p.sidebar.SetCompactMode(false)
563+ }
564+}
565+
566+func (p *chatPage) toggleDetails() {
562 if p.session.ID == "" || !p.compact {
567 if p.session.ID == "" || !p.compact {
563 return
568 return
564 }
569 }
565− p.showingDetails = !p.showingDetails
566− p.header.SetDetailsOpen(p.showingDetails)
570+ p.setShowDetails(!p.showingDetails)
567}
571}
568
572
569func (p *chatPage) sendMessage(text string, attachments []message.Attachment) tea.Cmd {
573func (p *chatPage) sendMessage(text string, attachments []message.Attachment) tea.Cmd {