MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / renderPriceDetails

Method renderPriceDetails

internal/tui/views/pricing.go:1385–1416  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1383}
1384
1385func (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
1418func (v *PricingView) renderHelp() string {
1419 var text string

Callers 1

RenderMethod · 0.95

Calls 3

renderPriceTableMethod · 0.95
boxWithTitleFunction · 0.85
RenderMethod · 0.45

Tested by

no test coverage detected