mirror of
https://github.com/Kyren223/eko.git
synced 2026-08-28 02:11:31 +00:00
Started working on notifications for networks (got to carried away with
how it looks lol)
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user