Skip to content

Commit ac9f14e

Browse files
Revert "feat(ui): garden rain mode, settings, and growth fixes"
This reverts commit cbbf296.
1 parent cbbf296 commit ac9f14e

7 files changed

Lines changed: 34 additions & 371 deletions

File tree

internal/config/defaults.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,9 @@ mainline_patterns = []
114114
show_rain_animation = true
115115
116116
# Animation mode: "basic" (rain drops), "advanced" (clouds + rain + flowers),
117-
# "garden" (advanced layout + garden pacing), or "matrix" (falling code characters)
117+
# or "matrix" (falling code characters)
118118
rain_animation_mode = "basic"
119119
120-
# Garden-only (ignored unless rain_animation_mode = "garden"):
121-
# garden_bloom_preset = "calm" # calm | normal | fast
122-
# garden_moisture_cap = "off" # off | soft | tight
123-
124120
# Show flavor quotes in the TUI banner
125121
show_startup_quote = true
126122

internal/config/loader.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ func setDefaults(v *viper.Viper) {
9797
v.SetDefault("ui.startup_quote_interval_sec", defaults.UI.StartupQuoteIntervalSec)
9898
v.SetDefault("ui.rain_tick_ms", defaults.UI.RainTickMS)
9999
v.SetDefault("ui.color_profile", defaults.UI.ColorProfile)
100-
v.SetDefault("ui.garden_bloom_preset", defaults.UI.GardenBloomPreset)
101-
v.SetDefault("ui.garden_moisture_cap", defaults.UI.GardenMoistureCap)
102100
}
103101

104102
// Bounded lock acquisition for config.toml: SaveConfig runs from the TUI on

internal/config/types.go

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Package config defines the git-rain configuration schema and related constants.
22
package config
33

