| 134 | } |
| 135 | |
| 136 | func (m settingsModel) View() string { |
| 137 | if m.app.cfg == nil { |
| 138 | return warnStyle.Render("No config loaded. Run `snix init` first.") |
| 139 | } |
| 140 | its := m.items() |
| 141 | if len(its) == 0 { |
| 142 | return warnStyle.Render("Active profile not found in config.") |
| 143 | } |
| 144 | title := sectionStyle.Render("Settings — anti-fingerprinting knobs for " + |
| 145 | okStyle.Render(m.app.cfg.Active)) |
| 146 | hints := "\n" + mutedStyle.Render("↑↓ move space/⏎ toggle +/- adjust changes save immediately") |
| 147 | |
| 148 | var rows []string |
| 149 | for i, it := range its { |
| 150 | cursor := " " |
| 151 | if i == m.cursor { |
| 152 | cursor = hintStyle.Render("▸ ") |
| 153 | } |
| 154 | rows = append(rows, cursor+lipgloss.NewStyle().Bold(true).Render(it.label)+ |
| 155 | mutedStyle.Render(" → ")+it.value) |
| 156 | } |
| 157 | |
| 158 | // Help for the current row. |
| 159 | helpBody := sectionStyle.Render("What this does") + "\n" + its[m.cursor].help |
| 160 | |
| 161 | w := m.app.width |
| 162 | if w < 40 { |
| 163 | w = 80 |
| 164 | } |
| 165 | leftW := w/2 - 2 |
| 166 | rightW := w - leftW - 4 |
| 167 | left := panelStyle.Width(leftW).Render(strings.Join(rows, "\n")) |
| 168 | right := panelStyle.Width(rightW).Render(helpBody) |
| 169 | return lipgloss.JoinVertical(lipgloss.Left, title, hints, "", |
| 170 | lipgloss.JoinHorizontal(lipgloss.Top, left, right)) |
| 171 | } |
| 172 | |
| 173 | func boolStr(b bool) string { |
| 174 | if b { |