()
| 247 | } |
| 248 | |
| 249 | func (m configTabModel) renderContent() string { |
| 250 | var sb strings.Builder |
| 251 | |
| 252 | sb.WriteString(titleStyle.Render(T("config_title"))) |
| 253 | sb.WriteString("\n") |
| 254 | |
| 255 | if m.message != "" { |
| 256 | sb.WriteString(" " + m.message) |
| 257 | sb.WriteString("\n") |
| 258 | } |
| 259 | |
| 260 | sb.WriteString(helpStyle.Render(T("config_help1"))) |
| 261 | sb.WriteString("\n") |
| 262 | sb.WriteString(helpStyle.Render(T("config_help2"))) |
| 263 | sb.WriteString("\n\n") |
| 264 | |
| 265 | if m.err != nil { |
| 266 | sb.WriteString(errorStyle.Render(" ⚠ Error: " + m.err.Error())) |
| 267 | return sb.String() |
| 268 | } |
| 269 | |
| 270 | if len(m.fields) == 0 { |
| 271 | sb.WriteString(subtitleStyle.Render(T("no_config"))) |
| 272 | return sb.String() |
| 273 | } |
| 274 | |
| 275 | currentSection := "" |
| 276 | for i, f := range m.fields { |
| 277 | // Section headers |
| 278 | section := fieldSection(f.apiPath) |
| 279 | if section != currentSection { |
| 280 | currentSection = section |
| 281 | sb.WriteString("\n") |
| 282 | sb.WriteString(lipgloss.NewStyle().Bold(true).Foreground(colorHighlight).Render(" ── " + section + " ")) |
| 283 | sb.WriteString("\n") |
| 284 | } |
| 285 | |
| 286 | isSelected := i == m.cursor |
| 287 | prefix := " " |
| 288 | if isSelected { |
| 289 | prefix = "▸ " |
| 290 | } |
| 291 | |
| 292 | labelStr := lipgloss.NewStyle(). |
| 293 | Foreground(colorInfo). |
| 294 | Bold(isSelected). |
| 295 | Width(32). |
| 296 | Render(f.label) |
| 297 | |
| 298 | var valueStr string |
| 299 | if m.editing && isSelected { |
| 300 | valueStr = m.textInput.View() |
| 301 | } else { |
| 302 | switch f.kind { |
| 303 | case "bool": |
| 304 | if f.value == "true" { |
| 305 | valueStr = successStyle.Render("● ON") |
| 306 | } else { |
no test coverage detected