| 1206 | } |
| 1207 | |
| 1208 | func (m *ircModel) viewChat() string { |
| 1209 | var header strings.Builder |
| 1210 | title := "Chat" |
| 1211 | if s, ok := m.servers[m.activeID]; ok { |
| 1212 | stat := "●" |
| 1213 | if !s.connected { |
| 1214 | stat = "○" |
| 1215 | } |
| 1216 | chanLabel := m.activeChan |
| 1217 | if chanLabel == "_sys" || chanLabel == "" { |
| 1218 | chanLabel = "(system)" |
| 1219 | } |
| 1220 | title = fmt.Sprintf("%s %s (%s) %s", stat, s.name, s.nick, chanLabel) |
| 1221 | } |
| 1222 | header.WriteString(stylePinkB.Render(title) + "\n") |
| 1223 | header.WriteString(titleStyle.Render("↑/↓ scroll · ←/→ panes") + "\n") |
| 1224 | |
| 1225 | div := stylePink.Render(strings.Repeat("─", m.chatVP.Width)) |
| 1226 | |
| 1227 | return lipgloss.JoinVertical( |
| 1228 | lipgloss.Left, |
| 1229 | header.String()+m.chatVP.View(), |
| 1230 | div, |
| 1231 | m.chatInput.View(), |
| 1232 | ) |
| 1233 | } |
| 1234 | |
| 1235 | func contains(sl []string, s string) bool { |
| 1236 | for _, v := range sl { |