From d7175ed04d8c662c3c3157550c902c858131a5ff Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Wed, 31 Dec 2025 13:24:12 -0500 Subject: [PATCH] feat(ui): Add orange background for modules missing dependencies Modules with handlers but missing dependencies now show orange background with stripes instead of grey. This distinguishes them from unimplemented modules (grey) and helps users identify what needs to be installed. --- internal/ui/components.go | 29 +++++++++++++++++------------ internal/ui/mainmenu.go | 15 ++++++++------- main.go | 20 ++++++++++++++------ 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/internal/ui/components.go b/internal/ui/components.go index 1a546cb..85036e1 100644 --- a/internal/ui/components.go +++ b/internal/ui/components.go @@ -65,20 +65,22 @@ func (m *MonoTheme) Size(name fyne.ThemeSizeName) float32 { // ModuleTile is a clickable tile widget for module selection type ModuleTile struct { widget.BaseWidget - label string - color color.Color - enabled bool - onTapped func() - onDropped func([]fyne.URI) - flashing bool - draggedOver bool + label string + color color.Color + enabled bool + missingDependencies bool + onTapped func() + onDropped func([]fyne.URI) + flashing bool + draggedOver bool } // NewModuleTile creates a new module tile -func NewModuleTile(label string, col color.Color, enabled bool, tapped func(), dropped func([]fyne.URI)) *ModuleTile { +func NewModuleTile(label string, col color.Color, enabled bool, missingDeps bool, tapped func(), dropped func([]fyne.URI)) *ModuleTile { m := &ModuleTile{ - label: strings.ToUpper(label), - color: col, + label: strings.ToUpper(label), + color: col, + missingDependencies: missingDeps, enabled: enabled, onTapped: tapped, onDropped: dropped, @@ -150,8 +152,11 @@ func (m *ModuleTile) CreateRenderer() fyne.WidgetRenderer { tileColor := m.color labelColor := TextColor // White text for all modules - // Grey background for disabled tiles - if !m.enabled { + // Orange background for modules missing dependencies + if m.missingDependencies { + tileColor = color.NRGBA{R: 255, G: 152, B: 0, A: 255} // Orange + } else if !m.enabled { + // Grey background for not implemented modules tileColor = color.NRGBA{R: 80, G: 80, B: 80, A: 255} } diff --git a/internal/ui/mainmenu.go b/internal/ui/mainmenu.go index 0c58a20..5f00541 100644 --- a/internal/ui/mainmenu.go +++ b/internal/ui/mainmenu.go @@ -18,11 +18,12 @@ import ( // ModuleInfo contains information about a module for display type ModuleInfo struct { - ID string - Label string - Color color.Color - Enabled bool - Category string + ID string + Label string + Color color.Color + Enabled bool + Category string + MissingDependencies bool // true if disabled due to missing dependencies } // HistoryEntry represents a completed job in the history @@ -168,8 +169,8 @@ func BuildMainMenu(modules []ModuleInfo, onModuleClick func(string), onModuleDro // buildModuleTile creates a single module tile func buildModuleTile(mod ModuleInfo, tapped func(), dropped func([]fyne.URI)) fyne.CanvasObject { - logging.Debug(logging.CatUI, "building tile %s color=%v enabled=%v", mod.ID, mod.Color, mod.Enabled) - return NewModuleTile(mod.Label, mod.Color, mod.Enabled, tapped, dropped) + logging.Debug(logging.CatUI, "building tile %s color=%v enabled=%v missingDeps=%v", mod.ID, mod.Color, mod.Enabled, mod.MissingDependencies) + return NewModuleTile(mod.Label, mod.Color, mod.Enabled, mod.MissingDependencies, tapped, dropped) } // buildQueueTile creates the queue status tile diff --git a/main.go b/main.go index ca8485b..b3f3d7a 100644 --- a/main.go +++ b/main.go @@ -1617,14 +1617,22 @@ func (s *appState) showMainMenu() { // Convert Module slice to ui.ModuleInfo slice var mods []ui.ModuleInfo for _, m := range modulesList { + hasHandler := m.Handle != nil + depsAvailable := isModuleAvailable(m.ID) + // Module is enabled if: (1) it's Settings (special case) OR (2) it has a handler AND dependencies are available - enabled := m.ID == "settings" || (m.Handle != nil && isModuleAvailable(m.ID)) + enabled := m.ID == "settings" || (hasHandler && depsAvailable) + + // Missing dependencies = has handler but dependencies not available + missingDeps := hasHandler && !depsAvailable && m.ID != "settings" + mods = append(mods, ui.ModuleInfo{ - ID: m.ID, - Label: m.Label, - Color: m.Color, - Category:m.Category, - Enabled: enabled, + ID: m.ID, + Label: m.Label, + Color: m.Color, + Category: m.Category, + Enabled: enabled, + MissingDependencies: missingDeps, }) }