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.
This commit is contained in:
parent
5fe3c853f4
commit
d7175ed04d
|
|
@ -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}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
20
main.go
20
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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user