fix: address Copilot review feedback
- Remove unused label parameter from RenderStatusBadge function - Fix IconContainer Unicode escape sequence (U+F489) - Fix IconNetwork Unicode escape sequence (U+F06F3) - Use rune-based truncation for attachment names with Unicode icons
- commit
- 6e3bc4eac18d642578037348ecad0acb82136748
- author
- brice · · 2026-01-17 14:36 UTC
- parent
- 547b44c
- signature
- unsigned
3 files · +11 -8
M internal/adapters/in/cli/routes.go +4 -2
| @@ -172,8 +172,10 @@ func runRoutesListRemote(ctx context.Context, client *remote.Client) error { | |||
| 172 | 172 | for _, attachment := range route.Attachments { | |
| 173 | 173 | // Use container icon with indent for attachment tree display | |
| 174 | 174 | attachmentName := " " + styles.IconContainer + " " + attachment.Name | |
| 175 | - | if len(attachmentName) > 25 { | |
| 176 | - | attachmentName = attachmentName[:22] + "..." | |
| 175 | + | // Use rune count for proper Unicode handling (icons are multi-byte) | |
| 176 | + | runes := []rune(attachmentName) | |
| 177 | + | if len(runes) > 25 { | |
| 178 | + | attachmentName = string(runes[:22]) + "..." | |
| 177 | 179 | } | |
| 178 | 180 | attachmentStatus := components.ContainerStatusBadge(attachment.Status) | |
| 179 | 181 | attachmentImage := truncateImage(attachment.Image, imageColWidth) | |
| @@ -172,8 +172,10 @@ func runRoutesListRemote(ctx context.Context, client *remote.Client) error { | |||||
| 172 | for _, attachment := range route.Attachments { | 172 | for _, attachment := range route.Attachments { | ||
| 173 | // Use container icon with indent for attachment tree display | 173 | // Use container icon with indent for attachment tree display | ||
| 174 | attachmentName := " " + styles.IconContainer + " " + attachment.Name | 174 | attachmentName := " " + styles.IconContainer + " " + attachment.Name | ||
| 175 | - | if len(attachmentName) > 25 { | 175 | + | // Use rune count for proper Unicode handling (icons are multi-byte) |
| 176 | - | attachmentName = attachmentName[:22] + "..." | 176 | + | runes := []rune(attachmentName) |
| 177 | + | if len(runes) > 25 { | |||
| 178 | + | attachmentName = string(runes[:22]) + "..." | |||
| 177 | } | 179 | } | ||
| 178 | attachmentStatus := components.ContainerStatusBadge(attachment.Status) | 180 | attachmentStatus := components.ContainerStatusBadge(attachment.Status) | ||
| 179 | attachmentImage := truncateImage(attachment.Image, imageColWidth) | 181 | attachmentImage := truncateImage(attachment.Image, imageColWidth) | ||
M internal/adapters/in/cli/ui/components/status.go +5 -4
| @@ -92,8 +92,9 @@ func RenderStatus(status Status, label string) string { | |||
| 92 | 92 | return config.Style.Render(config.Icon + " " + label) | |
| 93 | 93 | } | |
| 94 | 94 | ||
| 95 | - | // RenderStatusBadge renders a status as a badge with background and icon. | |
| 96 | - | func RenderStatusBadge(status Status, _ string) string { | |
| 95 | + | // RenderStatusBadge renders a status as a compact icon badge with background. | |
| 96 | + | // It displays only the icon (no label) for minimal width in table columns. | |
| 97 | + | func RenderStatusBadge(status Status) string { | |
| 97 | 98 | config := DefaultStatusConfigs[status] | |
| 98 | 99 | var badgeStyle lipgloss.Style | |
| 99 | 100 | switch status { | |
| @@ -171,7 +172,7 @@ func NewStatusBadge(status Status, label string) StatusIndicator { | |||
| 171 | 172 | // View renders the status indicator. | |
| 172 | 173 | func (s StatusIndicator) View() string { | |
| 173 | 174 | if s.Badge { | |
| 174 | - | return RenderStatusBadge(s.Status, s.Label) | |
| 175 | + | return RenderStatusBadge(s.Status) | |
| 175 | 176 | } | |
| 176 | 177 | return RenderStatus(s.Status, s.Label) | |
| 177 | 178 | } | |
| @@ -185,5 +186,5 @@ func ContainerStatusIndicator(status string) string { | |||
| 185 | 186 | // ContainerStatusBadge renders container status as a badge. | |
| 186 | 187 | func ContainerStatusBadge(status string) string { | |
| 187 | 188 | parsed := ParseStatus(status) | |
| 188 | - | return RenderStatusBadge(parsed, status) | |
| 189 | + | return RenderStatusBadge(parsed) | |
| 189 | 190 | } | |
| @@ -92,8 +92,9 @@ func RenderStatus(status Status, label string) string { | |||||
| 92 | return config.Style.Render(config.Icon + " " + label) | 92 | return config.Style.Render(config.Icon + " " + label) | ||
| 93 | } | 93 | } | ||
| 94 | 94 | ||||
| 95 | - | // RenderStatusBadge renders a status as a badge with background and icon. | 95 | + | // RenderStatusBadge renders a status as a compact icon badge with background. |
| 96 | - | func RenderStatusBadge(status Status, _ string) string { | 96 | + | // It displays only the icon (no label) for minimal width in table columns. |
| 97 | + | func RenderStatusBadge(status Status) string { | |||
| 97 | config := DefaultStatusConfigs[status] | 98 | config := DefaultStatusConfigs[status] | ||
| 98 | var badgeStyle lipgloss.Style | 99 | var badgeStyle lipgloss.Style | ||
| 99 | switch status { | 100 | switch status { | ||
| @@ -171,7 +172,7 @@ func NewStatusBadge(status Status, label string) StatusIndicator { | |||||
| 171 | // View renders the status indicator. | 172 | // View renders the status indicator. | ||
| 172 | func (s StatusIndicator) View() string { | 173 | func (s StatusIndicator) View() string { | ||
| 173 | if s.Badge { | 174 | if s.Badge { | ||
| 174 | - | return RenderStatusBadge(s.Status, s.Label) | 175 | + | return RenderStatusBadge(s.Status) |
| 175 | } | 176 | } | ||
| 176 | return RenderStatus(s.Status, s.Label) | 177 | return RenderStatus(s.Status, s.Label) | ||
| 177 | } | 178 | } | ||
| @@ -185,5 +186,5 @@ func ContainerStatusIndicator(status string) string { | |||||
| 185 | // ContainerStatusBadge renders container status as a badge. | 186 | // ContainerStatusBadge renders container status as a badge. | ||
| 186 | func ContainerStatusBadge(status string) string { | 187 | func ContainerStatusBadge(status string) string { | ||
| 187 | parsed := ParseStatus(status) | 188 | parsed := ParseStatus(status) | ||
| 188 | - | return RenderStatusBadge(parsed, status) | 189 | + | return RenderStatusBadge(parsed) |
| 189 | } | 190 | } | ||
M internal/adapters/in/cli/ui/styles/icons.go +2 -2
| @@ -24,9 +24,9 @@ const ( | |||
| 24 | 24 | IconRoute = "\uf0e8" // nf-fa-sitemap | |
| 25 | 25 | IconSecret = "\uf023" // nf-fa-lock | |
| 26 | 26 | IconToken = "\uf084" // nf-fa-key | |
| 27 | - | IconContainer = "\uf4b7" // nf-oct-container | |
| 27 | + | IconContainer = "\uf489" // nf-oct-container (U+F489) | |
| 28 | 28 | IconServer = "\uf233" // nf-fa-server | |
| 29 | - | IconNetwork = "\U000f0317" // nf-md-lan | |
| 29 | + | IconNetwork = "\U000f06f3" // nf-md-lan (U+F06F3) | |
| 30 | 30 | IconVolume = "\uf1c0" // nf-fa-database | |
| 31 | 31 | IconImage = "\uf187" // nf-fa-archive | |
| 32 | 32 | IconDocker = "\ue7b0" // nf-dev-docker | |
| @@ -24,9 +24,9 @@ const ( | |||||
| 24 | IconRoute = "\uf0e8" // nf-fa-sitemap | 24 | IconRoute = "\uf0e8" // nf-fa-sitemap | ||
| 25 | IconSecret = "\uf023" // nf-fa-lock | 25 | IconSecret = "\uf023" // nf-fa-lock | ||
| 26 | IconToken = "\uf084" // nf-fa-key | 26 | IconToken = "\uf084" // nf-fa-key | ||
| 27 | - | IconContainer = "\uf4b7" // nf-oct-container | 27 | + | IconContainer = "\uf489" // nf-oct-container (U+F489) |
| 28 | IconServer = "\uf233" // nf-fa-server | 28 | IconServer = "\uf233" // nf-fa-server | ||
| 29 | - | IconNetwork = "\U000f0317" // nf-md-lan | 29 | + | IconNetwork = "\U000f06f3" // nf-md-lan (U+F06F3) |
| 30 | IconVolume = "\uf1c0" // nf-fa-database | 30 | IconVolume = "\uf1c0" // nf-fa-database | ||
| 31 | IconImage = "\uf187" // nf-fa-archive | 31 | IconImage = "\uf187" // nf-fa-archive | ||
| 32 | IconDocker = "\ue7b0" // nf-dev-docker | 32 | IconDocker = "\ue7b0" // nf-dev-docker | ||