()
| 1383 | } |
| 1384 | |
| 1385 | func (v *PricingView) renderPriceDetails() string { |
| 1386 | emptyTitle := lipgloss.NewStyle().Foreground(colorDarkGray).Render("Price Details") |
| 1387 | if v.Selected >= len(v.FilteredItems) { |
| 1388 | return boxWithTitle(emptyTitle, |
| 1389 | lipgloss.NewStyle().Foreground(colorDarkGray).Italic(true).Render("Select a result to see pricing details"), |
| 1390 | colorDarkGray, v.Width) |
| 1391 | } |
| 1392 | item := v.FilteredItems[v.Selected] |
| 1393 | if len(item.Prices) == 0 { |
| 1394 | return boxWithTitle(emptyTitle, |
| 1395 | lipgloss.NewStyle().Foreground(colorDarkGray).Render("No price details available"), |
| 1396 | colorDarkGray, v.Width) |
| 1397 | } |
| 1398 | |
| 1399 | titleText := fmt.Sprintf("> Price Details – %s / %s (%d models)", item.Region, item.Product, len(item.Prices)) |
| 1400 | styledTitle := lipgloss.NewStyle().Foreground(colorCyan).Render(titleText) |
| 1401 | |
| 1402 | if len(item.Prices) <= pricingSplitThreshold { |
| 1403 | return boxWithTitle(styledTitle, v.renderPriceTable(item.Prices), colorCyan, v.Width) |
| 1404 | } |
| 1405 | |
| 1406 | mid := (len(item.Prices) + 1) / 2 |
| 1407 | leftContent := v.renderPriceTable(item.Prices[:mid]) |
| 1408 | rightContent := v.renderPriceTable(item.Prices[mid:]) |
| 1409 | |
| 1410 | halfW := (v.Width - 4) / 2 |
| 1411 | contTitle := lipgloss.NewStyle().Foreground(colorDarkGray).Render("(cont.)") |
| 1412 | leftPanel := boxWithTitle(styledTitle, leftContent, colorCyan, halfW+2) |
| 1413 | rightPanel := boxWithTitle(contTitle, rightContent, colorDarkGray, v.Width-halfW-2) |
| 1414 | |
| 1415 | return lipgloss.JoinHorizontal(lipgloss.Top, leftPanel, rightPanel) |
| 1416 | } |
| 1417 | |
| 1418 | func (v *PricingView) renderHelp() string { |
| 1419 | var text string |
no test coverage detected