Files
terminalShop-old/pkg/tui/breadcrumbs.go
marcusDenslow 6598f63cb2 refactor(tui): port to charm v2
bumped bubbletea, lipgloss, bubbles, wish, and huh to v2. Mostly
mechanical chur, new import paths, vewport getter/setter api, view()
returns tea.view now, huh.theme became an interface so the theme package
needed a small reshape. Render plumbing is gone (no more lipgloss.Render
field on the Model or MakeRenderer in main.go). All pages still work
over ssh. setting up for the refund composer next
2026-05-25 19:00:08 +02:00

55 lines
1.1 KiB
Go

package tui
import (
"charm.land/lipgloss/v2"
)
func (m Model) BuildBreadcrumbs() string {
// Only show breadcrumbs in cart view
if !m.inCartFlow() {
return ""
}
activeStyle := m.theme.TextAccent().Bold(true)
inactiveStyle := m.theme.TextDim()
sepStyle := m.theme.TextDim()
sep := sepStyle.Render(" / ")
// Checkout flow steps
var labels []string
if m.size < large {
labels = []string{"cart", "ship", "pay", "confirm"}
} else {
labels = []string{"cart", "shipping", "payment", "confirmation"}
}
// Get current checkout step from model
currentStep := m.checkoutStep()
var items []string
for i, label := range labels {
if i == currentStep {
items = append(items, activeStyle.Render(label))
} else {
items = append(items, inactiveStyle.Render(label))
}
// Add separator except after last item
if i < len(labels)-1 {
items = append(items, sep)
}
}
breadcrumbsContainer := lipgloss.NewStyle().
MarginBottom(1).
PaddingLeft(4)
result := ""
for _, item := range items {
result += item
}
return breadcrumbsContainer.Render(result)
}