mirror of
https://github.com/marcusDenslow/terminalShop.git
synced 2026-10-25 18:08:45 +01:00
feat(tui): make tracking url clickable osc 8 hyperlink
This commit is contained in:
@@ -196,7 +196,7 @@ func (m Model) buildOrderDetailView(order models.Order, _ int) string {
|
||||
b.WriteString("\n")
|
||||
}
|
||||
if order.TrackingURL != "" {
|
||||
b.WriteString(dimStyle.Render(" " + order.TrackingURL))
|
||||
b.WriteString(hyperlink(dimStyle.Render(fmt.Sprintf(" View on %s ->", order.Carrier)), order.TrackingURL))
|
||||
b.WriteString("\n")
|
||||
}
|
||||
}
|
||||
@@ -248,3 +248,7 @@ func (m Model) displayStyle(k models.DisplayKind) lipgloss.Style {
|
||||
}
|
||||
return m.theme.TextHighlight()
|
||||
}
|
||||
|
||||
func hyperlink(label, url string) string {
|
||||
return fmt.Sprintf("\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\", url, label)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user