main
6d86999 · 6 months ago 26 commits
 1package ui
 2
 3import (
 4	"strings"
 5	"github.com/The-Robin-Hood/ufWall/internal/sections"
 6)
 7
 8func Footer(styles Styles, activeSection int, width int) string {
 9	var keys []string
10
11	switch activeSection {
12	case sections.StatsSection:
13		keys = []string{"↑↓: navigate", "space: toggle menu"}
14	case sections.PolicySection:
15		keys = []string{"↑↓: navigate", "space: toggle allow/deny"}
16
17	case sections.RulesSection:
18		keys = []string{"enter: actions", "i: info", "a: add rule", "d: delete rule", "s: switch IPv4/IPv6"}
19	default:
20		keys = []string{"tab: next section", "r: refresh"}
21	}
22
23	if len(keys) < 3 {
24		keys = append(keys, "q: quit")
25	}
26	footerText := strings.Join(keys, " | ")
27	return styles.Footer.Width(width).Render(footerText)
28}