first commit after chaning git structure on pc
This commit is contained in:
55
pkg/tui/breadcrumbs.go
Normal file
55
pkg/tui/breadcrumbs.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
func (m Model) BuildBreadcrumbs() string {
|
||||
// Only show breadcrumbs in cart view
|
||||
if !m.ViewingCart {
|
||||
return ""
|
||||
}
|
||||
|
||||
activeStyle := lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#FFFFFF")).
|
||||
Bold(true)
|
||||
|
||||
inactiveStyle := lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#666666"))
|
||||
|
||||
sepStyle := lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#666666"))
|
||||
|
||||
sep := sepStyle.Render(" / ")
|
||||
|
||||
// Checkout flow steps
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user