diff --git a/internal/client/ui/core/networklist/networklist.go b/internal/client/ui/core/networklist/networklist.go index 47d44d3..f4463fd 100644 --- a/internal/client/ui/core/networklist/networklist.go +++ b/internal/client/ui/core/networklist/networklist.go @@ -66,10 +66,10 @@ func (m Model) View() string { for i, networkId := range networks { network := state.State.Networks[networkId] - icon := ui.IconStyle(network.Icon, + icon := ui.IconStyleNotif(network.Icon, lipgloss.Color(network.FgHexColor), lipgloss.Color(network.BgHexColor), - colors.BackgroundDimmer, + colors.BackgroundDimmer, 1, ) if m.index == m.base+i { builder.WriteString(lipgloss.JoinHorizontal( diff --git a/internal/client/ui/ui.go b/internal/client/ui/ui.go index 3d13ee8..1d07f40 100644 --- a/internal/client/ui/ui.go +++ b/internal/client/ui/ui.go @@ -219,6 +219,7 @@ func clamp(v, lower, upper int) int { 🭏🬽 🭈🭄 */ + func IconStyle(icon string, iconFg, iconBg, bg lipgloss.Color) lipgloss.Style { bgStyle := lipgloss.NewStyle().Background(iconBg).Foreground(bg) top := bgStyle.Render("🭠🭘 🭣🭕") @@ -229,3 +230,23 @@ func IconStyle(icon string, iconFg, iconBg, bg lipgloss.Color) lipgloss.Style { combined := lipgloss.JoinVertical(lipgloss.Left, top, middle, bottom) return lipgloss.NewStyle().SetString(combined) } + +var notifications = []string{ + "󰲠", "󰲢", "󰲤", "󰲦", "󰲨", "󰲪", "󰲬", "󰲮", "󰲰", "󰲲", +} + +func IconStyleNotif(icon string, iconFg, iconBg, bg lipgloss.Color, count int) lipgloss.Style { + notifStyle := lipgloss.NewStyle().Background(iconBg).Foreground(colors.Red) + notif := notifications[min(0, max(10, count)-1)] + notif = notifStyle.Render(notif) + + bgStyle := lipgloss.NewStyle().Background(iconBg).Foreground(bg) + top := bgStyle.Render("🭠🭘 🭣🭕") + middle := lipgloss.NewStyle().Width(6).Align(lipgloss.Center). + Background(iconBg).Foreground(iconFg).Render(icon) + bgStyle2 := lipgloss.NewStyle().Foreground(iconBg).Background(bg) + bottom := bgStyle2.Render("🭥🭓██") + notif + bgStyle.Render("") + combined := lipgloss.JoinVertical(lipgloss.Left, top, middle, bottom) + return lipgloss.NewStyle().SetString(combined) +} +