(f map[string]any)
| 252 | } |
| 253 | |
| 254 | func (m authTabModel) renderDetail(f map[string]any) string { |
| 255 | var sb strings.Builder |
| 256 | |
| 257 | labelStyle := lipgloss.NewStyle(). |
| 258 | Foreground(lipgloss.Color("111")). |
| 259 | Bold(true) |
| 260 | valueStyle := lipgloss.NewStyle(). |
| 261 | Foreground(lipgloss.Color("252")) |
| 262 | editableMarker := lipgloss.NewStyle(). |
| 263 | Foreground(lipgloss.Color("214")). |
| 264 | Render(" ✎") |
| 265 | |
| 266 | sb.WriteString(" ┌─────────────────────────────────────────────\n") |
| 267 | |
| 268 | fields := []struct { |
| 269 | label string |
| 270 | key string |
| 271 | editable bool |
| 272 | }{ |
| 273 | {"Name", "name", false}, |
| 274 | {"Channel", "channel", false}, |
| 275 | {"Email", "email", false}, |
| 276 | {"Status", "status", false}, |
| 277 | {"Status Msg", "status_message", false}, |
| 278 | {"File Name", "file_name", false}, |
| 279 | {"Auth Type", "auth_type", false}, |
| 280 | {"Prefix", "prefix", true}, |
| 281 | {"Proxy URL", "proxy_url", true}, |
| 282 | {"Priority", "priority", true}, |
| 283 | {"Project ID", "project_id", false}, |
| 284 | {"Disabled", "disabled", false}, |
| 285 | {"Created", "created_at", false}, |
| 286 | {"Updated", "updated_at", false}, |
| 287 | } |
| 288 | |
| 289 | for _, field := range fields { |
| 290 | val := getAnyString(f, field.key) |
| 291 | if val == "" || val == "<nil>" { |
| 292 | if field.editable { |
| 293 | val = T("not_set") |
| 294 | } else { |
| 295 | continue |
| 296 | } |
| 297 | } |
| 298 | editMark := "" |
| 299 | if field.editable { |
| 300 | editMark = editableMarker |
| 301 | } |
| 302 | line := fmt.Sprintf(" │ %s %s%s", |
| 303 | labelStyle.Render(fmt.Sprintf("%-12s:", field.label)), |
| 304 | valueStyle.Render(val), |
| 305 | editMark) |
| 306 | sb.WriteString(line) |
| 307 | sb.WriteString("\n") |
| 308 | } |
| 309 | |
| 310 | sb.WriteString(" └─────────────────────────────────────────────\n") |
| 311 | return sb.String() |
no test coverage detected