4-
import "strings"
5-
64
// Config represents the complete git-rain configuration
75
type Config struct {
86
Global GlobalConfig `mapstructure:"global" toml:"global"`
@@ -59,17 +57,9 @@ type UIConfig struct {
5957
ShowRainAnimation bool `mapstructure:"show_rain_animation" toml:"show_rain_animation"`
6058

6159
// Animation mode: "basic" (rain drops), "advanced" (clouds + rain + flowers),
62-
// "garden" (advanced layout + optional garden pacing), or "matrix" (falling code glyphs).
60+
// or "matrix" (falling code glyphs in the same column pattern).
6361
RainAnimationMode string `mapstructure:"rain_animation_mode" toml:"rain_animation_mode"`
6462

65-
// GardenBloomPreset tweaks bottom-row growth thresholds when RainAnimationMode is "garden".
66-
// Values: "calm", "normal", "fast". Empty uses "normal".
67-
GardenBloomPreset string `mapstructure:"garden_bloom_preset" toml:"garden_bloom_preset"`
68-
69-
// GardenMoistureCap limits rain accumulation per column in garden mode.
70-
// Values: "off", "soft", "tight". Empty uses "off".
71-
GardenMoistureCap string `mapstructure:"garden_moisture_cap" toml:"garden_moisture_cap"`
72-
7363
// Show flavor quotes: TUI banner plus CLI motivation lines.
7464
ShowStartupQuote bool `mapstructure:"show_startup_quote" toml:"show_startup_quote"`
7565

@@ -101,28 +91,8 @@ const (
10191
UIRainAnimationBasic = "basic"
10292
UIRainAnimationAdvanced = "advanced"
10393
UIRainAnimationMatrix = "matrix"
104-
UIRainAnimationGarden = "garden"
105-
106-
UIGardenBloomCalm = "calm"
107-
UIGardenBloomNormal = "normal"
108-
UIGardenBloomFast = "fast"
109-
110-
UIGardenMoistureOff = "off"
111-
UIGardenMoistureSoft = "soft"
112-
UIGardenMoistureTight = "tight"
11394
)
11495

115-
// UIRainAnimationUsesAdvancedLayout reports whether the mode uses the advanced
116-
// rain field (cloud row, bottom flower row, drop spawn band).
117-
func UIRainAnimationUsesAdvancedLayout(mode string) bool {
118-
switch strings.TrimSpace(strings.ToLower(mode)) {
119-
case UIRainAnimationAdvanced, UIRainAnimationGarden:
120-
return true
121-
default:
122-
return false
123-
}
124-
}
125-
12696
// UIColorProfiles returns valid built-in UI color profile names.
12797
func UIColorProfiles() []string {
12898
return []string{

internal/ui/config_view.go

Lines changed: 9 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -25,102 +25,6 @@ const (
2525
configRowComingSoon
2626
)
2727

28-
// Garden settings are shown directly under "Rain animation mode" (row index 4).
29-
// Logical indices 0–len(configRows)-1 are the static menu; len(configRows)+
30-
// offset are the garden-only rows (see logicalRowIndex).
31-
var gardenSettingsConfigRows = []configRow{
32-
{label: "Garden bloom pace", kind: configRowEnum, options: []string{
33-
config.UIGardenBloomCalm,
34-
config.UIGardenBloomNormal,
35-
config.UIGardenBloomFast,
36-
}},
37-
{label: "Garden moisture cap", kind: configRowEnum, options: []string{
38-
config.UIGardenMoistureOff,
39-
config.UIGardenMoistureSoft,
40-
config.UIGardenMoistureTight,
41-
}},
42-
}
43-
44-
func normalizedRainAnimMode(cfg *config.Config) string {
45-
if cfg == nil || strings.TrimSpace(cfg.UI.RainAnimationMode) == "" {
46-
return config.UIRainAnimationBasic
47-
}
48-
return cfg.UI.RainAnimationMode
49-
}
50-
51-
func gardenSettingsRowCount(cfg *config.Config) int {
52-
if cfg != nil && strings.EqualFold(strings.TrimSpace(cfg.UI.RainAnimationMode), config.UIRainAnimationGarden) {
53-
return len(gardenSettingsConfigRows)
54-
}
55-
return 0
56-
}
57-
58-
func visibleConfigRowCount(cfg *config.Config) int {
59-
return len(configRows) + gardenSettingsRowCount(cfg)
60-
}
61-
62-
// logicalRowIndex maps a visible menu index to the legacy row id used in
63-
// configRowValue / applyConfigChange (garden rows use ids len(configRows)..).
64-
func logicalRowIndex(visibleI int, cfg *config.Config) int {
65-
g := gardenSettingsRowCount(cfg)
66-
if g == 0 {
67-
return visibleI
68-
}
69-
if visibleI < 5 {
70-
return visibleI
71-
}
72-
if visibleI < 5+g {
73-
return len(configRows) + (visibleI - 5)
74-
}
75-
return visibleI - g
76-
}
77-
78-
func configRowAt(visibleI int, cfg *config.Config) configRow {
79-
li := logicalRowIndex(visibleI, cfg)
80-
if li >= len(configRows) {
81-
gi := li - len(configRows)
82-
if gi >= 0 && gi < len(gardenSettingsConfigRows) {
83-
return gardenSettingsConfigRows[gi]
84-
}
85-
return configRows[len(configRows)-1]
86-
}
87-
return configRows[li]
88-
}
89-
90-
func clampConfigCursor(cfg *config.Config, cur int) int {
91-
n := visibleConfigRowCount(cfg)
92-
if n <= 0 {
93-
return 0
94-
}
95-
if cur >= n {
96-
return n - 1
97-
}
98-
if cur < 0 {
99-
return 0
100-
}
101-
return cur
102-
}
103-
104-
func normalizedGardenBloom(s string) string {
105-
s = strings.TrimSpace(strings.ToLower(s))
106-
switch s {
107-
case config.UIGardenBloomCalm, config.UIGardenBloomNormal, config.UIGardenBloomFast:
108-
return s
109-
default:
110-
return config.UIGardenBloomNormal
111-
}
112-
}
113-
114-
func normalizedGardenMoisture(s string) string {
115-
s = strings.TrimSpace(strings.ToLower(s))
116-
switch s {
117-
case config.UIGardenMoistureOff, config.UIGardenMoistureSoft, config.UIGardenMoistureTight:
118-
return s
119-
default:
120-
return config.UIGardenMoistureOff
121-
}
122-
}
123-
12428
var configRows = []configRow{
12529
{label: "Default mode", kind: configRowEnum, options: []string{
12630
"sync-default",
@@ -137,7 +41,6 @@ var configRows = []configRow{
13741
config.UIRainAnimationBasic,
13842
config.UIRainAnimationAdvanced,
13943
config.UIRainAnimationMatrix,
140-
config.UIRainAnimationGarden,
14144
}},
14245
{label: "Show flavor quotes", kind: configRowBool},
14346
{label: "Flavor quote behavior", kind: configRowEnum, options: []string{
@@ -154,11 +57,11 @@ var configRows = []configRow{
15457
{label: "Custom hex palette", kind: configRowComingSoon},
15558
}
15659

157-
func configRowValue(visibleI int, cfg *config.Config) string {
60+
func configRowValue(i int, cfg *config.Config) string {
15861
if cfg == nil {
15962
return ""
16063
}
161-
switch logicalRowIndex(visibleI, cfg) {
64+
switch i {
16265
case 0:
16366
return cfg.Global.DefaultMode
16467
case 1:
@@ -196,23 +99,18 @@ func configRowValue(visibleI int, cfg *config.Config) string {
19699
return cfg.UI.ColorProfile
197100
case 10:
198101
return "coming soon"
199-
case 11:
200-
return normalizedGardenBloom(cfg.UI.GardenBloomPreset)
201-
case 12:
202-
return normalizedGardenMoisture(cfg.UI.GardenMoistureCap)
203102
}
204103
return ""
205104
}
206105

207-
func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
106+
func applyConfigChange(i int, cfg *config.Config, dir int) {
208107
if cfg == nil {
209108
return
210109
}
211-
row := configRowAt(visibleI, cfg)
212-
li := logicalRowIndex(visibleI, cfg)
110+
row := configRows[i]
213111
switch row.kind {
214112
case configRowBool:
215-
switch li {
113+
switch i {
216114
case 1:
217115
cfg.Global.DisableScan = !cfg.Global.DisableScan
218116
case 3:
@@ -222,7 +120,7 @@ func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
222120
}
223121
case configRowEnum:
224122
opts := row.options
225-
cur := configRowValue(visibleI, cfg)
123+
cur := configRowValue(i, cfg)
226124
idx := 0
227125
for j, o := range opts {
228126
if o == cur {
@@ -231,7 +129,7 @@ func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
231129
}
232130
}
233131
idx = (idx + dir + len(opts)) % len(opts)
234-
switch li {
132+
switch i {
235133
case 0:
236134
cfg.Global.DefaultMode = opts[idx]
237135
case 2:
@@ -252,10 +150,6 @@ func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
252150
applyRainTickChange(cfg, opts, dir)
253151
case 9:
254152
cfg.UI.ColorProfile = opts[idx]
255-
case 11:
256-
cfg.UI.GardenBloomPreset = opts[idx]
257-
case 12:
258-
cfg.UI.GardenMoistureCap = opts[idx]
259153
}
260154
case configRowComingSoon:
261155
// reserved
@@ -313,13 +207,12 @@ func (m RepoSelectorModel) updateConfigView(msg tea.KeyMsg, cmds []tea.Cmd) (tea
313207
}
314208

315209
case "down", "j":
316-
if m.configCursor < visibleConfigRowCount(m.cfg)-1 {
210+
if m.configCursor < len(configRows)-1 {
317211
m.configCursor++
318212
}
319213

320214
case " ", "right", "l":
321215
applyConfigChange(m.configCursor, m.cfg, +1)
322-
m.configCursor = clampConfigCursor(m.cfg, m.configCursor)
323216
if m.cfg != nil {
324217
applyColorProfile(m.cfg.UI.ColorProfile)
325218
}
@@ -328,7 +221,6 @@ func (m RepoSelectorModel) updateConfigView(msg tea.KeyMsg, cmds []tea.Cmd) (tea
328221

329222
case "left", "h":
330223
applyConfigChange(m.configCursor, m.cfg, -1)
331-
m.configCursor = clampConfigCursor(m.cfg, m.configCursor)
332224
if m.cfg != nil {
333225
applyColorProfile(m.cfg.UI.ColorProfile)
334226
}
@@ -381,8 +273,7 @@ func (m RepoSelectorModel) viewConfig() string {
381273
valueStyle := lipgloss.NewStyle().Foreground(activeProfile().configValue).Bold(true)
382274
dimStyle := lipgloss.NewStyle().Foreground(activeProfile().configDim)
383275

384-
for i := 0; i < visibleConfigRowCount(m.cfg); i++ {
385-
row := configRowAt(i, m.cfg)
276+
for i, row := range configRows {
386277
cur := " "
387278
if m.configCursor == i {
388279
cur = ">"
@@ -452,7 +343,6 @@ func (m RepoSelectorModel) syncRuntimeFromConfig(cmds []tea.Cmd) (RepoSelectorMo
452343
m.rainAnimationMode = m.cfg.UI.RainAnimationMode
453344
if m.rainBg != nil {
454345
m.rainBg.Mode = m.rainAnimationMode
455-
m.rainBg.ApplyGardenFromConfig(m.cfg)
456346
}
457347
m.showStartupQuote = m.cfg.UI.ShowStartupQuote
458348
m.startupQuoteBehavior = m.cfg.UI.StartupQuoteBehavior

0 commit comments

Comments
 (0)